修复任务排序区域经理显示其他公司问题

This commit is contained in:
mkm 2023-09-07 15:27:14 +08:00
parent 8297752d06
commit a3cc42524d

View File

@ -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();
}
}
}