From 2a28cf900861eaf3226ede75286afc50e5556349 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Sun, 26 Apr 2020 15:58:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=9A=E5=90=88=E8=B4=A2=E5=8A=A1=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...regateFinanceStatementController.class.php | 133 +++++++++++++++++- .../View/AggregateFinanceStatement/lists.html | 55 ++------ 2 files changed, 145 insertions(+), 43 deletions(-) diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index f8f519ece..c3918e0bb 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -17,17 +17,25 @@ class AggregateFinanceStatementController extends ThinkController "5"=>"已到账" ]; public $admininfo; + public $OpAuthList=[]; + //TODO: public function _initialize() { $this->admininfo = $_SESSION['onethink_admin']['user_auth']; parent::_initialize(); } + public function lists() { $is_export= false; if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ $is_export = true; } - + //权限 + if(!IS_ROOT){ + $this->getAuth(); + } + + //分页 $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 $row = intval(I('row', 0)); @@ -99,6 +107,8 @@ class AggregateFinanceStatementController extends ThinkController $data[$key]['endtime'] = date('Y-m-d',$value['endtime']); $data[$key]['withdraw_type_1'] = ($value['withdraw_type'] == 1 ? "月结" :"周结"); $data[$key]['withdraw_type_2'] = ($value['withdraw_type'] == 2 ? "补点" :"正常结算"); + + $data[$key]['oplist'] = $this->OpAuth($value); } $count = M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money")->where($map)->find(); @@ -109,6 +119,8 @@ class AggregateFinanceStatementController extends ThinkController if ($page) { $this->assign('_page', $page); } + // + $this->assign('menubtn',$this->menuAuth()); $this->assign('data',$data); $this->assign('total',$count['ratio_money']); $this->assign('channel',$this->getAggChannel()); @@ -434,7 +446,14 @@ class AggregateFinanceStatementController extends ThinkController public function cancelApply(){ if(!isset($_REQUEST['id'])) $this->error("参数错误"); $id = $_REQUEST['id']; + $data = M("aggregate_statement","tab_")->where("id = '{$id}'")->find(); $savedata = ["verify_status"=>0,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]]; + $first_party_info = json_decode($data['first_party_info'], 1); + if($first_party_info['partner'] == $data['channel_name']){ + $savedata['second_party_info'] = $data['first_party_info']; + $savedata['first_party_info'] = $data['second_party_info']; + $savedata['pay_type'] =0; + } M("aggregate_statement","tab_")->where("id ='{$id}'")->save($savedata); $this->ajaxReturn(array( 'status' => 1, @@ -531,6 +550,118 @@ class AggregateFinanceStatementController extends ThinkController $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); } + //获取权限 + public function getAuth() + { + $group = $_SESSION['onethink_admin']['user_group_id']; + //获取全部权限列表 + $ruleList = M("AuthGroup")->field("rules")->where("id='{$group}'")->find()['rules']; + //获取所有含有规则的数据 + $authlist = M("AuthRule")->field('name')->where("name like 'Admin/AggregateFinanceStatement%' AND id in ($ruleList)")->select(); + $Auth = []; + foreach ($authlist as $k => $v) { + $a = str_replace("Admin/AggregateFinanceStatement/","",$v['name']); + $Auth[] = $a; + } + $this->OpAuthList = $Auth; + } + public function OpAuth($info) + { + $id = $info['id']; + $img = $info['ext_field']; + $remark = $info['remark']; + //原始列表 + $opBtn = [ + "viewStatement"=>"查看", + "createStatement"=>"申请开票", + "editStatement"=>"编辑", + "uploadVoucher"=>"上传凭证", + "viewVoucher"=>"查看凭证", + "editVoucher"=>" 编辑凭证", + "addRemark"=>"新增备注", + "editRemark"=>"修改备注", + "viewRemark"=>"查看备注", + "cancelVerify"=>"撤销审核", + "cancelApply"=>"撤销申请", + ]; + //操作对应菜单 + $optist = []; + switch ($info['verify_status']) { + case '-1': + $optist = ["viewStatement","cancelVerify","addRemark","editRemark","viewRemark"]; + break; + case '0': + $optist = ["viewStatement","createStatement"]; + break; + case '1': + $optist = ["viewStatement","editStatement","cancelApply"]; + break; + case '2': + $optist = ["viewStatement","cancelVerify","addRemark","editRemark","viewRemark"]; + break; + case '3': + $optist = ["viewStatement","uploadVoucher","addRemark","editRemark","viewRemark"]; + break; + case '4': + $optist = ["viewStatement","viewVoucher","editVoucher","addRemark","editRemark","viewRemark"]; + break; + case '5': + $optist = ["viewStatement","uploadVoucher","viewVoucher","editVoucher","addRemark","editRemark","viewRemark"]; + break; + default: + break; + } + //判断凭证和备注 + if(empty($info['ext_field'])){ + //未上传凭证 + if($optist['viewVoucher']) unset($optist['viewVoucher']); + if($optist['editVoucher']) unset($optist['editVoucher']); + }else{ + if($optist['uploadVoucher']) unset($optist['uploadVoucher']); + } + if(empty($info['remark'])){ + //未上传备注 + if($optist['editRemark']) unset($optist['editRemark']); + if($optist['viewRemark']) unset($optist['viewRemark']); + }else{ + if($optist['addRemark']) unset($optist['addRemark']); + } + // + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $opBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $opBtn[$v]; + } + } + } + return $resarr; + } + public function menuAuth() + { + $optist = ['agreeApply',"refuseApply","Invoiced","Received","updateStatement","export"]; + $mentBtn = [ + "agreeApply"=>"审批通过", + "refuseApply"=>"审批拒绝", + "Invoiced"=>"已开票", + "Received"=>"已到账", + "updateStatement"=>"重算结算金额", + "export"=>"批量导出" + ]; + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $mentBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $mentBtn[$v]; + } + } + } + return $resarr; + } } diff --git a/Application/Admin/View/AggregateFinanceStatement/lists.html b/Application/Admin/View/AggregateFinanceStatement/lists.html index 518c86a67..302016bf2 100644 --- a/Application/Admin/View/AggregateFinanceStatement/lists.html +++ b/Application/Admin/View/AggregateFinanceStatement/lists.html @@ -113,13 +113,15 @@
@@ -165,40 +167,9 @@ {$data.admin_name} {$data.create_time} - 查看 - 上传凭证 - 查看凭证 - 编辑凭证 - 新增备注 - 修改备注 - 查看备注 - - 撤销审核 - 撤销申请 - - - - - - - - 申请开票 - - - 编辑 - - - - - - - - - + + {$vo} + @@ -240,7 +211,7 @@