Browse Source

人员搜索部门去重

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

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

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

Loading…
Cancel
Save