This commit is contained in:
2024-12-03 10:18:07 +08:00
parent 6fcd8f7ce2
commit a6c7d1de15
14 changed files with 236 additions and 20 deletions

View File

@ -2,11 +2,13 @@
namespace plugin\ticket\controller;
use plugin\ticket\model\TicketDept;
use plugin\ticket\model\TicketReply;
use plugin\ticket\model\TicketTicket;
use plugin\ticket\model\TicketType;
use think\admin\Controller;
use think\admin\helper\QueryHelper;
use think\admin\model\SystemUser;
/**
* 工单管理
@ -127,4 +129,34 @@ class Ticket extends Controller
$data['contact'] = $adminInfo['contact_phone'];
}
}
public function move()
{
$this->title = "工单分配";
if ($this->request->isPost()) {
// 提交
$data = $this->_vali([
'id.require' => '请指定工单ID!',
'type.require' => '请指定分配类型!',
'dept_id.require' => '请指定处理部门!',
'user_id.require' => '请指定负责人员!',
]);
$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) {
// 内部
$ticket->state = 1;
} else {
// 外部
$ticket->state = 2;
}
$ticket->save();
} else {
$this->dept_list = TicketDept::query()->scope('avail')->select();
$this->user_list = SystemUser::query()->select();
$this->fetch();
}
}
}

View File

@ -32,7 +32,22 @@ class TicketInter extends Controller
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
->dateBetween(['create_at'])
->equal(['status', 'type_id']);
$query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name', 'last_reply']);
$query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']);
});
}
public function my()
{
$this->title = '我的工单';
$this->user_id = $this->request->session('user')['id'];
TicketTicketInter::mQuery()->layTable(function () {
}, function (QueryHelper $query) {
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
->dateBetween(['create_at'])
->equal(['status', 'type_id']);
$query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']);
$query->where(['current_admin_id' => $this->user_id]);
});
}

View File

@ -37,6 +37,21 @@ class TicketOuter extends Controller
});
}
public function my()
{
$this->title = '我的工单';
$this->user_id = $this->request->session('user')['id'];
TicketTicketOuter::mQuery()->layTable(function () {
}, function (QueryHelper $query) {
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
->dateBetween(['create_at'])
->equal(['status', 'type_id']);
$query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name']);
$query->where(['current_admin_id' => $this->user_id]);
});
}
/**
* 查看工单
* @auth true

View File

@ -8,6 +8,7 @@ use plugin\ticket\model\TicketType;
use plugin\ticket\model\TicketUserShare;
use think\admin\Controller;
use think\admin\helper\QueryHelper;
use think\admin\model\SystemUser;
/**
* 用户随手拍
@ -57,7 +58,7 @@ class UserShare extends Controller
$this->ticket_list = [];
}
$this->type_list = TicketType::getList();
$this->user_list = [];
$this->user_list = SystemUser::query()->select();
$this->fetch('detail');
}