This commit is contained in:
2025-03-26 15:22:03 +08:00
parent 4a3911ba12
commit 92cc1c27f3
16 changed files with 565 additions and 227 deletions

View File

@ -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'],