工单筛选

This commit is contained in:
2025-03-14 09:57:35 +08:00
parent fbcfef4ff0
commit c854518581
3 changed files with 7 additions and 4 deletions

View File

@ -63,11 +63,15 @@ class Ticket extends Auth
public function list() public function list()
{ {
$query = TicketTicket::query()->scope(['avail'])->where(['fz_user_id'=>$this->staff->id]);
$status = $this->request->get('status', null); $status = $this->request->get('status', null);
$query = TicketTicket::query(); // ->where(['fz_user_id'=>$this->staff->id])
if ($status) { if ($status) {
$query->where('staff_status', $status); $query->where('staff_status', $status);
} }
$keyword = $this->request->get('keyword', null);
if ($keyword) {
$query->where('title', 'like', "%{$keyword}%");
}
$pageData = $query->paginate(); $pageData = $query->paginate();
$this->success('获取工单列表', $pageData); $this->success('获取工单列表', $pageData);
} }

View File

@ -8,6 +8,6 @@ class InspectionStaffToken extends Model
{ {
public function staff() public function staff()
{ {
return $this->belongsTo(InspectionStaff::class, 'staff_id'); return $this->belongsTo(InspectionStaff::class, 'staff_id', "id");
} }
} }

View File

@ -8,7 +8,6 @@ use think\admin\Model;
class TicketTicket extends Model class TicketTicket extends Model
{ {
protected $append = ['status_text', 'type_name', 'dept_name', 'imgs_arr']; protected $append = ['status_text', 'type_name', 'dept_name', 'imgs_arr'];
protected $globalScope = ['unConf'];
protected $table = 'ticket_ticket'; protected $table = 'ticket_ticket';
public function type() public function type()
{ {
@ -90,7 +89,7 @@ class TicketTicket extends Model
private function getStatusList() private function getStatusList()
{ {
return [ return [
-1 => '已关闭', -1 => '待审核',
0 => '待处理', 0 => '待处理',
1 => '已作处理', 1 => '已作处理',
]; ];