|
@@ -30,7 +30,7 @@ class Staff extends Api
|
|
|
|
|
|
|
|
// 1. 查询所有有效人员(按部门+工序分组)
|
|
// 1. 查询所有有效人员(按部门+工序分组)
|
|
|
$list = db('人员_基本资料')
|
|
$list = db('人员_基本资料')
|
|
|
- ->field('所在部门, 生产工序, COUNT(*) AS count')
|
|
|
|
|
|
|
+ ->field('dept_name as 所在部门, big_process as 生产工序, COUNT(*) AS count')
|
|
|
->whereNull('mod_rq')
|
|
->whereNull('mod_rq')
|
|
|
->group('所在部门, 生产工序')
|
|
->group('所在部门, 生产工序')
|
|
|
->order('id asc')
|
|
->order('id asc')
|
|
@@ -63,8 +63,6 @@ class Staff extends Api
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 转成索引数组返回
|
|
|
|
|
$result = array_values($tree);
|
|
$result = array_values($tree);
|
|
|
$this->success('获取部门数据', $result);
|
|
$this->success('获取部门数据', $result);
|
|
|
}
|
|
}
|
|
@@ -80,10 +78,7 @@ class Staff extends Api
|
|
|
$where = [];
|
|
$where = [];
|
|
|
|
|
|
|
|
if (!empty($params['search'])){
|
|
if (!empty($params['search'])){
|
|
|
- $where['员工编号|员工姓名'] = array('like','%'.$params['search'].'%');
|
|
|
|
|
- }
|
|
|
|
|
- if (!empty($params['department_code'])) {
|
|
|
|
|
- $where['所在部门|生产工序'] = $params['department_code'];
|
|
|
|
|
|
|
+ $where['staff_no|staff_name'] = array('like','%'.$params['search'].'%');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$limit = $params['limit'];
|
|
$limit = $params['limit'];
|
|
@@ -94,7 +89,21 @@ class Staff extends Api
|
|
|
if (empty($pages)){
|
|
if (empty($pages)){
|
|
|
$pages = 1;
|
|
$pages = 1;
|
|
|
}
|
|
}
|
|
|
- $list = db('人员_基本资料')->where($where)->page($pages)->limit($limit)->order('id asc')->whereNull('mod_rq')->select();
|
|
|
|
|
|
|
+ $list = db('人员_基本资料')
|
|
|
|
|
+ ->field('
|
|
|
|
|
+ staff_no as 编号,
|
|
|
|
|
+ staff_name as 姓名,
|
|
|
|
|
+ gender as 性别,
|
|
|
|
|
+ team_id,
|
|
|
|
|
+ team_name as 小组名称,
|
|
|
|
|
+ big_process as 生产工序,
|
|
|
|
|
+ position as 职位,
|
|
|
|
|
+ dept_name as 所在部门,
|
|
|
|
|
+ status as 状态,
|
|
|
|
|
+ sys_rq as 创建日期,
|
|
|
|
|
+ sys_id as 创建人员
|
|
|
|
|
+ ')
|
|
|
|
|
+ ->where($where)->page($pages)->limit($limit)->order('id asc')->whereNull('mod_rq')->select();
|
|
|
$total = db('人员_基本资料')->where($where)->whereNull('mod_rq')->count();
|
|
$total = db('人员_基本资料')->where($where)->whereNull('mod_rq')->count();
|
|
|
$data['list'] = $list;
|
|
$data['list'] = $list;
|
|
|
$data['total'] = $total;
|
|
$data['total'] = $total;
|
|
@@ -125,16 +134,6 @@ class Staff extends Api
|
|
|
->whereNull('a.mod_rq')
|
|
->whereNull('a.mod_rq')
|
|
|
->select();
|
|
->select();
|
|
|
|
|
|
|
|
- // 2. 循环给每个人绑定 工序列表
|
|
|
|
|
- foreach ($staffList as &$item) {
|
|
|
|
|
- // 查询该人员的所有绑定工序
|
|
|
|
|
- $processList = db('人员_工序绑定关联')
|
|
|
|
|
- ->where('user_id', $item['id'])
|
|
|
|
|
- ->whereNull('mod_rq')
|
|
|
|
|
- ->column('工序ID,工序名称,工序编码,生产工序');
|
|
|
|
|
- // 把工序放进当前人员信息里
|
|
|
|
|
- $item['process_list'] = $processList;
|
|
|
|
|
- }
|
|
|
|
|
$this->success('获取员工资料', $staffList);
|
|
$this->success('获取员工资料', $staffList);
|
|
|
}
|
|
}
|
|
|
|
|
|