diff --git a/app/workorder/controller/Index.php b/app/workorder/controller/Index.php index 426982b..ca5b165 100644 --- a/app/workorder/controller/Index.php +++ b/app/workorder/controller/Index.php @@ -122,17 +122,47 @@ class Index extends BaseController } } else { $param = get_params(); - $id = isset($param['id']) ? $param['id'] : 0; + $id = !empty($param['id']) ? intval($param['id']) : 0; + $workorder = WorkOrderList::where('id', $id) - ->field('id, project_id, problemtype, uid, username, contact, content, remark, status, solve, creater, sub_time, create_time') + ->field('id, project_id, problemtype, uid, username, contact, email, content, remark, status, solve, creater, sub_time, create_time') ->find(); if ($workorder) { + // 批量获取相关ID + $projectId = $workorder['project_id']; + $createrId = $workorder['creater']; + // $solveId = $workorder['solve']; + + // 查询相关名称和联系方式 + $projectName = $projectId ? Db::name('Project')->where('id', $projectId)->value('name_short') : '-'; + $adminName = $createrId ? Db::name('Admin')->where('id', $createrId)->value('name') : '-'; + // $solveName = $solveId ? Db::name('Admin')->where('id', $solveId)->value('name') : '-'; + + // 联系方式优先用工单自带,否则查创建人 + $contact = !empty($workorder['contact']) ? $workorder['contact'] : ( + $createrId ? (Db::name('Admin')->where('id', $createrId)->value('mobile') ?: '-') : '-' + ); + $email = !empty($workorder['email']) ? $workorder['email'] : ( + $createrId ? (Db::name('Admin')->where('id', $createrId)->value('email') ?: '-') : '-' + ); + $uid = !empty($workorder['uid']) ? $workorder['uid'] : ( + $createrId ? (Db::name('Admin')->where('id', $createrId)->value('id') ?: '-') : '-' + ); + + // 赋值 + $workorder['project_id'] = $projectName ?: '-'; + $workorder['creater'] = $adminName ?: '-'; + // $workorder['solve'] = $solveName ?: '-'; + $workorder['contact'] = $contact; + $workorder['email'] = $email ?: '-'; + $workorder['uid'] = $uid ?: '-'; View::assign('detail', $workorder); } else { View::assign('message', '没有详细数据'); } return view(); + // return json($workorder); } } @@ -153,6 +183,22 @@ class Index extends BaseController } else { $view->contact = Db::name('Admin')->where('id', $view['creater'])->value('mobile') ?: '-'; } + if (!empty($view['uid'])) { + $view->uid = $view['uid']; + } else { + $view->uid = Db::name('Admin')->where('id', $view['creater'])->value('id') ?: '-'; + } + if (!empty($view['email'])) { + $view->email = $view['email']; + } else { + $view->email = Db::name('Admin')->where('id', $view['creater'])->value('email') ?: '-'; + } + if (!empty($view['project_order_id'])) { + $view->project_order_id = $view['project_order_id']; + } else { + $projectOrderId = Db::name('WorkOrder')->where('id', $id ?: $view['id'])->value('project_order_id'); + $view->project_order_id = $projectOrderId ?: $view['id']; + } $adminName = Db::name('Admin')->where('id', $view['creater'])->value('name'); $view->creater = $adminName ?: '-'; $solveName = Db::name('Admin')->where('id', $view['solve'])->value('name'); diff --git a/app/workorder/view/index/edit.html b/app/workorder/view/index/edit.html index 38836bc..d781c73 100644 --- a/app/workorder/view/index/edit.html +++ b/app/workorder/view/index/edit.html @@ -7,18 +7,23 @@ 工单状态* - > - - + + @@ -33,44 +38,130 @@ -

问题简述

- - - - - - - -
项目问题 +
+

基础信息

+ + + + + + + + + + + + + + + + + + + + + + + + + +
工单ID + {$detail['id']} + 项目工单ID + {$detail['id']} +
隶属项目 + {$detail['project_id']} + 问题类型 + {$detail['problemtype']} +
提交人 + {$detail['creater']} + 联系电话 + {$detail['contact']} +
电子邮箱 + {$detail['email']} + 提交时间 + {$detail['sub_time']} +
+
+ +
+

问题沟通

+
+
+

问题描述

-
备注{$detail.remark}
+ +
+

备注

+

{$detail.remark}

+
+ + + + + \ No newline at end of file diff --git a/app/workorder/view/index/index.html b/app/workorder/view/index/index.html index 1f96f17..1a348bc 100644 --- a/app/workorder/view/index/index.html +++ b/app/workorder/view/index/index.html @@ -103,7 +103,7 @@ var id = data.id; var status = data.status; // 获取当前行的status // 处理工单时带上status参数 - tool.open('/workorder/index/edit/id/' + id + '/status/' + status, '处理工单'); + tool.open('/workorder/index/edit?id=' + id + '&status=' + status, '处理工单'); } else if (obj.event === 'delete') { var id = data.id; layui.layer.confirm('确定要删除该工单吗?', {icon: 3, title: '提示'}, function(index){ diff --git a/app/workorder/view/index/view.html b/app/workorder/view/index/view.html index 8405c8e..49380b6 100644 --- a/app/workorder/view/index/view.html +++ b/app/workorder/view/index/view.html @@ -1,156 +1,174 @@
- -

工单详情 - ID:{$view['id']}

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
隶属项目{$view['project_id']}工单状态 - "未解决", - 1 => "解决中", - 2 => "已解决", - 3 => "已关闭" - ]; - $statusClass = isset($view['status']) ? 'gdzt gd-' . intval($view['status']) : ''; - $statusText = (isset($view['status']) && isset($statusMap[$view['status']])) ? $statusMap[$view['status']] : '-'; - ?> - -
提交人{$view['creater']}联系方式{$view['contact']}
提交时间{$view['sub_time']}分派处理人 - -
项目问题 -
- -
-
备注 - {$view.remark} -
+ +

工单详情 - ID:{$view['id']}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
工单状态 + + "未解决", 1 => "解决中", 2 => "已解决", 3 => "已关闭" ]; $statusClass = + isset($view['status']) ? 'gdzt gd-' . intval($view['status']) : ''; + $statusText = (isset($view['status']) && + isset($statusMap[$view['status']])) ? $statusMap[$view['status']] : '-'; + ?> + + 隶属项目{$view['project_id']}
提交人{$view['creater']}提交人项目ID{$view['uid']}
联系电话{$view['contact']}电子邮箱{$view['email']}
提交时间{$view['sub_time']}分派处理人 + +
问题类型{$view['problemtype']}项目工单ID{$view['project_order_id']}
项目问题 +
+ +
+
备注{$view.remark}
\ No newline at end of file + .gd-3 { + color: #fff; + background-color: #a233c6; + } + .pt-1 { + margin-top: 15px; + } + .page-content img { + padding: 15px; + } + .layui-layer-shade { + background-color: rgba(0, 0, 0, 0.5) !important; + } +