|
@@ -20,13 +20,6 @@ class Staff extends Api
|
|
|
$this->success('员工资料接口');
|
|
$this->success('员工资料接口');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取部门列表
|
|
|
|
|
- * 一级:部门 dept_name(固定排序)
|
|
|
|
|
- * 二级:工序 big_process
|
|
|
|
|
- * 排序:裁剪、车缝、手工、大烫、总检、包装、其他
|
|
|
|
|
- * 空工序 = 其他
|
|
|
|
|
- */
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取部门列表
|
|
* 获取部门列表
|
|
|
* 一级:部门 dept_name
|
|
* 一级:部门 dept_name
|
|
@@ -382,22 +375,22 @@ class Staff extends Api
|
|
|
*/
|
|
*/
|
|
|
public function GetTeamStaffList()
|
|
public function GetTeamStaffList()
|
|
|
{
|
|
{
|
|
|
- if (Request::instance()->isGet() == false){
|
|
|
|
|
|
|
+ if (Request::instance()->isGet() == false) {
|
|
|
$this->error('非法请求');
|
|
$this->error('非法请求');
|
|
|
}
|
|
}
|
|
|
$params = Request::instance()->param();
|
|
$params = Request::instance()->param();
|
|
|
|
|
|
|
|
$where = [];
|
|
$where = [];
|
|
|
- if (!empty($params['search'])){
|
|
|
|
|
- $where['b.staff_no|b.staff_name|a.team_name|b.big_process'] = array('like','%'.$params['search'].'%');
|
|
|
|
|
|
|
+ if (!empty($params['search'])) {
|
|
|
|
|
+ $where['b.staff_no|b.staff_name|a.team_name|b.big_process'] = array('like', '%' . $params['search'] . '%');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$list = Db::name('人员_小组资料')->alias('a')
|
|
$list = Db::name('人员_小组资料')->alias('a')
|
|
|
->field('
|
|
->field('
|
|
|
- b.staff_no as 员工编号,
|
|
|
|
|
- b.staff_name as 员工姓名,
|
|
|
|
|
- a.*
|
|
|
|
|
- ')
|
|
|
|
|
|
|
+ b.staff_no as 员工编号,
|
|
|
|
|
+ b.staff_name as 员工姓名,
|
|
|
|
|
+ a.*
|
|
|
|
|
+ ')
|
|
|
->join('人员_基本资料 b', 'a.staff_no = b.staff_no')
|
|
->join('人员_基本资料 b', 'a.staff_no = b.staff_no')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->whereNull('a.mod_rq')
|
|
->whereNull('a.mod_rq')
|
|
@@ -417,14 +410,21 @@ class Staff extends Api
|
|
|
'staff_list' => []
|
|
'staff_list' => []
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
- // 添加成员信息
|
|
|
|
|
- $result[$teamId]['staff_list'][] = [
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $member = [
|
|
|
'id' => $item['id'],
|
|
'id' => $item['id'],
|
|
|
'员工编号' => $item['员工编号'],
|
|
'员工编号' => $item['员工编号'],
|
|
|
'员工姓名' => $item['员工姓名'],
|
|
'员工姓名' => $item['员工姓名'],
|
|
|
'小组名称' => $item['team_name'],
|
|
'小组名称' => $item['team_name'],
|
|
|
'职位' => $item['position']
|
|
'职位' => $item['position']
|
|
|
];
|
|
];
|
|
|
|
|
+
|
|
|
|
|
+ // 组长排第一个
|
|
|
|
|
+ if ($item['position'] == '组长') {
|
|
|
|
|
+ array_unshift($result[$teamId]['staff_list'], $member);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $result[$teamId]['staff_list'][] = $member;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 转为索引数组返回
|
|
// 转为索引数组返回
|