repair_faultModel.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. class flow_repair_faultClassModel extends flowModel
  3. {
  4. public $hstate, $hcolor;
  5. public function initModel()
  6. {
  7. $this->hstate = array('未处理', '已处理');
  8. $this->hcolor = array('#ff6600','green');
  9. }
  10. // 初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示,3打印页,4外部详情页
  11. public function flowrsreplace($rs, $lx=0)
  12. {
  13. $zt = $rs['handle_state'];
  14. // 将id转换为文字
  15. $rs['handle_state'] = $this->getstatezt($zt);
  16. return $rs;
  17. }
  18. // $ors当前单据操作信息,$crs提交过来的信息
  19. public function flowoptmenu($ors, $crs)
  20. {
  21. // 处理维修
  22. if ($ors['num'] == 'noup') {
  23. $sm = $crs['sm']; // 提交过来的说明
  24. $uname = $this->uname;
  25. $uid = $this->uid;
  26. // 更新说明
  27. $this->update([
  28. "explain"=>$sm,
  29. "repairer"=>$uname,
  30. "repairer_id"=>$uid,
  31. ], $this->id);
  32. }
  33. }
  34. //显示操作菜单判断
  35. protected function flowgetoptmenu($num)
  36. {
  37. $row = m("repair_fault")->getone("id={$this->id} and handle_state != 1");
  38. if (empty($row)) return false;
  39. $type_id = $row['type_id'];
  40. $can = m("repair_type")->getone("id={$type_id} and FIND_IN_SET({$this->uid},`head_id`)", 'head_id');
  41. if (empty($can)) {
  42. return false;
  43. } else {
  44. return true;
  45. }
  46. }
  47. public function getstatezt($zt)
  48. {
  49. if (isset($this->hstate[$zt])) {
  50. $html = '<font color="'.$this->hcolor[$zt].'">'.$this->hstate[$zt].'</font>';
  51. return $html;
  52. } else {
  53. return null;
  54. }
  55. }
  56. }