From 6acf1cf23793d0b71902cacf1a448da71167d091 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 20 Mar 2025 11:42:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=A0=B8=E9=AA=8C=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/Ticket.php | 29 +++ .../src/controller/View.php | 10 + .../src/model/TicketInspectionShare.php | 6 +- .../src/model/TicketRepair.php | 6 +- .../src/model/TicketRepairAccept.php | 6 +- .../src/model/TicketTicket.php | 6 +- .../src/model/TicketTicketInter.php | 6 +- .../src/model/TicketTicketOuter.php | 6 +- .../src/model/TicketUserShare.php | 6 +- .../src/model/TicketVerify.php | 6 +- .../src/model/TicketView.php | 6 +- .../src/view/approval_instance/detail.html | 29 +-- .../src/view/common/step.html | 34 ++++ .../src/view/ticket/approve.html | 10 +- .../src/view/ticket/index.html | 22 +- .../view/ticket/repair_process_create.html | 10 +- .../view/ticket/verify_process_create.html | 10 +- .../src/view/ticket/view_process_create.html | 59 ------ .../src/view/ticket/view_ticket_create.html | 19 ++ .../src/view/view/detail.html | 188 ++++++++++++++++++ 20 files changed, 343 insertions(+), 131 deletions(-) create mode 100644 plugs/think-plugs-ticket/src/view/common/step.html create mode 100644 plugs/think-plugs-ticket/src/view/ticket/view_ticket_create.html create mode 100644 plugs/think-plugs-ticket/src/view/view/detail.html diff --git a/plugs/think-plugs-ticket/src/controller/Ticket.php b/plugs/think-plugs-ticket/src/controller/Ticket.php index 51b9c16..cba99d2 100644 --- a/plugs/think-plugs-ticket/src/controller/Ticket.php +++ b/plugs/think-plugs-ticket/src/controller/Ticket.php @@ -10,6 +10,7 @@ use plugin\ticket\model\TicketDept; use plugin\ticket\model\TicketReply; use plugin\ticket\model\TicketTicket; use plugin\ticket\model\TicketType; +use plugin\ticket\model\TicketView; use think\admin\Controller; use think\admin\helper\QueryHelper; use think\admin\model\SystemUser; @@ -354,6 +355,34 @@ class Ticket extends Controller } } + public function view_ticket_create() + { + $data = $this->_vali([ + 'ticket_id.require'=>'请指定工单ID!', + ]); + $ticket = TicketTicket::query()->with(['view_process'])->append(['imgs_arr', 'type_name'])->where('id', '=', $data['ticket_id'])->findOrEmpty(); + $staffs = InspectionStaff::query()->field('id,name,phone')->select(); + if ($ticket->isEmpty()) { + $this->error('未找到工单信息'); + } + if ($this->request->isPost()) { + $adminInfo = $this->request->session('user'); + $instance_data = $this->_vali([ + 'staff_id.require'=>'请指定维修人员!', + ]); + $view = $ticket->views()->save([ + 'staff_id'=>$instance_data['staff_id'], + 'status'=>0, + 'create_by'=>$adminInfo['id'], + ]); + $this->success('创建成功!', $view); + } else { + $this->vo = $ticket; + $this->staffs = $staffs; + $this->fetch(); + } + } + public function repair_process_create() { $data = $this->_vali([ diff --git a/plugs/think-plugs-ticket/src/controller/View.php b/plugs/think-plugs-ticket/src/controller/View.php index 2cb45a1..7c3847e 100644 --- a/plugs/think-plugs-ticket/src/controller/View.php +++ b/plugs/think-plugs-ticket/src/controller/View.php @@ -32,6 +32,16 @@ class View extends Controller }); } + public function detail() + { + $id = $this->request->param('id'); + $this->vo = TicketView::mk()->with(['ticket'])->where(['id' => $id])->findOrEmpty(); + if ($this->vo->isEmpty()) { + $this->error('查看工单不存在!'); + } + $this->fetch(); + } + /** * 添加查看工单 * @auth true diff --git a/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php b/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php index 07f2ee0..a5fb5a7 100644 --- a/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php +++ b/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php @@ -9,7 +9,11 @@ class TicketInspectionShare extends Model protected $append = ['type_name', 'imgs_arr']; public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function type() diff --git a/plugs/think-plugs-ticket/src/model/TicketRepair.php b/plugs/think-plugs-ticket/src/model/TicketRepair.php index cb1a6f7..2ba2e57 100644 --- a/plugs/think-plugs-ticket/src/model/TicketRepair.php +++ b/plugs/think-plugs-ticket/src/model/TicketRepair.php @@ -20,7 +20,11 @@ class TicketRepair extends Model public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function scopeNotFinish($query) diff --git a/plugs/think-plugs-ticket/src/model/TicketRepairAccept.php b/plugs/think-plugs-ticket/src/model/TicketRepairAccept.php index cf7115a..287b80e 100644 --- a/plugs/think-plugs-ticket/src/model/TicketRepairAccept.php +++ b/plugs/think-plugs-ticket/src/model/TicketRepairAccept.php @@ -19,6 +19,10 @@ class TicketRepairAccept extends Model public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/model/TicketTicket.php b/plugs/think-plugs-ticket/src/model/TicketTicket.php index a44f94e..5272085 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicket.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicket.php @@ -32,7 +32,11 @@ class TicketTicket extends Model public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function getLastReplyAttr($value, $data) diff --git a/plugs/think-plugs-ticket/src/model/TicketTicketInter.php b/plugs/think-plugs-ticket/src/model/TicketTicketInter.php index 81f76d1..c189f0f 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicketInter.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicketInter.php @@ -23,7 +23,11 @@ class TicketTicketInter extends TicketTicket public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function getLastReplyAttr($value, $data) diff --git a/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php b/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php index d6d6e1b..56fd27d 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php @@ -23,7 +23,11 @@ class TicketTicketOuter extends TicketTicket public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function getLastReplyAttr($value, $data) diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShare.php b/plugs/think-plugs-ticket/src/model/TicketUserShare.php index 198e17b..b66d42d 100644 --- a/plugs/think-plugs-ticket/src/model/TicketUserShare.php +++ b/plugs/think-plugs-ticket/src/model/TicketUserShare.php @@ -9,7 +9,11 @@ class TicketUserShare extends Model protected $append = ['type_name', 'imgs_arr']; public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function type() diff --git a/plugs/think-plugs-ticket/src/model/TicketVerify.php b/plugs/think-plugs-ticket/src/model/TicketVerify.php index 1ac8ac4..f6994fc 100644 --- a/plugs/think-plugs-ticket/src/model/TicketVerify.php +++ b/plugs/think-plugs-ticket/src/model/TicketVerify.php @@ -20,7 +20,11 @@ class TicketVerify extends Model public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function scopeNotFinish($query) diff --git a/plugs/think-plugs-ticket/src/model/TicketView.php b/plugs/think-plugs-ticket/src/model/TicketView.php index 1a3ecd6..ba985c1 100644 --- a/plugs/think-plugs-ticket/src/model/TicketView.php +++ b/plugs/think-plugs-ticket/src/model/TicketView.php @@ -20,7 +20,11 @@ class TicketView extends Model public function getImgsArrAttr($value, $data) { - return str2arr($data['imgs'] ?: '', '|'); + if (!empty($data['imgs'])) { + return str2arr($data['imgs'] ?: '', '|'); + } else { + return []; + } } public function scopeNotFinish($query) diff --git a/plugs/think-plugs-ticket/src/view/approval_instance/detail.html b/plugs/think-plugs-ticket/src/view/approval_instance/detail.html index 69d6d6f..ec8897c 100644 --- a/plugs/think-plugs-ticket/src/view/approval_instance/detail.html +++ b/plugs/think-plugs-ticket/src/view/approval_instance/detail.html @@ -17,34 +17,7 @@ {foreach $instance.steps as $index=>$step} -
- {$step.title} -
- {if $step.status == 1} -+ {$step.title} +
+ {if $step.status == 1} + {$step.approver.nickname}于{$step.approve_time|date='Y-m-d H:i:s'}审核通过 +- {$step.title} -
-- {$step.title} -
-- {$step.title} -
-- {$step.title} -
-工单编号 | +{$vo.ticket.id|default=""} | +
工单标题 | +{$vo.ticket.title|default=""} | +
工单类型 | +{$vo.ticket.type_name|default=""} | +
工单地址 | +{$vo.ticket.ticket_region|default=""} {$vo.ticket.ticket_address|default=""} | +
工单内容 | +{$vo.ticket.content|default=""} | +
反馈人信息 | +{$vo.ticket.contact_name|default="未填写名称"} {$vo.ticket.contact_phone|default="未填写联系方式"} | +
工单图片 | +
+
+ {if count($vo.ticket.imgs_arr) > 0}
+ {foreach $vo.ticket.imgs_arr as $img}
+
+ |
+
位置 | ++ + | +
核验人 | +{$vo.staff.name|default=""} ({$vo.staff.phone|default=""}) | +
核验时间 | +{$vo.ticket.finish_at|default=""} | +
核验结果 | +{$vo.ticket.content|default=""} | +
核验图片 | +
+
+ {if count($vo.ticket.imgs_arr) > 0}
+ {foreach $vo.ticket.imgs_arr as $img}
+
+ |
+
预期工作量(天) | +{$vo.workdays|default=""} | +
核验状态 | +待核验 | +
创建时间 | +{$vo.create_at|default=""} | +