Browse Source

人员搜索部门去重

master
巴林闲侠 2 years ago
parent
commit
803c472ac8
  1. 29
      api/app/lib/controllers/member/index.js

29
api/app/lib/controllers/member/index.js

@ -119,22 +119,30 @@ async function searchPepMember (ctx) {
userRes.forEach(u => {
let existUser = returnD.find(r => r.pepUserId == u.pepUserId)
if (existUser) {
existUser.departmrnt.push({
name: u.depName
})
existUser.role.push({
name: u.roleName
})
if (u.depId && !existUser.departmrnt.some(d => d.id == u.depId)) {
existUser.departmrnt.push({
id: u.depId,
name: u.depName
})
}
if (u.roleId && !existUser.role.some(r => r.id == u.roleId)) {
existUser.role.push({
id: u.roleId,
name: u.roleName
})
}
} else {
returnD.push({
pepUserId: u.pepUserId,
name: u.userName,
departmrnt: [{
departmrnt: u.depId ? [{
id: u.depId,
name: u.depName
}],
role: [{
}] : [],
role: u.roleId ? [{
id: u.roleId,
name: u.roleName
}]
}] : [],
})
}
})
@ -196,6 +204,7 @@ async function list (ctx) {
&& nowTime.isBefore(moment(curDay + ' 17:30'))
) {
// 在工作日的工作时间范围
whereOption.push(``)
}
} else {
ctx.body = []

Loading…
Cancel
Save