From 8743333c712f3dea99b416a5829de48e63b9a20b Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 30 Oct 2023 13:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=BA=E4=BA=8B=E8=B0=83?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/UserPersonal.php | 46 +++++++++++++---------------- app/api/controller/UserPosition.php | 4 +-- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/app/api/controller/UserPersonal.php b/app/api/controller/UserPersonal.php index eb45a4e..67da0d6 100644 --- a/app/api/controller/UserPersonal.php +++ b/app/api/controller/UserPersonal.php @@ -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); } //添加离职档案 diff --git a/app/api/controller/UserPosition.php b/app/api/controller/UserPosition.php index c7bdbea..f109525 100644 --- a/app/api/controller/UserPosition.php +++ b/app/api/controller/UserPosition.php @@ -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); }