新增重算

master
chenzhi 4 years ago
parent fb75494c64
commit f0e43df7c2

@ -25,11 +25,32 @@ class FinancialSummaryController extends AdminController
if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){
$this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2));
}
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary");
if(!$lastRecount){
$lastRecount = "无";
}
$this->assign('lastRecount',$lastRecount);
$this->getYearList();
$this->getYearData();
$this->display();
}
public function updateStatement()
{
$temp = date('Y',time()).'-'.(date('m',time())-1);
$params = "cd ".ROOTTTTT.";php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);
}else{
$this->ajaxReturn(["error"=>"error"]);
}
}
//获取指定年份数据
public function getYearData()
{
@ -142,6 +163,23 @@ class FinancialSummaryController extends AdminController
}
$this->assign('YearList', $list);
}
public function menuAuth()
{
$mentBtn = [
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}

@ -8,6 +8,7 @@ use Think\Model;
*/
class CmdTasksModel extends Model{
protected $tablePrefix = 'tab_';
//获取待执行任务
public function getTask()
{
//按顺序获取任务
@ -24,8 +25,37 @@ class CmdTasksModel extends Model{
return $task;
}
}
//更新
public function updateTask($params)
{
$this->save($params);
}
//获取同类型任务最后一次操作时间
public function getTypeLastTask($type)
{
$task = $this->field("end_time")->where(['status'=>"2",'type'=>$type])->order("id desc")->find();
if(empty($task)){
return false;
}else{
return date("Y-d-m H:i:s",$task['end_time']);
}
}
//插入任务
public function addTask($type,$params,$need_tasksid = true)
{
$task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find();
if(!empty($task)){
return false;
}
if($need_tasksid){
$params = rtrim($params,";").'/taskid/{$taskid};';
}
$save = [
"uid"=>$_SESSION['onethink_admin']['user_auth']['uid'],
"created_time"=>time(),
"params"=>$params,
"type"=>$type
];
return $this->add($save);
}
}

@ -39,43 +39,12 @@
font-size: 12px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
.butnbox {padding:10px 0 15px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
@ -89,7 +58,7 @@
</style>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch search_list fl cf">
<div class="jssearch search_list fl cf" style="margin-bottom: 10px;">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
@ -119,7 +88,13 @@
</div>
</div>
<div class="butnbox">
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
@ -268,9 +243,7 @@
//导航高亮
highlight_subnav('{:U("FinancialSummary/index")}');
$(function () {
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
});
</script>
<script type="text/javascript">
@ -311,6 +284,26 @@
}
window.location.href = url;
});
$("#updateStatement").on("click",function(){
layer.confirm("新增结算需要花费2分钟左右时间,并且只上个月统计信息,无需结算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看');
}else{
layer.alert('添加任务失败,已有重算任务。请上个重算任务完成');
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
})
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
@ -462,6 +455,9 @@
layer.close(index);
});
}
</script>
</block>
Loading…
Cancel
Save