|
@@ -2,21 +2,32 @@
|
|
|
class flow_repair_faultClassModel extends flowModel
|
|
|
{
|
|
|
|
|
|
- public $hstate, $hcolor;
|
|
|
+ public $hstate, $hcolor, $repair_type = [];
|
|
|
|
|
|
public function initModel()
|
|
|
{
|
|
|
$this->hstate = array('未处理', '已处理');
|
|
|
$this->hcolor = array('#ff6600','green');
|
|
|
$this->defaultorder = 'handle_state,asc,optdt,desc';
|
|
|
+ $repair_type = m("repair_type")->getall('1=1');
|
|
|
+ for ($i = 0; $i < count($repair_type); $i++) {
|
|
|
+ $type = $repair_type[$i];
|
|
|
+ $this->repair_type[$type['id']]['name'] = $type['name'];
|
|
|
+ $this->repair_type[$type['id']]['dept'] = $type['dept'];
|
|
|
+ $this->repair_type[$type['id']]['head'] = $type['head'];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示,3打印页,4外部详情页
|
|
|
public function flowrsreplace($rs, $lx=0)
|
|
|
{
|
|
|
$zt = $rs['handle_state'];
|
|
|
+ $typeId = $rs['type_id'];
|
|
|
+
|
|
|
// 将id转换为文字
|
|
|
- $rs['handle_state'] = $this->getstatezt($zt);
|
|
|
+// $rs['handle_state'] = $this->getstatezt($zt);
|
|
|
+// $rs['handle_info'] = $this->getHandleInfo($typeId, $zt);
|
|
|
+ $rs['handle_state'] = $this->getHandleInfo($rs);
|
|
|
|
|
|
return $rs;
|
|
|
}
|
|
@@ -26,15 +37,19 @@ class flow_repair_faultClassModel extends flowModel
|
|
|
{
|
|
|
// 处理维修
|
|
|
if ($ors['num'] == 'noup') {
|
|
|
- $sm = $crs['sm']; // 提交过来的说明
|
|
|
- $uname = $this->uname;
|
|
|
- $uid = $this->uid;
|
|
|
- // 更新说明
|
|
|
- $this->update([
|
|
|
- "explain"=>$sm,
|
|
|
- "repairer"=>$uname,
|
|
|
- "repairer_id"=>$uid,
|
|
|
- ], $this->id);
|
|
|
+
|
|
|
+ // 动作名
|
|
|
+ if ($ors['actname'] == "change_handle") {
|
|
|
+ $sm = $crs['sm']; // 提交过来的说明
|
|
|
+ $uname = $this->option->adminname;
|
|
|
+ $curr_uid = $this->option->adminid;
|
|
|
+ // 更新说明
|
|
|
+ $this->update([
|
|
|
+ "explain"=>$sm,
|
|
|
+ "repairer"=>$uname,
|
|
|
+ "repairer_id"=>$curr_uid,
|
|
|
+ ], $this->id);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -45,7 +60,10 @@ class flow_repair_faultClassModel extends flowModel
|
|
|
$row = m("repair_fault")->getone("id={$this->id} and handle_state != 1");
|
|
|
if (empty($row) || empty($row['type_id'])) return false;
|
|
|
$type_id = $row['type_id'];
|
|
|
- $can = m("repair_type")->getone("id={$type_id} and FIND_IN_SET({$this->uid},`head_id`)", 'head_id');
|
|
|
+ // 获取当操作前用户id,如果有权限操作,则返回true
|
|
|
+ $curr_uid = $this->option->adminid;
|
|
|
+ $where = "id={$type_id} and FIND_IN_SET({$curr_uid},`head_id`)";
|
|
|
+ $can = m("repair_type")->getone($where, 'head_id');
|
|
|
if (empty($can)) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -115,4 +133,55 @@ class flow_repair_faultClassModel extends flowModel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function getHandleInfo($rs) {
|
|
|
+
|
|
|
+ $zt = $rs['handle_state'];
|
|
|
+ $typeId = $rs['type_id'];
|
|
|
+
|
|
|
+ if (isset($this->hstate[$zt])) {
|
|
|
+ $colors = ["#ff8b1a", "#00c959", "#ff4974"];
|
|
|
+ $html = '故障状态:';
|
|
|
+ $html .= '<font style="background-color:'.$colors[$zt].'; padding: 2px 8px; border-radius: 4px; color: #fff">'.$this->hstate[$zt].'</font><br/ >';
|
|
|
+ if (isset($this->repair_type[$typeId])) {
|
|
|
+ $info = $this->repair_type[$typeId];
|
|
|
+ $info['head'] = str_replace(',', '、', $info['head']);
|
|
|
+ if ($zt == 1) {
|
|
|
+ $html .= '处理人:';
|
|
|
+ $html .= "<font style='color: #00c959; padding: 2px 8px; border-radius: 4px;'>【{$info['dept']}】{$rs['repairer']}</font>";
|
|
|
+ } else {
|
|
|
+ $html .= '负责人:';
|
|
|
+ $html .= "<font style='color: #ff8b1a; padding: 2px 8px; border-radius: 4px;'>【{$info['dept']}】{$info['head']}</font>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $html;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isset($this->hstate[$zt])) {
|
|
|
+ $html = '<font style="background-color:'.$colors[$zt].'; padding: 2px 8px; border-radius: 4px; color: #fff">'.$this->hstate[$zt].'</font>';
|
|
|
+ return $html;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// if (isset($this->repair_type[$typeId])) {
|
|
|
+// if ($zt == 1) {
|
|
|
+// $info = $this->repair_type[$typeId];
|
|
|
+// $info['head'] = str_replace(',', '、', $info['head']);
|
|
|
+// $html = "<font style='color: #ff8b1a; padding: 2px 8px; border-radius: 4px;'>【{$info['dept']}】{$info['head']}</font>";
|
|
|
+// return $html;
|
|
|
+// } else {
|
|
|
+// $info = $this->repair_type[$typeId];
|
|
|
+// $info['head'] = str_replace(',', '、', $info['head']);
|
|
|
+// $html = "<font style='color: #ff8b1a; padding: 2px 8px; border-radius: 4px;'>【{$info['dept']}】{$info['head']}</font>";
|
|
|
+// return $html;
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
}
|