diff --git a/app/workorder/controller/Index.php b/app/workorder/controller/Index.php index bae2cb4..426982b 100644 --- a/app/workorder/controller/Index.php +++ b/app/workorder/controller/Index.php @@ -25,7 +25,7 @@ class Index extends BaseController $list = WorkOrderList::withoutField('') ->where('delete_time', null) - ->order('status asc') + ->order(['status' => 'asc', 'id' => 'desc']) ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { $wo = WorkOrderList::where(['id' => $item->id])->find(); @@ -141,14 +141,26 @@ class Index extends BaseController { $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; - $detail = (new WorkOrderList())->detail($id); - // print_r($id); - if (empty($detail)) { - return to_assign(1, '2.信息不存在'); - } else { - View::assign('detail', $detail); - // print_r($detail); + if (empty($id)) { + return to_assign(1, '参数错误,缺少ID'); + } + $view = WorkOrderList::where('id', $id)->find(); + if ($view) { + $projectName = Db::name('Project')->where('id', $view['project_id'])->value('name_short'); + $view['project_id'] = $projectName ?: '-'; + if (!empty($view['contact'])) { + $view->contact = $view['contact']; + } else { + $view->contact = Db::name('Admin')->where('id', $view['creater'])->value('mobile') ?: '-'; + } + $adminName = Db::name('Admin')->where('id', $view['creater'])->value('name'); + $view->creater = $adminName ?: '-'; + $solveName = Db::name('Admin')->where('id', $view['solve'])->value('name'); + $view->solve = $solveName ?: '-'; + View::assign('view', $view); return view(); + } else { + return to_assign(1, '信息不存在'); } } diff --git a/app/workorder/view/index/add.html b/app/workorder/view/index/add.html index 23c7a82..3fcacfe 100644 --- a/app/workorder/view/index/add.html +++ b/app/workorder/view/index/add.html @@ -1,100 +1,129 @@
- - \ No newline at end of file + + + + +