From a3cc42524d500e41094556c3ec7b250d89372095 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 7 Sep 2023 15:27:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=8C=BA=E5=9F=9F=E7=BB=8F=E7=90=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=85=AC=E5=8F=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task_scheduling/TaskSchedulingLists.php | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/adminapi/lists/task_scheduling/TaskSchedulingLists.php b/app/adminapi/lists/task_scheduling/TaskSchedulingLists.php index 9951ce17b..976c5c0a1 100644 --- a/app/adminapi/lists/task_scheduling/TaskSchedulingLists.php +++ b/app/adminapi/lists/task_scheduling/TaskSchedulingLists.php @@ -20,6 +20,7 @@ use app\common\model\task_scheduling\TaskScheduling; use app\common\lists\ListsSearchInterface; use app\common\model\auth\Admin; use app\common\model\Company; +use think\db\Where; /** * 任务公司排期列表 @@ -39,7 +40,7 @@ class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInter public function setSearch(): array { return [ - '=' => ['create_user_id', 'company_id', 'company_type', 'status'], + '=' => ['company_type', 'status'], ]; } @@ -55,20 +56,24 @@ class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInter */ public function lists(): array { - if(isset($params['company_id']) && $params['company_id']!=''){ - $arr= Company::where('company_name','like','%'.$params['company_id'].'%')->column('id'); - if($arr){ - $where[]=['party_a|party_b','in',$arr]; - } - } - if(isset($params['create_user_id']) && $params['create_user_id']!=''){ - $arr= Admin::where('name','like','%'.$params['create_user_id'].'%')->column('id'); - if($arr){ - $where[]=['area_manager','in',$arr]; - } - } + $params = $this->request->param(); + $where = []; + if (isset($params['company_id']) && $params['company_id'] != '') { + $arr = Company::where('company_name', 'like', '%' . $params['company_id'] . '%')->column('id'); + if ($arr) { + $where[] = ['company_id', 'in', $arr]; + } + } + + if ($this->adminInfo['root'] != 1) { + $arr = Company::where('area_manager', $this->adminId)->column('id'); + if ($arr) { + $where[] = ['company_id', 'in', $arr]; + } + } return TaskScheduling::where($this->searchWhere) - ->with(['admin','company','company_type']) + ->where($where) + ->with(['admin', 'company', 'company_type']) // ->field(['id', 'create_user_id', 'company_id', 'company_type', 'status']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -87,5 +92,4 @@ class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInter { return TaskScheduling::where($this->searchWhere)->count(); } - -} \ No newline at end of file +}