diff --git a/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php b/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php
index 104db36..0dd16a7 100644
--- a/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php
+++ b/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php
@@ -29,6 +29,9 @@ class Ticket extends Auth
$ticket_address = $this->request->post('ticket_address');
$imgs = $this->request->post('imgs');
$work_days = $this->request->post('work_days');
+ $gc_content = $this->request->post('gc_content');
+ $zf_content = $this->request->post('zf_content');
+ $ys_content = $this->request->post('ys_content');
$data = [
'user_id' => $this->staff->id,
'type_id' => $type_id,
@@ -42,6 +45,9 @@ class Ticket extends Auth
'contact_name' => $this->staff->name,
'contact_phone' => $this->staff->phone,
'status' => 0,
+ 'gc_content' => $gc_content,
+ 'zf_content' => $zf_content,
+ 'ys_content' => $ys_content,
'work_days' => $work_days
];
if (!empty($record)) {
@@ -49,6 +55,29 @@ class Ticket extends Auth
} else {
$ticket = TicketInspectionShare::create($data);
}
+ $tTicket = $ticket->linkedTicket()->save([
+ 'source_type' => 2,
+ 'type_id' => $data['type_id'],
+ 'user_type' => 'staff',
+ 'user_id' => $ticket->user_id,
+ 'title' => $ticket->title,
+ 'content' => $ticket->content,
+ 'ticket_region' => $ticket->ticket_region,
+ 'ticket_address' => $ticket->ticket_address,
+ 'contact_name' => $ticket->contact_name,
+ 'contact_phone' => $ticket->contact_phone,
+ 'lat' => $ticket->ticket_lat,
+ 'lng' => $ticket->ticket_lng,
+ 'imgs' => $ticket->imgs,
+ 'status' => 0, // 先审核
+ 'gc_content' => $gc_content,
+ 'zf_content' => $zf_content,
+ 'ys_content' => $ys_content,
+ 'work_days' => $work_days
+ ]);
+ $ticket->linked_ticket_id = $tTicket->id;
+ $ticket->status = 1;
+ $ticket->save();
$this->success("工单创建成功", $ticket);
}
diff --git a/plugs/think-plugs-ticket/src/controller/Ticket.php b/plugs/think-plugs-ticket/src/controller/Ticket.php
index 3c9af23..fff0a22 100644
--- a/plugs/think-plugs-ticket/src/controller/Ticket.php
+++ b/plugs/think-plugs-ticket/src/controller/Ticket.php
@@ -81,16 +81,8 @@ class Ticket extends Controller
{
$this->title = '工单详情';
['id' => $id] = $this->_vali(['id.require' => '请指定工单ID!']);
- $this->vo = TicketTicket::mk()->with(['user', 'type'])->append(['imgs_arr', 'type_name'])->find($id);
+ $this->vo = TicketTicket::mk()->with(['user_shares', 'views', 'repairs', 'verifys', 'view_process', 'repair_process', 'verify_process'])->append(['imgs_arr', 'type_name'])->find($id);
$this->ticket = $this->vo;
- $process = ApprovalProcess::where('type', '=', 'GDSH')->order('id', 'asc')->findOrEmpty();
- $instance = ApprovalInstance::query()->with(['steps.approver', 'logs'])->where('process_id', '=', $process->id)->where('oid', '=', $id)->findOrEmpty();
- $this->instance = $instance;
- if ($instance->isEmpty()) {
- $this->step_index = -1;
- } else {
- $this->step_index = $instance->current_step;
- }
$this->fetch();
}
@@ -160,6 +152,9 @@ class Ticket extends Controller
public function move()
{
$this->title = "工单分配";
+ $id = $this->request->param('id');
+ $ticket = TicketTicket::mk()->where('id', '=', $id)->findOrEmpty();
+ if ($ticket->isEmpty()) $this->error('工单不存在!');
if ($this->request->isPost()) {
// 提交
$data = $this->_vali([
@@ -168,8 +163,6 @@ class Ticket extends Controller
'dept_id.require' => '请指定处理部门!',
'user_id.default' => '0',
]);
- $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) {
@@ -467,15 +460,6 @@ class Ticket extends Controller
if ($ticket->isEmpty()) {
$this->error('未找到工单信息');
}
- if (sizeof($ticket->views) === 0) {
- if (sizeof($ticket->inspection_shares) === 0) {
- $this->error('请先提请核验工单!');
- } else {
- $view = $ticket->inspection_shares[0];
- }
- } else {
- $view = $ticket->views[0];
- }
if ($this->request->isPost()) {
$adminInfo = $this->request->session('user');
$instance_data = $this->_vali([
@@ -484,9 +468,10 @@ class Ticket extends Controller
]);
$ticket->kj_user_id = $instance_data['kj_user_id'];
$repair = $ticket->repairs()->save([
- 'gc_content'=>$view->gc_content,
- 'zf_content'=>$view->zf_content,
- 'ys_content'=>$view->ys_content,
+ 'gc_content'=>$ticket->gc_content,
+ 'zf_content'=>$ticket->zf_content,
+ 'ys_content'=>$ticket->ys_content,
+ 'work_days'=>$ticket->work_days,
'staff_id'=>$instance_data['staff_id'],
'status'=>0,
'create_id'=>$adminInfo['id'],
diff --git a/plugs/think-plugs-ticket/src/controller/TicketInter.php b/plugs/think-plugs-ticket/src/controller/TicketInter.php
index 49900e7..7ccca82 100644
--- a/plugs/think-plugs-ticket/src/controller/TicketInter.php
+++ b/plugs/think-plugs-ticket/src/controller/TicketInter.php
@@ -63,46 +63,11 @@ class TicketInter extends Controller
{
$this->title = '工单详情';
['id' => $id] = $this->_vali(['id.require' => '请指定工单ID!']);
- $this->vo = TicketTicketInter::mk()->with(['user', 'type'])->append(['imgs_arr', 'type_name'])->find($id);
+ $this->vo = TicketTicketInter::mk()->with(['user_shares', 'views', 'repairs', 'verifys', 'view_process', 'repair_process', 'verify_process'])->append(['imgs_arr', 'type_name'])->find($id);
$this->ticket = $this->vo;
- $process = ApprovalProcess::where('type', '=', 'GDSH')->order('id', 'asc')->findOrEmpty();
- $instance = ApprovalInstance::query()->with(['steps.approver', 'logs'])->where('process_id', '=', $process->id)->where('oid', '=', $id)->findOrEmpty();
- $this->instance = $instance;
- if ($instance->isEmpty()) {
- $this->step_index = -1;
- } else {
- $this->step_index = $instance->current_step;
- }
$this->fetch();
}
- public function reply()
- {
- $this->title = '回复工单';
- [
- 'ticket_id'=>$ticket_id,
- 'id'=>$id
- ] = $this->_vali([
- 'ticket_id.require'=>'请指定工单ID!',
- 'id.require'=>'请指定回复ID!'
- ]);
- $this->vo = TicketTicket::mk()->with(['user', 'type'])->append(['imgs_arr', 'type_name'])->find($ticket_id);
- TicketReply::mForm('reply');
- }
-
- public function _reply_form_filter(&$data)
- {
- if ($this->request->isPost()) {
- $this->_applyFormToken();
- $data['type'] = 1;
- $adminInfo = $this->request->session('user');
- $data['user_id'] = $adminInfo['id'];
- $data['username'] = $adminInfo['nickname'];
- $data['contact'] = $adminInfo['contact_phone'];
- }
- }
-
-
/**
* 审核页面
* @auth true
@@ -201,105 +166,6 @@ class TicketInter extends Controller
$this->success('创建成功!');
}
- public function view_process_create()
- {
- $data = $this->_vali([
- 'ticket_id.require'=>'请指定工单ID!',
- ]);
- $process = ApprovalProcess::where('type', '=', 'HSSH')->order('id', 'asc')->findOrEmpty();
- if ($process->isEmpty()) {
- $this->error('未找到可用的审核流程');
- }
- $adminInfo = $this->request->session('user');
- $ticket = TicketTicket::query()->with(['user', 'type'])->append(['imgs_arr', 'type_name'])->where('id', '=', $data['ticket_id'])->findOrEmpty();
- if ($ticket->isEmpty()) {
- $this->error('未找到工单信息');
- }
- if ($this->request->isPost()) {
- $instance_data = $this->_vali([
- 'title.default'=>'核验工单审核',
- 'content.default'=>'',
- ]);
- ApprovalInstance::mk()->startTrans();
- try {
- $instance = ApprovalInstance::create([
- 'process_id' => $process->id,
- 'oid' => $ticket->id,
- 'title' => $instance_data['title'],
- 'content' => $instance_data['content'],
- 'status' => 0,
- 'current_step' => 0,
- 'create_time' => date('Y-m-d H:i:s'),
- 'create_by' => $adminInfo['id'],
- 'create_name' => $adminInfo['username'],
- ]);
- foreach ($process->steps as $index => $step) {
- $approver_id = $step['approver_id'] ?? 0;
- if ($index == 0) {
- if ($step['approver_type'] == 3) {
- $approve_data = $this->_vali([
- 'approver_id.require' => '请指定审核人!',
- ]);
- $approver_id = $approve_data['approver_id'];
- }
- }
- ApprovalStep::create([
- 'instance_id' => $instance->id,
- 'step_number' => $index,
- 'approver_type' => $step['approver_type'],
- 'approver_id' => $approver_id,
- 'status' => 0,
- ]);
- }
- $ticket->view_pid = $instance->id;
- $ticket->save();
- ApprovalInstance::mk()->commit();
- } catch (HttpResponseException $e) {
- ApprovalInstance::mk()->rollback();
- throw $e;
- } catch (\Exception $e) {
- ApprovalInstance::mk()->rollback();
- $this->error("创建失败");
- }
- $this->success('创建成功!');
- } else {
- $this->vo = $ticket;
- $this->process = $process;
- $this->step_index = -1;
- $this->current_step = $process->steps[0];
- $this->users = SystemUser::query()->field('id,username,nickname')->select();
- $this->fetch();
- }
- }
-
- 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([
@@ -389,7 +255,7 @@ class TicketInter extends Controller
$view = $ticket->repairs()->save([
'staff_id'=>$instance_data['staff_id'],
'status'=>0,
- 'create_by'=>$adminInfo['id'],
+ 'create_id'=>$adminInfo['id'],
]);
$this->success('创建成功!', $view);
} else {
@@ -428,7 +294,7 @@ class TicketInter extends Controller
'status' => 0,
'current_step' => 0,
'create_time' => date('Y-m-d H:i:s'),
- 'create_by' => $adminInfo['id'],
+ 'create_id' => $adminInfo['id'],
'create_name' => $adminInfo['username'],
]);
foreach ($process->steps as $index => $step) {
@@ -488,7 +354,7 @@ class TicketInter extends Controller
$view = $ticket->verifys()->save([
'staff_id'=>$instance_data['staff_id'],
'status'=>0,
- 'create_by'=>$adminInfo['id'],
+ 'create_id'=>$adminInfo['id'],
]);
$this->success('创建成功!', $view);
} else {
diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php
index 4c831d8..a2230db 100644
--- a/plugs/think-plugs-ticket/src/controller/UserShare.php
+++ b/plugs/think-plugs-ticket/src/controller/UserShare.php
@@ -133,4 +133,31 @@ class UserShare extends Controller
]);
$this->success('处理成功!');
}
+
+
+ /**
+ * 随手拍评论
+ * @auth true
+ * @menu true
+ * @return void
+ */
+ public function comment()
+ {
+ $this->title = '随手拍详情';
+ $where = $this->_vali([
+ 'id.require' => '随手拍ID不能为空',
+ ]);
+ $this->vo = TicketUserShare::mk()->where($where)->with(['linked_ticket'])->findOrEmpty();
+ if ($this->vo->isEmpty()) $this->error('用户随手拍不存在!');
+ if (!$this->vo->linked_ticket_id) {
+ $this->ticket_list = TicketTicket::mk()->scope(['avail'])->select();
+ } else {
+ $this->ticket_list = [];
+ }
+ $this->type_list = TicketType::getList();
+ $this->user_list = SystemUser::query()->select();
+ $this->common_reply_list = TicketCommonReply::query()->scope(['avail'])->select();
+ $this->fetch();
+ }
+
}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/common/ticket_flow.html b/plugs/think-plugs-ticket/src/view/common/ticket_flow.html
index 3c417f6..052682c 100644
--- a/plugs/think-plugs-ticket/src/view/common/ticket_flow.html
+++ b/plugs/think-plugs-ticket/src/view/common/ticket_flow.html
@@ -9,13 +9,13 @@
{if $ticket.views && sizeof($ticket.views) > 0}
核验信息
{/if}
- {if $ticket.repair_process && sizeof($ticket.repair_process) > 0}
+ {if $ticket.repair_process}
维修审核信息
{/if}
{if $ticket.repairs && sizeof($ticket.repairs) > 0}
维修信息
{/if}
- {if $ticket.verify_process && sizeof($ticket.verify_process) > 0}
+ {if $ticket.verify_process}
验收审核信息
{/if}
{if $ticket.verifys && sizeof($ticket.verifys) > 0}
@@ -164,7 +164,7 @@
{/if}
- {if $ticket.repair_process && sizeof($ticket.repair_process) > 0}
+ {if $ticket.repair_process}
{/if}
- {if $ticket.verify_process && sizeof($ticket.verify_process) > 0}
+ {if $ticket.verify_process}
diff --git a/plugs/think-plugs-ticket/src/view/ticket/detail.html b/plugs/think-plugs-ticket/src/view/ticket/detail.html
index 7f267b8..1501a2d 100644
--- a/plugs/think-plugs-ticket/src/view/ticket/detail.html
+++ b/plugs/think-plugs-ticket/src/view/ticket/detail.html
@@ -2,7 +2,6 @@
@@ -108,34 +107,5 @@
{include file="common/ticket_flow" /}
-
-
-
-
-
-
-
- 随手拍编号 |
- 问题类型 |
- 反馈人 |
- 联系方式 |
- 反馈时间 |
-
-
-
- {foreach $vo.userShares as $user_share}
-
- {$user_share.id} |
- {$user_share.type_name|default=""} |
- {$user_share.contact_name|default=""} |
- {$user_share.contact_phone|default=""} |
- {$user_share.create_at|default=""} |
-
-
- {/foreach}
-
-
-
-
diff --git a/plugs/think-plugs-ticket/src/view/ticket/form.html b/plugs/think-plugs-ticket/src/view/ticket/form.html
index 3545013..523a01e 100644
--- a/plugs/think-plugs-ticket/src/view/ticket/form.html
+++ b/plugs/think-plugs-ticket/src/view/ticket/form.html
@@ -36,6 +36,30 @@
+
+
+
+
{notempty name='id'}
{/notempty}
diff --git a/plugs/think-plugs-ticket/src/view/ticket/index.html b/plugs/think-plugs-ticket/src/view/ticket/index.html
index 47f6e1f..f2bc948 100644
--- a/plugs/think-plugs-ticket/src/view/ticket/index.html
+++ b/plugs/think-plugs-ticket/src/view/ticket/index.html
@@ -25,17 +25,29 @@
详情
- {{# if (d.status == 0 && d.views && d.views.length > 0) { }}
- {{# let view = d.views[d.views.length - 1]; }}
- {{# if (view.status == 1) { }}
+ {{# if (d.status !== 1) { }}
+ {{# if (d.source_type != 1) { }}
-
分配
+
分配
+
+ {{# } else if (d.views && d.views.length > 0) { }}
+
查看核验工单
+ {{# if (view.status == 1) { }}
+
+
分配
+
+ {{# } }}
+ {{# } else { }}
+
+
创建核验工单
{{# } }}
{{# } }}
+ {{# if (d.status !== 1) { }}
修改
+ {{# } }}
{/block}
@@ -73,31 +85,25 @@
return '';
}
}},
- {field: 'view', title:'核验情况', width: 100, minWidth:100, templet:function(item){
- if (item.views && item.views.length > 0) {
- // 已有核验工单
- const view = item.views[item.views.length - 1];
- if (view.status == 1) {
- if (view.is_error == 1) {
- return `
存在异常`;
- } else {
- return `
不存在异常`;
- }
- } else {
- return `
查看工单`;
- }
- } else {
- return `
创建核验工单`;
- }
- }},
{field:'status', title:'状态', width:80, templet:function(item){
+ if (item.source_type !== 1) {
+ if (item.status === 1) {
+ return `
已分配`
+ } else {
+ return `
待分配`
+ }
+ }
if (item.status !== 1) {
if (!item.views || item.views.length === 0) {
return `
待核验`
}
const view = item.views[item.views.length - 1];
if (view.status == 1) {
- return `
待分配`
+ if (view.is_error == 1) {
+ return `
已核验`
+ } else {
+ return `
无异常`
+ }
} else {
return `
待核验完成`
}
diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/detail.html b/plugs/think-plugs-ticket/src/view/ticket_inter/detail.html
index 5cfb3fa..1501a2d 100644
--- a/plugs/think-plugs-ticket/src/view/ticket_inter/detail.html
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/detail.html
@@ -1 +1,111 @@
-{include file="common/ticket_flow" /}
+
+
+
+
+
+
+
+
+
+
+
+ 工单编号 |
+ {$vo.id|default=""} |
+
+
+ 工单标题 |
+ {$vo.title|default=""} |
+
+
+ 工单类型 |
+ {$vo.type_name|default=""} |
+
+
+ 工单地址 |
+ {$vo.ticket_region|default=""} {$vo.ticket_address|default=""} |
+
+
+ 工单内容 |
+ {$vo.content|default=""} |
+
+
+ 反馈人信息 |
+ {$vo.contact_name|default="未填写名称"} {$vo.contact_phone|default="未填写联系方式"} |
+
+
+ 工单图片 |
+
+
+ {if count($vo.imgs_arr) > 0}
+ {foreach $vo.imgs_arr as $img}
+ 
+
+ {/foreach}
+ {else}
+ 无图片
+ {/if}
+
+ |
+
+ {if $vo.lat && $vo.lng}
+
+ 位置 |
+
+
+ |
+
+ {/if}
+
+
+
+ {if $vo.lat && $vo.lng}
+
+
+ {/if}
+
+
+
+
+ {include file="common/ticket_flow" /}
+
+
+
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 e8ac4ad..edca96e 100644
--- a/plugs/think-plugs-ticket/src/view/ticket_inter/index.html
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/index.html
@@ -66,18 +66,14 @@
}
}},
{field: 'view', title:'核验情况', width: 100, minWidth:100, templet:function(item){
- if (item.state === 2) {
- return `外部工单`
+ if (item.source_type !== 1) {
+ return `-`
}
if (item.views && item.views.length > 0) {
// 已有核验工单
const view = item.views[item.views.length - 1];
if (view.status == 1) {
- if (view.is_error == 1) {
- return `
存在异常`;
- } else {
- return `
不存在异常`;
- }
+ return `
查看工单`;
} else {
return `
查看工单`;
}
diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/repair_process_create.html b/plugs/think-plugs-ticket/src/view/ticket_inter/repair_process_create.html
new file mode 100644
index 0000000..693c936
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/repair_process_create.html
@@ -0,0 +1,51 @@
+
+
+
审核流程
+
+
+
+ {foreach $process.steps as $index=>$step}
+ {include file="common/step_p" /}
+ {/foreach}
+
+
+
+
+
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/repair_ticket_create.html b/plugs/think-plugs-ticket/src/view/ticket_inter/repair_ticket_create.html
new file mode 100644
index 0000000..88312b9
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/repair_ticket_create.html
@@ -0,0 +1,19 @@
+
diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/verify_process_create.html b/plugs/think-plugs-ticket/src/view/ticket_inter/verify_process_create.html
new file mode 100644
index 0000000..693c936
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/verify_process_create.html
@@ -0,0 +1,51 @@
+
+
+
审核流程
+
+
+
+ {foreach $process.steps as $index=>$step}
+ {include file="common/step_p" /}
+ {/foreach}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/ticket_inter/verify_ticket_create.html b/plugs/think-plugs-ticket/src/view/ticket_inter/verify_ticket_create.html
new file mode 100644
index 0000000..76d7f52
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/ticket_inter/verify_ticket_create.html
@@ -0,0 +1,19 @@
+
diff --git a/plugs/think-plugs-ticket/src/view/user_share/comment.html b/plugs/think-plugs-ticket/src/view/user_share/comment.html
new file mode 100644
index 0000000..90cb95c
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/user_share/comment.html
@@ -0,0 +1,183 @@
+{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}
+
+
+{/if}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/user_share/index.html b/plugs/think-plugs-ticket/src/view/user_share/index.html
index 9dc12aa..23a1078 100644
--- a/plugs/think-plugs-ticket/src/view/user_share/index.html
+++ b/plugs/think-plugs-ticket/src/view/user_share/index.html
@@ -18,9 +18,11 @@
详情
-
-
+ {{# if (d.status != 1) { }}
+
+
处理
+ {{# } }}
{/block}