diff --git a/plugs/think-plugs-ticket/src/controller/CommonReply.php b/plugs/think-plugs-ticket/src/controller/CommonReply.php new file mode 100644 index 0000000..1720efc --- /dev/null +++ b/plugs/think-plugs-ticket/src/controller/CommonReply.php @@ -0,0 +1,97 @@ +title = '常用回复列表'; + TicketCommonReply::mQuery()->layTable(function () { + }, function (QueryHelper $query) { + $query->like(['title#keyword']) + ->dateBetween(['create_at']) + ->equal(['status']); + $query->append(['status_text']); + }); + } + + /** + * 添加常用回复 + * @auth true + * @menu true + * @return void + */ + public function add() + { + $this->title = '添加常用回复'; + TicketCommonReply::mForm('form'); + } + + /** + * 编辑常用回复 + * @auth true + * @menu true + * @return void + */ + public function edit() + { + $this->title = '编辑常用回复'; + TicketCommonReply::mForm('form'); + } + + /** + * 删除常用回复 + * @auth true + * @menu true + * @return void + */ + public function remove() + { + TicketCommonReply::mDelete(); + } + + /** + * 启用常用回复 + * @auth true + * @menu true + * @return void + */ + public function enable() + { + $this->_applyFormToken(); + ['id' => $id] = $this->_vali(['id.require' => '请指定常用回复ID!']); + TicketCommonReply::mk()->where(['id' => $id])->update(['status' => 1]); + $this->success('启用成功!'); + } + + /** + * 禁用常用回复 + * @auth true + * @menu true + * @return void + */ + public function disable() + { + $this->_applyFormToken(); + ['id' => $id] = $this->_vali(['id.require' => '请指定常用回复ID!']); + TicketCommonReply::mk()->where(['id' => $id])->update(['status' => 0]); + $this->success('禁用成功!'); + } +} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php index 7283a6a..7487368 100644 --- a/plugs/think-plugs-ticket/src/controller/UserShare.php +++ b/plugs/think-plugs-ticket/src/controller/UserShare.php @@ -3,6 +3,7 @@ namespace plugin\ticket\controller; use plugin\points_mall\service\UserPointService; +use plugin\ticket\model\TicketCommonReply; use plugin\ticket\model\TicketTicket; use plugin\ticket\model\TicketType; use plugin\ticket\model\TicketUserShare; @@ -59,6 +60,7 @@ class UserShare extends Controller } $this->type_list = TicketType::getList(); $this->user_list = SystemUser::query()->select(); + $this->common_reply_list = TicketCommonReply::query()->scope(['avail'])->select(); $this->fetch('detail'); } @@ -75,6 +77,7 @@ class UserShare extends Controller if ($userShare->isEmpty()) $this->error('用户随手拍不存在!'); if ($userShare->status !== 0) $this->error('用户随手拍已处理!'); $ticket_id = null; + $result = "已形成工单交由专人处理"; switch ($basic_data['_type']) { case 'new': $data = $this->_vali([ @@ -112,6 +115,9 @@ class UserShare extends Controller $ticket->source = $userShare; $ticket->save(); break; + case 'skip': + $result = "已处理完毕"; + break; default: $this->error('参数错误'); } @@ -121,6 +127,12 @@ class UserShare extends Controller UserPointService::addUserPoint($userShare->user_id, $basic_data['point_aware'], '用户随手拍奖励积分'); $userShare->status = 1; $userShare->save(); + $adminInfo = $this->request->session('user'); + $userShare->logs()->save([ + 'op_name' => $adminInfo["username"], + 'content' => $basic_data['content'], + 'result' => $result, + ]); $this->success('处理成功!'); } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/model/TicketCommonReply.php b/plugs/think-plugs-ticket/src/model/TicketCommonReply.php new file mode 100644 index 0000000..559a7ca --- /dev/null +++ b/plugs/think-plugs-ticket/src/model/TicketCommonReply.php @@ -0,0 +1,23 @@ +where('status', '=', 1); + } +} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShare.php b/plugs/think-plugs-ticket/src/model/TicketUserShare.php index a9c4284..198e17b 100644 --- a/plugs/think-plugs-ticket/src/model/TicketUserShare.php +++ b/plugs/think-plugs-ticket/src/model/TicketUserShare.php @@ -31,4 +31,9 @@ class TicketUserShare extends Model { return $this->belongsTo(TicketTicket::class, 'linked_ticket_id', 'id'); } + + public function logs() + { + return $this->hasMany(TicketUserShareLog::class, 'us_id', 'id'); + } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php b/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php new file mode 100644 index 0000000..4e232f7 --- /dev/null +++ b/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php @@ -0,0 +1,21 @@ +belongsTo(TicketUserShare::class, 'us_id', 'id'); + } +} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/common_reply/form.html b/plugs/think-plugs-ticket/src/view/common_reply/form.html new file mode 100644 index 0000000..5e309a7 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/common_reply/form.html @@ -0,0 +1,20 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/common_reply/index.html b/plugs/think-plugs-ticket/src/view/common_reply/index.html new file mode 100644 index 0000000..558038b --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/common_reply/index.html @@ -0,0 +1,60 @@ +{extend name="table"} + +{block name="button"} + +新增 + +{/block} + +{block name="content"} +
+
+
+ {include file='common_reply/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/common_reply/index_search.html b/plugs/think-plugs-ticket/src/view/common_reply/index_search.html new file mode 100644 index 0000000..ee3bcfc --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/common_reply/index_search.html @@ -0,0 +1,16 @@ +
+ 条件搜索 + + +
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 c0133e9..a244333 100644 --- a/plugs/think-plugs-ticket/src/view/user_share/detail.html +++ b/plugs/think-plugs-ticket/src/view/user_share/detail.html @@ -1,7 +1,7 @@
@@ -105,35 +105,60 @@ {/if}
- {if $vo.linked_ticket_id} -
-
关联工单
-
- - - - - - - - - - - -
工单编号{$vo.linked_ticket.id|default=""}
工单类型{$vo.linked_ticket.type_name|default=""}
+ {if $vo.status eq 1} + {if $vo.linked_ticket_id} +
+
关联工单
+
+ + + + + + + + + + + + + + + + + + + +
工单编号{$vo.linked_ticket.id|default=""}
工单类型{$vo.linked_ticket.type_name|default=""}
工单标题{$vo.linked_ticket.title|default=""}
工单内容{$vo.linked_ticket.content|default=""}
+
-
+ {else} +
+
直接回复
+
+ + + + + + + +
回复内容{$vo.content|default=""}
+
+
+ {/if} {else}
-
关联工单
+
处置随手拍
- +
@@ -173,14 +198,20 @@
- +
+
给用户反馈的内容,会发送给用户,请谨慎填写
- +
@@ -214,6 +245,9 @@ break; } }); + form.on('select(CommonReply)', function (data) { + $("textarea[name='content']").val(data.value) + }); form.on('submit(submit)', function (data) { const field = data.field const _type = field._type