This commit is contained in:
chenbo 2023-12-29 18:49:41 +08:00
parent 9360e66dc2
commit e7f9c2caea
2 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,7 @@ use app\common\lists\ListsExcelInterface;
use app\common\model\Company;
use app\common\model\contract\Contract;
use app\common\model\user\User;
use app\common\model\user\UserRole;
use think\facade\Db;
@ -73,10 +74,15 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
}
}
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract,group_id";
$lists = User::withSearch($this->setSearch(), $this->params)
->append(['role_name'])
->with(['company'])
->withAttr('role_name', function ($value, $data){
$role = UserRole::where('id', $data['group_id'])->find();
return $role? $role['name']: "";
})
->where($where)
->limit($this->limitOffset, $this->limitLength)
->field($field)

View File

@ -53,6 +53,7 @@ class UserLogic extends BaseLogic
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
// $user->sex = $user->getData('sex');
$user['qualification']=json_decode($user->qualification,true);
$user['deposit_date'] = date('Y-m-d', $user['deposit_date']);
if($user->is_contract==1){
$user['contract']=Contract::where(['type'=>2,'party_b'=>$userId])->with(['party_a_info','contractType'])->find();
}