You've already forked guangan
维修工单
This commit is contained in:
@ -467,17 +467,31 @@ 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([
|
||||
'staff_id.require'=>'请指定维修人员!',
|
||||
'kj_user_id.default'=>'0',
|
||||
]);
|
||||
$view = $ticket->repairs()->save([
|
||||
$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,
|
||||
'staff_id'=>$instance_data['staff_id'],
|
||||
'status'=>0,
|
||||
'create_by'=>$adminInfo['id'],
|
||||
]);
|
||||
$this->success('创建成功!', $view);
|
||||
$this->success('创建成功!', $repair);
|
||||
} else {
|
||||
$this->vo = $ticket;
|
||||
$this->staffs = $staffs;
|
||||
|
Reference in New Issue
Block a user