From a6c7d1de15f6f8ca5fbdfdce7b569666b3537370 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 3 Dec 2024 10:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/Ticket.php | 32 ++++++++ .../src/controller/TicketInter.php | 17 +++- .../src/controller/TicketOuter.php | 15 ++++ .../src/controller/UserShare.php | 3 +- .../src/model/TicketDept.php | 5 +- .../src/model/TicketTicket.php | 4 +- .../src/model/TicketTicketInter.php | 1 - .../src/model/TicketTicketOuter.php | 1 - .../src/view/ticket/index.html | 6 +- .../src/view/ticket_inter/index.html | 3 + .../src/view/ticket_inter/my.html | 78 +++++++++++++++++++ .../src/view/ticket_outer/index.html | 8 +- .../src/view/ticket_outer/my.html | 78 +++++++++++++++++++ .../src/view/user_share/detail.html | 5 +- 14 files changed, 236 insertions(+), 20 deletions(-) create mode 100644 plugs/think-plugs-ticket/src/view/ticket_inter/my.html create mode 100644 plugs/think-plugs-ticket/src/view/ticket_outer/my.html diff --git a/plugs/think-plugs-ticket/src/controller/Ticket.php b/plugs/think-plugs-ticket/src/controller/Ticket.php index a4c6830..06a6f07 100644 --- a/plugs/think-plugs-ticket/src/controller/Ticket.php +++ b/plugs/think-plugs-ticket/src/controller/Ticket.php @@ -2,11 +2,13 @@ namespace plugin\ticket\controller; +use plugin\ticket\model\TicketDept; use plugin\ticket\model\TicketReply; use plugin\ticket\model\TicketTicket; use plugin\ticket\model\TicketType; use think\admin\Controller; use think\admin\helper\QueryHelper; +use think\admin\model\SystemUser; /** * 工单管理 @@ -127,4 +129,34 @@ class Ticket extends Controller $data['contact'] = $adminInfo['contact_phone']; } } + + public function move() + { + $this->title = "工单分配"; + if ($this->request->isPost()) { + // 提交 + $data = $this->_vali([ + 'id.require' => '请指定工单ID!', + 'type.require' => '请指定分配类型!', + 'dept_id.require' => '请指定处理部门!', + 'user_id.require' => '请指定负责人员!', + ]); + $ticket = TicketTicket::mk()->where('id', '=', $data['id'])->findOrEmpty(); + if ($ticket->isEmpty()) $this->error('工单不存在!'); + $ticket->fz_user_id = $data['user_id']; + $ticket->fz_dept_id = $data['dept_id']; + if ($data['type'] == 1) { + // 内部 + $ticket->state = 1; + } else { + // 外部 + $ticket->state = 2; + } + $ticket->save(); + } else { + $this->dept_list = TicketDept::query()->scope('avail')->select(); + $this->user_list = SystemUser::query()->select(); + $this->fetch(); + } + } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/controller/TicketInter.php b/plugs/think-plugs-ticket/src/controller/TicketInter.php index 1039625..5c09d22 100644 --- a/plugs/think-plugs-ticket/src/controller/TicketInter.php +++ b/plugs/think-plugs-ticket/src/controller/TicketInter.php @@ -32,7 +32,22 @@ class TicketInter extends Controller $query->like(['title|content|contact_name|ticket_address|contact_phone#keyword']) ->dateBetween(['create_at']) ->equal(['status', 'type_id']); - $query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name', 'last_reply']); + $query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']); + }); + } + + public function my() + { + $this->title = '我的工单'; + $this->user_id = $this->request->session('user')['id']; + TicketTicketInter::mQuery()->layTable(function () { + + }, function (QueryHelper $query) { + $query->like(['title|content|contact_name|ticket_address|contact_phone#keyword']) + ->dateBetween(['create_at']) + ->equal(['status', 'type_id']); + $query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']); + $query->where(['current_admin_id' => $this->user_id]); }); } diff --git a/plugs/think-plugs-ticket/src/controller/TicketOuter.php b/plugs/think-plugs-ticket/src/controller/TicketOuter.php index 17ff077..2bd1bf6 100644 --- a/plugs/think-plugs-ticket/src/controller/TicketOuter.php +++ b/plugs/think-plugs-ticket/src/controller/TicketOuter.php @@ -37,6 +37,21 @@ class TicketOuter extends Controller }); } + public function my() + { + $this->title = '我的工单'; + $this->user_id = $this->request->session('user')['id']; + TicketTicketOuter::mQuery()->layTable(function () { + + }, function (QueryHelper $query) { + $query->like(['title|content|contact_name|ticket_address|contact_phone#keyword']) + ->dateBetween(['create_at']) + ->equal(['status', 'type_id']); + $query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']); + $query->where(['current_admin_id' => $this->user_id]); + }); + } + /** * 查看工单 * @auth true diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php index 1ac4326..7283a6a 100644 --- a/plugs/think-plugs-ticket/src/controller/UserShare.php +++ b/plugs/think-plugs-ticket/src/controller/UserShare.php @@ -8,6 +8,7 @@ use plugin\ticket\model\TicketType; use plugin\ticket\model\TicketUserShare; use think\admin\Controller; use think\admin\helper\QueryHelper; +use think\admin\model\SystemUser; /** * 用户随手拍 @@ -57,7 +58,7 @@ class UserShare extends Controller $this->ticket_list = []; } $this->type_list = TicketType::getList(); - $this->user_list = []; + $this->user_list = SystemUser::query()->select(); $this->fetch('detail'); } diff --git a/plugs/think-plugs-ticket/src/model/TicketDept.php b/plugs/think-plugs-ticket/src/model/TicketDept.php index ff8f72f..0d46999 100644 --- a/plugs/think-plugs-ticket/src/model/TicketDept.php +++ b/plugs/think-plugs-ticket/src/model/TicketDept.php @@ -6,5 +6,8 @@ use think\admin\Model; class TicketDept extends Model { - + public function scopeAvail($query) + { + $query->where('status', '=', 1); + } } \ 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 975b5fd..2cde2ea 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicket.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicket.php @@ -6,7 +6,9 @@ use think\admin\Model; class TicketTicket extends Model { - protected $append = ['status_text', 'type_name']; + protected $append = ['status_text', 'type_name', 'dept_name']; + protected $globalScope = ['unConf']; + protected $table = 'ticket_ticket'; public function type() { return $this->belongsTo(TicketType::class, 'type_id'); diff --git a/plugs/think-plugs-ticket/src/model/TicketTicketInter.php b/plugs/think-plugs-ticket/src/model/TicketTicketInter.php index a736f87..81f76d1 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicketInter.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicketInter.php @@ -4,7 +4,6 @@ namespace plugin\ticket\model; class TicketTicketInter extends TicketTicket { - protected $append = ['status_text', 'type_name', 'dept_name']; protected $globalScope = ['inter']; protected $table = 'ticket_ticket'; public function type() diff --git a/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php b/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php index 810e4a2..d6d6e1b 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicketOuter.php @@ -4,7 +4,6 @@ namespace plugin\ticket\model; class TicketTicketOuter extends TicketTicket { - protected $append = ['status_text', 'type_name', 'dept_name']; protected $globalScope = ['outer']; protected $table = 'ticket_ticket'; public function type() diff --git a/plugs/think-plugs-ticket/src/view/ticket/index.html b/plugs/think-plugs-ticket/src/view/ticket/index.html index 2e72eda..1cfc5bd 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/index.html +++ b/plugs/think-plugs-ticket/src/view/ticket/index.html @@ -1,6 +1,7 @@ {extend name="table"} {block name="button"} + @@ -22,14 +23,11 @@ 详情 - 分配 + 分配 修改 - - 删除 - {/block} diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/index.html b/plugs/think-plugs-ticket/src/view/ticket_inter/index.html index 792a954..e933420 100644 --- a/plugs/think-plugs-ticket/src/view/ticket_inter/index.html +++ b/plugs/think-plugs-ticket/src/view/ticket_inter/index.html @@ -18,6 +18,9 @@ 详情 + + 删除 + {/block} diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/my.html b/plugs/think-plugs-ticket/src/view/ticket_inter/my.html new file mode 100644 index 0000000..f923556 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/ticket_inter/my.html @@ -0,0 +1,78 @@ +{extend name="table"} + +{block name="button"} + +{/block} + +{block name="content"} +
+
+
+
+ {include file='ticket_inter/index_search'} +
+
+
+
+
+ +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/ticket_outer/index.html b/plugs/think-plugs-ticket/src/view/ticket_outer/index.html index 7231ad1..e428c88 100644 --- a/plugs/think-plugs-ticket/src/view/ticket_outer/index.html +++ b/plugs/think-plugs-ticket/src/view/ticket_outer/index.html @@ -18,14 +18,8 @@ 详情 - - 分配 - - - 修改 - - 删除 + 删除 {/block} diff --git a/plugs/think-plugs-ticket/src/view/ticket_outer/my.html b/plugs/think-plugs-ticket/src/view/ticket_outer/my.html new file mode 100644 index 0000000..62e37d3 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/ticket_outer/my.html @@ -0,0 +1,78 @@ +{extend name="table"} + +{block name="button"} + +{/block} + +{block name="content"} +
+
+
+
+ {include file='ticket_outer/index_search'} +
+
+
+
+
+ +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/user_share/detail.html b/plugs/think-plugs-ticket/src/view/user_share/detail.html index bf869a9..c0133e9 100644 --- a/plugs/think-plugs-ticket/src/view/user_share/detail.html +++ b/plugs/think-plugs-ticket/src/view/user_share/detail.html @@ -144,9 +144,8 @@
@@ -157,7 +156,7 @@