更新人事调动

This commit is contained in:
yaooo 2023-10-30 13:52:36 +08:00
parent dba0e47999
commit 8743333c71
2 changed files with 23 additions and 27 deletions

View File

@ -88,32 +88,28 @@ class UserPersonal extends ApiController
//离职
public function leave()
{
if (request()->isAjax()) {
$param = get_params();
$where = array();
if (!empty($param['keyword'])) {
$where['u.name|p.remark'] = ['like', '%' . $param['keyword'] . '%'];
}
$where['p.status'] = array('eq', 1);
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$list = PersonalQuit::where($where)
->field('p.*,u.name as name,d.title as department,ps.title as position')
->alias('p')
->join('admin u', 'p.uid = u.id', 'LEFT')
->join('department d', 'u.did = d.id', 'LEFT')
->join('position ps', 'u.position_id = ps.id', 'LEFT')
->order('p.id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->quit_time = date('Y-m-d', $item->quit_time);
$item->lead_admin = Db::name('admin')->where(['id' => $item->lead_admin_id])->value('name');
$this_uids_name = Db::name('admin')->where([['id','in', $item->connect_uids]])->column('name');
$item->connect_names = implode(',', $this_uids_name);
});
return table_assign(0, '', $list);
} else {
return view();
$param = get_params();
$where = array();
if (!empty($param['keyword'])) {
$where['u.name|p.remark'] = ['like', '%' . $param['keyword'] . '%'];
}
$where['p.status'] = array('eq', 1);
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$list = PersonalQuit::where($where)
->field('p.*,u.name as name,d.title as department,ps.title as position')
->alias('p')
->join('admin u', 'p.uid = u.id', 'LEFT')
->join('department d', 'u.did = d.id', 'LEFT')
->join('position ps', 'u.position_id = ps.id', 'LEFT')
->order('p.id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->quit_time = date('Y-m-d', $item->quit_time);
$item->lead_admin = Db::name('admin')->where(['id' => $item->lead_admin_id])->value('name');
$this_uids_name = Db::name('admin')->where([['id','in', $item->connect_uids]])->column('name');
$item->connect_names = implode(',', $this_uids_name);
});
$this->apiSuccess('操作成功', $list);
}
//添加离职档案

View File

@ -29,8 +29,8 @@ class UserPosition extends ApiController
foreach ($list as &$val) {
$groupId = Db::name('PositionGroup')->where(['pid' => $val['id']])->column('group_id');
$groupName = Db::name('AdminGroup')->where('id', 'in', $groupId)->column('title');
$val['groupId'] = $groupId;
$val['groupName'] = implode(',', $groupName);
$val['group_dd'] = $groupId;
$val['group_name'] = implode(',', $groupName);
}
$this->apiSuccess('获取成功', $list);
}