|
@@ -193,11 +193,12 @@ class Employee extends Controller
|
|
|
// 接收参数
|
|
// 接收参数
|
|
|
$id = request('id', 0);
|
|
$id = request('id', 0);
|
|
|
$map = ['id' => $id];
|
|
$map = ['id' => $id];
|
|
|
- $field = ['id', 'employee_code', 'name', 'mobile', 'department_id', 'duty_type', 'role_id', 'city_ids', 'open_notice', 'insert_time', 'update_time', 'status'];
|
|
|
|
|
|
|
+ $field = ['id', 'employee_code', 'name', 'mobile', 'department_ids', 'duty_type', 'role_id', 'city_ids', 'open_notice', 'insert_time', 'update_time', 'status'];
|
|
|
$data = $EmployeeModel->where($map)->select($field)->first();
|
|
$data = $EmployeeModel->where($map)->select($field)->first();
|
|
|
if (!$data) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
if (!$data) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
|
// 查询部门信息
|
|
// 查询部门信息
|
|
|
- $department_info = $DepartmentModel->where(['id' => $data['department_id']])->first();
|
|
|
|
|
|
|
+ $department_ids = explode(',', $data['department_ids']);
|
|
|
|
|
+ $department_info = $DepartmentModel->whereIn('id',$department_ids)->get()->select(['id','name'])->toarray();
|
|
|
// 查询角色信息
|
|
// 查询角色信息
|
|
|
$role_info = $RolesModel->where(['id' => $data['role_id']])->first();
|
|
$role_info = $RolesModel->where(['id' => $data['role_id']])->first();
|
|
|
// 查询城市信息
|
|
// 查询城市信息
|
|
@@ -206,7 +207,7 @@ class Employee extends Controller
|
|
|
if (count($city_ids) > 0) {
|
|
if (count($city_ids) > 0) {
|
|
|
$city_info = $CitysModel->whereIn('id', $city_ids)->pluck('name');
|
|
$city_info = $CitysModel->whereIn('id', $city_ids)->pluck('name');
|
|
|
}
|
|
}
|
|
|
- $data['department_name'] = isset($department_info['name']) ? $department_info['name'] : '';
|
|
|
|
|
|
|
+ $data['department_name'] = isset($department_info) ? array_column($department_info, 'name') : '';
|
|
|
$data['role_name'] = isset($role_info['name']) ? $role_info['name'] : '';
|
|
$data['role_name'] = isset($role_info['name']) ? $role_info['name'] : '';
|
|
|
$data['city_info'] = $city_info;
|
|
$data['city_info'] = $city_info;
|
|
|
// 加载模板
|
|
// 加载模板
|