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} -
- -
-

第{$index+1}步{if $instance.current_step == $index}(当前步骤){/if}

-

- {$step.title} -

- {if $step.status == 1} -
-
- 已通过 - {$step.approver.nickname}于{$step.approve_time|date='Y-m-d H:i:s'}审核通过 -
-
- {elseif $step.status == 2} -
-
- 已驳回 - {$step.approver.nickname}于{$step.approve_time|date='Y-m-d H:i:s'}审核驳回 -
-
- {else} -
- 待审核 -
- {/if} -
-
+ {include file="common/step" /} {/foreach} diff --git a/plugs/think-plugs-ticket/src/view/common/step.html b/plugs/think-plugs-ticket/src/view/common/step.html new file mode 100644 index 0000000..5498111 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/common/step.html @@ -0,0 +1,34 @@ +
+ +
+

第{$index+1}步 + {if $step.status == 1} + 已通过 + {elseif $step.status == 2} + 已驳回 + {else} + 待审核 + {/if} + {if isset($current_step)} + {if $instance.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.content} +
+ {elseif $step.status == 2} + {$step.approver.nickname}于{$step.approve_time|date='Y-m-d H:i:s'}审核驳回 +
+ 审核说明:{$step.content} +
+ {else} + {/if} +
+
+
diff --git a/plugs/think-plugs-ticket/src/view/ticket/approve.html b/plugs/think-plugs-ticket/src/view/ticket/approve.html index dce9c04..9c595ad 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/approve.html +++ b/plugs/think-plugs-ticket/src/view/ticket/approve.html @@ -10,15 +10,7 @@ {foreach $process.steps as $index=>$step} -
- -
-

第{$index+1}步{if $step_index == $index}(当前步骤){/if}

-

- {$step.title} -

-
-
+ {include file="common/step" /} {/foreach} diff --git a/plugs/think-plugs-ticket/src/view/ticket/index.html b/plugs/think-plugs-ticket/src/view/ticket/index.html index ac5c583..7d613ce 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/index.html +++ b/plugs/think-plugs-ticket/src/view/ticket/index.html @@ -67,14 +67,17 @@ } }}, {field: 'view', title:'核验情况', width: 100, minWidth:100, templet:function(item){ - if (item.view_pid) { + if (item.views && item.views.length > 0) { + // 已有核验工单 + return `查看工单`; + } else if (item.view_pid) { // 已有核验流程 if (item.view_process.status === 0) { return `正在审核` } else if (item.view_process.status === 1) { - return `创建核验工单`; + return `创建核验工单`; } else if (item.view_process.status === 2) { - return `已驳回`; + return `已驳回`; } else if (item.view_process.status === -1) { return `已取消` } @@ -93,14 +96,17 @@ return `请先完成核验` } } - if (item.repair_pid) { + if (item.repairs && item.repairs.length > 0) { + // 已有维修工单 + return `查看工单`; + } else if (item.repair_pid) { // 已有维修流程 if (item.repair_process.status === 0) { return `正在审核` } else if (item.repair_process.status === 1) { - return `已通过` + return `创建维修工单`; } else if (item.repair_process.status === 2) { - return `提请维修`; + return `已驳回`; } else if (item.repair_process.status === -1) { return `已取消` } @@ -128,9 +134,9 @@ if (item.verify_process.status === 0) { return `正在审核` } else if (item.verify_process.status === 1) { - return `已通过` + return `创建验收工单`; } else if (item.verify_process.status === 2) { - return `提请验收`; + return `已驳回`; } else if (item.verify_process.status === -1) { return `已取消` } diff --git a/plugs/think-plugs-ticket/src/view/ticket/repair_process_create.html b/plugs/think-plugs-ticket/src/view/ticket/repair_process_create.html index 743e4e0..d218a60 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/repair_process_create.html +++ b/plugs/think-plugs-ticket/src/view/ticket/repair_process_create.html @@ -10,15 +10,7 @@ {foreach $process.steps as $index=>$step} -
- -
-

第{$index+1}步{if $step_index == $index}(当前步骤){/if}

-

- {$step.title} -

-
-
+ {include file="common/step" /} {/foreach} diff --git a/plugs/think-plugs-ticket/src/view/ticket/verify_process_create.html b/plugs/think-plugs-ticket/src/view/ticket/verify_process_create.html index 743e4e0..d218a60 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/verify_process_create.html +++ b/plugs/think-plugs-ticket/src/view/ticket/verify_process_create.html @@ -10,15 +10,7 @@ {foreach $process.steps as $index=>$step} -
- -
-

第{$index+1}步{if $step_index == $index}(当前步骤){/if}

-

- {$step.title} -

-
-
+ {include file="common/step" /} {/foreach} diff --git a/plugs/think-plugs-ticket/src/view/ticket/view_process_create.html b/plugs/think-plugs-ticket/src/view/ticket/view_process_create.html index 743e4e0..e69de29 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/view_process_create.html +++ b/plugs/think-plugs-ticket/src/view/ticket/view_process_create.html @@ -1,59 +0,0 @@ -
-
-
审核流程
-
-
-
- -
-

提交审核

-
-
- {foreach $process.steps as $index=>$step} -
- -
-

第{$index+1}步{if $step_index == $index}(当前步骤){/if}

-

- {$step.title} -

-
-
- {/foreach} -
-
-
-
-
-
创建审核单
-
-
- -
- -
- -
-
- {if $current_step.approver_type == 3} -
- -
- -
-
- {/if} -
-
- - -
-
-
-
-
\ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/ticket/view_ticket_create.html b/plugs/think-plugs-ticket/src/view/ticket/view_ticket_create.html new file mode 100644 index 0000000..f560c83 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/ticket/view_ticket_create.html @@ -0,0 +1,19 @@ +
+ + +
+ +
+ +
+
+
+ + +
+
diff --git a/plugs/think-plugs-ticket/src/view/view/detail.html b/plugs/think-plugs-ticket/src/view/view/detail.html new file mode 100644 index 0000000..a3c62df --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/view/detail.html @@ -0,0 +1,188 @@ +
+ +
+
+
+
工单内容
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $vo.ticket.lat && $vo.ticket.lng} + + + + + {/if} + +
工单编号{$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} + image +   + {/foreach} + {else} + 无图片 + {/if} +
+
位置 +
+
+
+ {if $vo.ticket.lat && $vo.ticket.lng} + + + {/if} +
+
+
+
+
+
核验信息
+
+
+ + + + + + + {if $vo.status == 1} + + + + + + + + + + + + + + + + + {else} + + + + + {/if} + + + + + +
核验人{$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} + image +   + {/foreach} + {else} + 无图片 + {/if} +
+
预期工作量(天){$vo.workdays|default=""}
核验状态待核验
创建时间{$vo.create_at|default=""}
+
+
+
+
+ {if $vo.ticket.view_process} +
+
+
+
审核流程
+
+
+
+ +
+

提交审核

+
+
+ {foreach $vo.ticket.view_process.steps as $index=>$step} + {include file="common/step" /} + {/foreach} +
+
+
+
+
+ {/if} +
+
\ No newline at end of file