sealaplModel.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /**
  3. * 模块.印章申请
  4. */
  5. class flow_sealaplClassModel extends flowModel
  6. {
  7. protected function flowinit(){
  8. }
  9. //单据判断条件从写$lx类型,$uid用户Id
  10. protected function flowbillwhere($lx, $uid){
  11. $where = '';
  12. if ($uid == 'all') {
  13. $where = 'and '.$this->adminid.' in (1, 28)';
  14. }
  15. return [
  16. 'where' => $where,
  17. 'order'=>'id desc'
  18. ];
  19. }
  20. //读取印章保管人来审批
  21. protected function flowcheckname($num)
  22. {
  23. // // 印章负责人
  24. // (select director from zqoa_seal where id = `seal_name`) is not null
  25. // if ($num == 'dept_process') {
  26. // $seal_info = m('seal')->getone("`id` = {$this->rs['seal_name']}");
  27. // if ($seal_info) {
  28. // $sid = $seal_info['director_id']; // 审核人Id
  29. // $sna = $seal_info['director']; // 审核人
  30. // return array($sid, $sna);
  31. // }
  32. //
  33. // }
  34. }
  35. //展示时替换一下
  36. public function flowrsreplace($rs, $lx=0)
  37. {
  38. $rs['date'] = $rs['applydt'];
  39. $rs['date_index'] = substr($rs['applydt'],0,4);
  40. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=1 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  41. $rs['dept_manager'] = $flow_info ? $flow_info['checkname'] : null;
  42. if (!empty($rs['opinion_dept'])) {
  43. $dept = $rs['opinion_dept'];
  44. if ($dept == 1) {
  45. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  46. $rs['advice_level1_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  47. } else if ($dept == 2) {
  48. } else if ($dept == 3) {
  49. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  50. $rs['advice_level3_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  51. } else if ($dept == 4) {
  52. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  53. $rs['advice_level4_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  54. }
  55. }
  56. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=2 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  57. $rs['office_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  58. $seal = m('seal')->getone("id = {$rs['seal_name']}");
  59. $rs['office_applyer1'] = $seal['specialized'];
  60. $rs['seal_name'] = m('seal')->getone("id = {$rs['seal_name']}")['name'];
  61. $rs['opinion_relay'] = str_replace($rs['opinion_relay'], '\n', '<br />');
  62. // 流程状态
  63. $rs['state_info'] = $this->getApproval($rs['nowcheckname'] ?? ''); // 当前审核人
  64. return $rs;
  65. }
  66. // 审核样式
  67. public function getApproval($names) {
  68. if (empty($names)) {
  69. $html = '<font style="background-color:#00c959; padding: 2px 8px; border-radius: 4px; color: #fff">已审核</font>';
  70. return $html;
  71. } else {
  72. $html = '<font style="background-color:#ff4974; padding: 2px 8px; border-radius: 4px; color: #fff">待审核</font><br /><font style="color: #ff4974">审核人:'.$names.'</font>';
  73. return $html;
  74. }
  75. }
  76. public function inputtitle()
  77. {
  78. return "枣泉煤矿用印审批表";
  79. }
  80. protected function flowdatalog($arr)
  81. {
  82. $arr['title'] = $this->inputtitle();
  83. return $arr;
  84. }
  85. // $ors当前单据操作信息,$crs提交过来的信息
  86. public function flowoptmenu($ors, $crs)
  87. {
  88. if ($ors['num'] == 'dept_process') {
  89. }
  90. }
  91. //审核之前调用$zt 状态, $sm说明
  92. protected function flowcheckbefore($zt, $sm, $ufied){
  93. if ($zt == 1) {
  94. if ($this->nowcourse['step'] == 3 && $this->nowcourse['name'] == '负责部门审批') {
  95. $opinion_dept = $this->rs['opinion_dept'];
  96. if ($opinion_dept == 1) {
  97. m('sealapl')->update(["advice_level1"=>$sm],"id={$this->id}");
  98. } else if ($opinion_dept == 2) {
  99. m('sealapl')->update(["advice_level2"=>$sm],"id={$this->id}");
  100. } else if ($opinion_dept == 3) {
  101. m('sealapl')->update(["advice_level3"=>$sm],"id={$this->id}");
  102. } else if ($opinion_dept == 4) {
  103. m('sealapl')->update(["advice_level4"=>$sm],"id={$this->id}");
  104. }
  105. }
  106. }
  107. if(isset($this->nowcourse['step']) && !empty($sm)) {
  108. $info_old = $this->rs['notes'];
  109. $info = $this->nowcourse['step'].'.'.$this->adminname.":".$sm."\n";
  110. $info = $info_old.$info;
  111. $info = substr($info, 0, strlen($info)-1);
  112. m('sealapl')->update(["notes"=>$info],"id={$this->id}");
  113. }
  114. }
  115. }