diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php index b75b0de48..0998a121f 100644 --- a/Application/Admin/Controller/FinancialSummaryController.class.php +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -29,13 +29,7 @@ class FinancialSummaryController extends AdminController if(!IS_ROOT){ $this->OpAuthList= getModuleControllerAuth(); } - $this->assign('menubtn',$this->menuAuth()); - $lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary"); - if(!$lastRecount){ - $lastRecount = "无"; - } - $this->assign('lastRecount',$lastRecount); - + $this->assign('menubtn',$this->menuAuth()); $this->getYearList(); $this->getYearData(); $this->display(); @@ -43,9 +37,10 @@ class FinancialSummaryController extends AdminController } public function updateStatement() { - - $temp = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); - $params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}"; + if(!isset($_REQUEST['time'])) $this->error("参数错误"); + + $time = $_REQUEST['time']; + $params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$time}"; $r = D("CmdTasks")->addTask("FinancialSummary",$params); if($r){ $this->ajaxReturn(["success"=>"ok"]); diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html index d24b8ff3a..9d912a930 100644 --- a/Application/Admin/View/FinancialSummary/index.html +++ b/Application/Admin/View/FinancialSummary/index.html @@ -225,6 +225,24 @@
+ @@ -285,26 +303,70 @@ 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分钟后刷新查看',function(){ - window.location.reload(); - }); - }else{ - layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成'); + var html = $("#updateStatementTpl").html(); + layer.open({ + type: 1, + title: "汇总重算", + maxWidth:720, + closeBtn: 1, + shadeClose: true, + content: html, + success:function(){ + $("#updateStatementSubmit").off("click"); + $("#updateStatementTime").datetimepicker({ + format: 'yyyy-mm', + language: "zh-CN", + showMeridian:true, + pickDate:true, + startView: 3, + minView: 3, + autoclose: true, + pickTime:true + }); + $("#updateStatementSubmit").on("click",function() { + var subtime= $("#updateStatementTime").val(); + if(subtime == ''){ + layer.msg('请先选择要重算的月份'); + return false; } - }, - error:function(){ - layer.alert("网络错误或超时"); - return false; - } - }); - }); + var subtimeArr = subtime.split("-"); + + var today = new Date(); + today.setTime(today.getTime()); + var year = today.getFullYear(); + var month = today.getMonth()+1; + + if(subtimeArr[0] > year){ + layer.msg('要重算的月份必须小于当前时间'); + return false; + } + if(subtimeArr[0] == year && subtimeArr[1] >= month){ + layer.msg('要重算的月份必须小于当前时间'); + return false; + } + + $.ajax({ + type: 'post', + url: "{:U('updateStatement')}", + data:{time:subtime}, + success: function(data) { + if(data.success){ + layer.alert('添加重算任务成功,请2分钟后刷新查看',function(){ + window.location.reload(); + }); + }else{ + layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成'); + } + }, + error:function(){ + layer.alert("网络错误或超时"); + return false; + } + }); + }); + + } + }); }) //回车自动提交