|
@@ -5,11 +5,31 @@
|
|
|
class flow_sealaplClassModel extends flowModel
|
|
|
{
|
|
|
|
|
|
+ // level1部门领导
|
|
|
+ // level2办公室
|
|
|
+ // level3业务主管
|
|
|
+ // level4法务部
|
|
|
+ // level5矿分管领导
|
|
|
+ // level6矿长
|
|
|
+
|
|
|
+ protected $examine_dept_dic = ['1'=>"部门领导",'2'=>"办公室",'3'=>"业务主管部门",'4'=>"法律事务部", '5'=>"矿分管领导",'6'=>"矿长党委书记"];
|
|
|
+
|
|
|
protected function flowinit(){
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //提交时调用
|
|
|
+ protected function flowsubmit($na, $sm){
|
|
|
+ if ($sm = '提交') {
|
|
|
+ $info = [
|
|
|
+ "advice_level1_leader"=>$this->flowarr[0]['nowcheckname'],
|
|
|
+ "advice_level1_leader_id"=>$this->flowarr[0]['nowcheckid']
|
|
|
+ ];
|
|
|
+ m('sealapl')->update($info, "id = {$this->id}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//单据判断条件从写$lx类型,$uid用户Id
|
|
|
protected function flowbillwhere($lx, $uid){
|
|
|
$where = '';
|
|
@@ -25,61 +45,145 @@ class flow_sealaplClassModel extends flowModel
|
|
|
//读取印章保管人来审批
|
|
|
protected function flowcheckname($num)
|
|
|
{
|
|
|
-// // 印章负责人
|
|
|
-// (select director from zqoa_seal where id = `seal_name`) is not null
|
|
|
-// if ($num == 'dept_process') {
|
|
|
-// $seal_info = m('seal')->getone("`id` = {$this->rs['seal_name']}");
|
|
|
-// if ($seal_info) {
|
|
|
-// $sid = $seal_info['director_id']; // 审核人Id
|
|
|
-// $sna = $seal_info['director']; // 审核人
|
|
|
-// return array($sid, $sna);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
+ // 自定义审核人
|
|
|
+ if (strpos($num, 'approve') === 0) {
|
|
|
+ $index = substr($num, -1);
|
|
|
+ $sid = $this->rs['advice_level'.$index.'_leader_id'];
|
|
|
+ $sna = $this->rs['advice_level'.$index.'_leader'];
|
|
|
+ return array($sid, $sna);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//展示时替换一下
|
|
|
public function flowrsreplace($rs, $lx=0)
|
|
|
{
|
|
|
|
|
|
+// if (empty($this->id)) $this->id = $rs['id'];
|
|
|
+// if (empty($rs['id'])) $rs['id'] = $this->id;
|
|
|
+
|
|
|
$rs['date'] = $rs['applydt'];
|
|
|
$rs['date_index'] = substr($rs['applydt'],0,4);
|
|
|
|
|
|
|
|
|
+ $sqlStr = "SELECT t.*
|
|
|
+ FROM (
|
|
|
+ -- 子查询,为每个step选取最新的时间对应的记录
|
|
|
+ SELECT step, MAX(optdt) AS max_optdt FROM zqoa_flow_log
|
|
|
+ WHERE mid = {$rs['id']} AND `status` = 1 AND `table` = 'sealapl'
|
|
|
+ GROUP BY step
|
|
|
+ ) AS subquery
|
|
|
+ JOIN zqoa_flow_log AS t ON subquery.step = t.step
|
|
|
+ AND subquery.max_optdt = t.optdt
|
|
|
+ WHERE t.mid = {$rs['id']}
|
|
|
+ AND t.`status` = 1
|
|
|
+ AND t.`table` = 'sealapl'";
|
|
|
+
|
|
|
+ // 未审核完成时,设定签名为空
|
|
|
+ $flow_arr = $this->db->getall($sqlStr);
|
|
|
+ $flow_dict = [];
|
|
|
+ foreach ($flow_arr as $key=>$value) {
|
|
|
+ $flow_dict[$value['name']] = $value;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isset($flow_dict["部门领导审批"])) {
|
|
|
+ $rs['advice_level1_leader'] = null;
|
|
|
+ $rs['advice_level1'] = null;
|
|
|
+ }
|
|
|
+ if (!isset($flow_dict["办公室审批"])) {
|
|
|
+ $rs['advice_level2_leader'] = null;
|
|
|
+ $rs['advice_level2'] = null;
|
|
|
+ }
|
|
|
+ if (!isset($flow_dict["业务主管部门审批"])) {
|
|
|
+ $rs['advice_level3_leader'] = null;
|
|
|
+ $rs['advice_level3'] = null;
|
|
|
+ }
|
|
|
+ if (!isset($flow_dict["法律事务部审批"])) {
|
|
|
+ $rs['advice_level4_leader'] = null;
|
|
|
+ $rs['advice_level4'] = null;
|
|
|
+ }
|
|
|
+ if (!isset($flow_dict["矿分管领导审批"])) {
|
|
|
+
|
|
|
+ $rs['advice_level5_leader'] = null;
|
|
|
+ $rs['advice_level5'] = null;
|
|
|
+ }
|
|
|
+ if (!isset($flow_dict["矿长党委书记审批"])) {
|
|
|
+ $rs['advice_level6_leader'] = null;
|
|
|
+ $rs['advice_level6'] = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ $rs['advice_leader_max'] = empty($rs['advice_level6_leader']) ? $rs['advice_level5_leader'] : $rs['advice_level6_leader'];
|
|
|
+
|
|
|
$flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=1 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
$rs['dept_manager'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
|
|
|
|
|
|
+
|
|
|
if (!empty($rs['opinion_dept'])) {
|
|
|
$dept = $rs['opinion_dept'];
|
|
|
- if ($dept == 1) {
|
|
|
- $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
- $rs['advice_level1_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
- } else if ($dept == 2) {
|
|
|
-
|
|
|
- } else if ($dept == 3) {
|
|
|
- $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
- $rs['advice_level3_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
- } else if ($dept == 4) {
|
|
|
- $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
- $rs['advice_level4_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
+
|
|
|
+ // 办公室需要审核部门
|
|
|
+ $examine_dept_arr = explode(',',$dept);
|
|
|
+ $examine_info = '';
|
|
|
+ foreach ($examine_dept_arr as $v) {
|
|
|
+ $examine_info .= $this->examine_dept_dic[$v].'、';
|
|
|
+ }
|
|
|
+ if (!empty($examine_info)) {
|
|
|
+ $examine_info = substr($examine_info, 0, strlen($examine_info) - 3);
|
|
|
+ $examine_info = '需要“'.$examine_info.'”审核。';
|
|
|
}
|
|
|
+ if (!empty($rs['advice_level2'])) {
|
|
|
+ $rs['advice_level2'] = $rs['advice_level2'].'<br>'.$examine_info;
|
|
|
+ } else {
|
|
|
+ $rs['advice_level2'] = $examine_info;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表-审批人:
|
|
|
+// if ($dept == 1) {
|
|
|
+// $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
+// $rs['advice_level1_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
+// } else if ($dept == 2) {
|
|
|
+//
|
|
|
+// } else if ($dept == 3) {
|
|
|
+// $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
+// $rs['advice_level3_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
+// } else if ($dept == 4) {
|
|
|
+// $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
+// $rs['advice_level4_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
+ // 办公室审核人
|
|
|
$flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=2 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
|
|
|
- $rs['office_applyer'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
+ $rs['advice_level2_leader'] = $flow_info ? $flow_info['checkname'] : null;
|
|
|
|
|
|
+ // 印章专管人
|
|
|
$seal = m('seal')->getone("id = {$rs['seal_name']}");
|
|
|
- $rs['office_applyer1'] = $seal['specialized'];
|
|
|
-
|
|
|
- $rs['seal_name'] = m('seal')->getone("id = {$rs['seal_name']}")['name'];
|
|
|
- $rs['opinion_relay'] = str_replace($rs['opinion_relay'], '\n', '<br />');
|
|
|
+ $rs['office_applyer'] = $seal['specialized'];
|
|
|
+ $rs['seal_name'] = $seal['name'];
|
|
|
|
|
|
// 流程状态
|
|
|
$rs['state_info'] = $this->getApproval($rs['nowcheckname'] ?? ''); // 当前审核人
|
|
|
|
|
|
+ // 详情编号展示
|
|
|
+ $date = $this->rs['applydt'] ?? null;
|
|
|
+ if ($date) {
|
|
|
+ $year = date("Y", strtotime($date));
|
|
|
+ $month = date("m", strtotime($date));
|
|
|
+ $this_month = date("Y-m", strtotime($date));
|
|
|
+ $last_month = date("Y-m", strtotime("-1 month", strtotime($date)));
|
|
|
+
|
|
|
+ $this_month_max_id = $this->getone("DATE_FORMAT(applydt,'%Y-%m') = '{$this_month}'", "max(id) as id")['id'];
|
|
|
+ $last_month_max_id = $this->getone("DATE_FORMAT(applydt,'%Y-%m') = '{$last_month}'", "max(id) as id")['id'];
|
|
|
+ $this_month_max_id = empty($last_month_max_id) ? 2 : $this_month_max_id;
|
|
|
+
|
|
|
+ $rs['year'] = $year;
|
|
|
+ $rs['month'] = $month;
|
|
|
+ $rs['num'] = ($this->id - (empty($last_month_max_id) ? $this_month_max_id - 2: $last_month_max_id));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return $rs;
|
|
|
}
|
|
|
|
|
@@ -118,28 +222,81 @@ class flow_sealaplClassModel extends flowModel
|
|
|
}
|
|
|
|
|
|
//审核之前调用$zt 状态, $sm说明
|
|
|
- protected function flowcheckbefore($zt, $sm, $ufied){
|
|
|
+ protected function flowcheckbefore($zt, $sm, $ufied) {
|
|
|
if ($zt == 1) {
|
|
|
- if ($this->nowcourse['step'] == 3 && $this->nowcourse['name'] == '负责部门审批') {
|
|
|
- $opinion_dept = $this->rs['opinion_dept'];
|
|
|
- if ($opinion_dept == 1) {
|
|
|
- m('sealapl')->update(["advice_level1"=>$sm],"id={$this->id}");
|
|
|
- } else if ($opinion_dept == 2) {
|
|
|
- m('sealapl')->update(["advice_level2"=>$sm],"id={$this->id}");
|
|
|
- } else if ($opinion_dept == 3) {
|
|
|
- m('sealapl')->update(["advice_level3"=>$sm],"id={$this->id}");
|
|
|
- } else if ($opinion_dept == 4) {
|
|
|
- m('sealapl')->update(["advice_level4"=>$sm],"id={$this->id}");
|
|
|
- }
|
|
|
+ $nodes_old = $this->rs['notes'];
|
|
|
+ if (isset($this->nowcourse['step'])) {
|
|
|
+ if (empty($sm)) $sm = '同意';
|
|
|
+ $step_name = $this->nowcourse['name'];
|
|
|
+ $info = "";
|
|
|
+ if ($step_name == '部门领导审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level1"=>$sm,
|
|
|
+ "advice_level1_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level1_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>'部门领导-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+
|
|
|
+ } else if ($step_name == '办公室审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level2"=>$sm,
|
|
|
+ "advice_level2_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level2_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>$nodes_old.(empty($nodes_old) ? "" : "<br>").'办公室-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+ } else if ($step_name == '业务主管部门审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level3"=>$sm,
|
|
|
+ "advice_level3_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level3_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>$nodes_old.(empty($nodes_old) ? "" : "<br>").'业务主管部门-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+ } else if ($step_name == '法律事务部审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level4"=>$sm,
|
|
|
+ "advice_level4_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level4_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>$nodes_old.(empty($nodes_old) ? "" : "<br>").'法律事务部-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+ } else if ($step_name == '矿分管领导审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level5"=>$sm,
|
|
|
+ "advice_level5_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level5_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>$nodes_old.(empty($nodes_old) ? "" : "<br>").'矿分管领导-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+ } else if ($step_name == '矿长党委书记审批') {
|
|
|
+ $info = [
|
|
|
+ "advice_level6"=>$sm,
|
|
|
+ "advice_level6_leader"=>$this->rock->adminname,
|
|
|
+ "advice_level6_leader_id"=>$this->rock->adminid,
|
|
|
+ "notes"=>$nodes_old.(empty($nodes_old) ? "" : "<br>").'矿长党委书记-'.$this->rock->adminname.":".$sm
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if (!empty($info)) m('sealapl')->update($info,"id={$this->id}");
|
|
|
+
|
|
|
}
|
|
|
+// if ($this->nowcourse['step'] == 3 && $this->nowcourse['name'] == '负责部门审批') {
|
|
|
+// $opinion_dept = $this->rs['opinion_dept'];
|
|
|
+// if ($opinion_dept == 1) {
|
|
|
+// m('sealapl')->update(["advice_level1"=>$sm],"id={$this->id}");
|
|
|
+// } else if ($opinion_dept == 2) {
|
|
|
+// m('sealapl')->update(["advice_level2"=>$sm],"id={$this->id}");
|
|
|
+// } else if ($opinion_dept == 3) {
|
|
|
+// m('sealapl')->update(["advice_level3"=>$sm],"id={$this->id}");
|
|
|
+// } else if ($opinion_dept == 4) {
|
|
|
+// m('sealapl')->update(["advice_level4"=>$sm],"id={$this->id}");
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
- if(isset($this->nowcourse['step']) && !empty($sm)) {
|
|
|
- $info_old = $this->rs['notes'];
|
|
|
- $info = $this->nowcourse['step'].'.'.$this->adminname.":".$sm."\n";
|
|
|
- $info = $info_old.$info;
|
|
|
- $info = substr($info, 0, strlen($info)-1);
|
|
|
- m('sealapl')->update(["notes"=>$info],"id={$this->id}");
|
|
|
- }
|
|
|
+// if(isset($this->nowcourse['step']) && !empty($sm)) {
|
|
|
+// $info_old = $this->rs['notes'];
|
|
|
+// $info = $this->nowcourse['step'].'.'.$this->adminname.":".$sm."\n";
|
|
|
+// $info = $info_old.$info;
|
|
|
+// $info = substr($info, 0, strlen($info)-1);
|
|
|
+// m('sealapl')->update(["notes"=>$info],"id={$this->id}");
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|