| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- /**
- * 模块.印章申请
- */
- class flow_sealaplClassModel extends flowModel
- {
- protected function flowinit(){
- }
- //单据判断条件从写$lx类型,$uid用户Id
- protected function flowbillwhere($lx, $uid){
- $where = '';
- if ($uid == 'all') {
- $where = 'and '.$this->adminid.' in (1, 28)';
- }
- return [
- 'where' => $where,
- 'order'=>'id desc'
- ];
- }
- //读取印章保管人来审批
- 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);
- // }
- //
- // }
- }
- //展示时替换一下
- public function flowrsreplace($rs, $lx=0)
- {
- $rs['date'] = $rs['applydt'];
- $rs['date_index'] = substr($rs['applydt'],0,4);
- $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;
- }
- }
- $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;
- $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['state_info'] = $this->getApproval($rs['nowcheckname'] ?? ''); // 当前审核人
- return $rs;
- }
- // 审核样式
- public function getApproval($names) {
- if (empty($names)) {
- $html = '<font style="background-color:#00c959; padding: 2px 8px; border-radius: 4px; color: #fff">已审核</font>';
- return $html;
- } else {
- $html = '<font style="background-color:#ff4974; padding: 2px 8px; border-radius: 4px; color: #fff">待审核</font><br /><font style="color: #ff4974">审核人:'.$names.'</font>';
- return $html;
- }
- }
- public function inputtitle()
- {
- return "枣泉煤矿用印审批表";
- }
- protected function flowdatalog($arr)
- {
- $arr['title'] = $this->inputtitle();
- return $arr;
- }
- // $ors当前单据操作信息,$crs提交过来的信息
- public function flowoptmenu($ors, $crs)
- {
- if ($ors['num'] == 'dept_process') {
- }
- }
- //审核之前调用$zt 状态, $sm说明
- 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}");
- }
- }
- }
- 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}");
- }
- }
- }
|