fix:项目管理功能需求
This commit is contained in:
@@ -87,6 +87,56 @@ class Hr extends Common
|
||||
|
||||
return $this->sendSuccess($StaffList);
|
||||
}
|
||||
public function GetStaffPage()
|
||||
{
|
||||
|
||||
$param = request()->post();
|
||||
|
||||
$currPage = isset($param['currPage']) ? $param['currPage'] : 1;
|
||||
$pageSize = isset($param['pageSize']) ? $param['pageSize'] : 20;
|
||||
|
||||
$result = db('hr_staff')->alias('i')
|
||||
->join('hr_staff_type t', 'i.staff_type=t.id', 'left')
|
||||
->where('i.del_time',null)
|
||||
->field('i.*, t.desp as staff_type_desp')
|
||||
->page($currPage, $pageSize)
|
||||
->select();
|
||||
|
||||
|
||||
$total = db('hr_staff')->alias('i')
|
||||
->join('hr_staff_type t', 'i.staff_type=t.id', 'left')
|
||||
->where('i.del_time',null)
|
||||
->field('i.*, t.desp as staff_type_desp')
|
||||
->count();
|
||||
//查找员工所属部门信息
|
||||
for ($i=0; $i<count($result); $i++)
|
||||
{
|
||||
$dept_arr = explode(",", $result[$i]['staff_dept']);
|
||||
$dept_desp = db('hr_dept')->where('dept_id', 'in', $dept_arr)->column('dept_name');
|
||||
$result[$i]['staff_dept_desp'] = implode(',', $dept_desp);
|
||||
}
|
||||
|
||||
|
||||
$StaffList = [];
|
||||
if (isset($param['type']))
|
||||
{
|
||||
for ($i=0; $i<count($result); $i++)
|
||||
{
|
||||
$dept_arr = explode(",", $result[$i]['staff_dept']);
|
||||
if (in_array($param['type'], $dept_arr))
|
||||
{
|
||||
$StaffList[] = $result[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$StaffList = $result;
|
||||
}
|
||||
$res['list'] = $StaffList;
|
||||
$res['total'] = $total;
|
||||
return $this->sendSuccess($res);
|
||||
}
|
||||
|
||||
//获取项目部门所有的员工信息
|
||||
public function GetProjectDeptStaffList()
|
||||
|
||||
Reference in New Issue
Block a user