From 56df8a2cbc055fcc391bdbc9fdd5126aa2bfd200 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 20 Mar 2025 14:18:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AB=AF=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/api/auth/TicketView.php | 45 +++++++++++++++- .../src/view/common/step.html | 5 +- .../src/view/common/step_p.html | 15 ++++++ .../view/ticket/repair_process_create.html | 2 +- .../view/ticket/verify_process_create.html | 2 +- .../src/view/ticket/view_process_create.html | 51 +++++++++++++++++++ 6 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 plugs/think-plugs-ticket/src/view/common/step_p.html diff --git a/plugs/think-plugs-inspection/src/controller/api/auth/TicketView.php b/plugs/think-plugs-inspection/src/controller/api/auth/TicketView.php index 5a2fe77..ff7cba9 100644 --- a/plugs/think-plugs-inspection/src/controller/api/auth/TicketView.php +++ b/plugs/think-plugs-inspection/src/controller/api/auth/TicketView.php @@ -10,7 +10,12 @@ class TicketView extends Auth public function list() { - $query = Model::query()->scope(['notFinish'])->with(['ticket'])->where(['staff_id'=>$this->staff->id]); + $query = Model::query()->with(['ticket'])->where(['staff_id'=>$this->staff->id]); + $query->order('create_at', 'desc'); + $status = $this->request->get('status', null); + if ($status) { + $query->where('status', '=', $status); + } $keyword = $this->request->get('keyword', null); if ($keyword) { $query->where('title', 'like', "%{$keyword}%"); @@ -19,4 +24,42 @@ class TicketView extends Auth $this->success('获取工单列表', $pageData); } + public function detail() + { + $id = $this->request->get('id', null); + $data = Model::query()->with(['ticket'])->where('staff_id', '=', $this->staff->id)->where(['id'=>$id])->find(); + if (!$data) { + $this->error('工单不存在'); + } + $this->success('获取工单详情', $data); + } + + public function submit() + { + $data = $this->_vali([ + 'ticket_id.require' => '工单ID不能为空', + 'content.require' => '工单内容不能为空', + 'is_error.in:0,1' => '请选择是否有异常', + 'imgs.default' => '', + 'work_days.default' => '', + ]); + $ticket = Model::query()->with(['ticket'])->where('staff_id', '=', $this->staff->id)->where(['id'=>$data['ticket_id']])->find(); + if (!$ticket) { + $this->error('工单不存在'); + } + unset($data['ticket_id']); + if ($ticket->status === 1) { + $this->error('工单已提交'); + } + if ($ticket->status === 2) { + $this->error('工单已关闭'); + } + try { + $data['status'] = 1; + $ticket->save($data); + } catch (\Exception $exception) { + $this->error('工单提交失败'); + } + $this->success('工单提交成功'); + } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/common/step.html b/plugs/think-plugs-ticket/src/view/common/step.html index 5498111..136d23f 100644 --- a/plugs/think-plugs-ticket/src/view/common/step.html +++ b/plugs/think-plugs-ticket/src/view/common/step.html @@ -10,13 +10,10 @@ 待审核 {/if} {if isset($current_step)} - {if $instance.current_step == $index}(当前步骤){/if} + {if $current_step == $index}(当前步骤){/if} {/if}
- {$step.title} -
{if $step.status == 1} {$step.approver.nickname}于{$step.approve_time|date='Y-m-d H:i:s'}审核通过+ {$step.title} +
+