调整人员列表数据返回
This commit is contained in:
parent
b8db3fb1c6
commit
17307981f8
@ -22,6 +22,7 @@ use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminRole;
|
||||
use app\common\model\auth\SystemRole;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Jobs;
|
||||
|
||||
@ -135,8 +136,8 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
public function lists(): array
|
||||
{
|
||||
$field = [
|
||||
'id', 'name', 'account', 'create_time', 'disable', 'root',
|
||||
'login_time', 'login_ip', 'multipoint_login', 'avatar'
|
||||
'id', 'name', 'account', 'create_time', 'disable', 'root', 'province', 'city', 'area', 'street',
|
||||
'login_time', 'login_ip', 'multipoint_login', 'avatar', 'company_id', 'contract_id', 'create_time'
|
||||
];
|
||||
|
||||
$adminLists = Admin::field($field)
|
||||
@ -144,7 +145,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->append(['role_id', 'dept_id', 'jobs_id', 'disable_desc'])
|
||||
->append(['role_id', 'dept_id', 'jobs_id', 'disable_desc', 'province_name', 'city_name', 'area_name', 'street_name'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
@ -154,6 +155,9 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
$deptLists = Dept::column('name', 'id');
|
||||
// 岗位列表
|
||||
$jobsLists = Jobs::column('name', 'id');
|
||||
$companyIds = array_unique(array_column($adminLists, 'company_id'));
|
||||
$company = Company::whereIn('id', $companyIds)->field('id,company_name')->select()->toArray();
|
||||
$adminLists = append($adminLists, $company, 'company_id', 'company');
|
||||
|
||||
//管理员列表增加角色名称
|
||||
foreach ($adminLists as $k => $v) {
|
||||
|
@ -465,3 +465,15 @@ function loopGetChild($model, $id, $parentKey = 'pid', $field = '*')
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function append($data, $append, $key = 'id', $appendKey = 'append')
|
||||
{
|
||||
$tmp = [];
|
||||
foreach ($append as $item) {
|
||||
$tmp[$item['id']] = $item;
|
||||
}
|
||||
foreach ($data as &$v) {
|
||||
$v[$appendKey] = $tmp[$v[$key]] ?? [];
|
||||
}
|
||||
return $data;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user