|
|
@ -518,27 +518,27 @@ async function exportData(ctx) { |
|
|
|
title: '姓名', |
|
|
|
key: 'userName', |
|
|
|
}, { |
|
|
|
title: '所属部门', |
|
|
|
key: 'departmrnt', |
|
|
|
}, { |
|
|
|
title: '职位', |
|
|
|
key: 'userJob', |
|
|
|
}, { |
|
|
|
title: '岗位', |
|
|
|
key: 'userPost', |
|
|
|
}, { |
|
|
|
title: '在职状态', |
|
|
|
key: 'userActiveStatus', |
|
|
|
}, { |
|
|
|
title: '绩点', |
|
|
|
key: 'point', |
|
|
|
}, { |
|
|
|
title: '归属机构', |
|
|
|
key: 'userOrganization', |
|
|
|
}, { |
|
|
|
title: '技术职级等级', |
|
|
|
key: 'technicalGrade', |
|
|
|
}] |
|
|
|
title: '所属部门', |
|
|
|
key: 'departmrnt', |
|
|
|
}, { |
|
|
|
title: '职位', |
|
|
|
key: 'userJob', |
|
|
|
}, { |
|
|
|
title: '岗位', |
|
|
|
key: 'userPost', |
|
|
|
}, { |
|
|
|
title: '在职状态', |
|
|
|
key: 'userActiveStatus', |
|
|
|
}, { |
|
|
|
title: '绩点', |
|
|
|
key: 'point', |
|
|
|
}, { |
|
|
|
title: '归属机构', |
|
|
|
key: 'userOrganization', |
|
|
|
}, { |
|
|
|
title: '技术职级等级', |
|
|
|
key: 'technicalGrade', |
|
|
|
}] |
|
|
|
let header = [].concat(preHeader) |
|
|
|
for (let k in tableAttributes) { |
|
|
|
const comment = tableAttributes[k].comment |
|
|
@ -600,10 +600,10 @@ async function exportData(ctx) { |
|
|
|
exportD.forEach(d => { |
|
|
|
d.departmrnt = d.departmrnt.map(dep => dep.name).join('、') |
|
|
|
d.role = d.role.map(r => r.name).join('、') |
|
|
|
|
|
|
|
d.userJob = d.userJob? UserAttribute.jobDataSource[d.userJob - 1] : ''; |
|
|
|
d.userActiveStatus = d.userActiveStatus? UserAttribute.activeStatusDataSource[d.userActiveStatus - 1] : ''; |
|
|
|
d.userOrganization = d.userOrganization? UserAttribute.organizationDataSource[d.userOrganization - 1] : ''; |
|
|
|
|
|
|
|
d.userJob = d.userJob ? UserAttribute.jobDataSource[d.userJob - 1] : ''; |
|
|
|
d.userActiveStatus = d.userActiveStatus ? UserAttribute.activeStatusDataSource[d.userActiveStatus - 1] : ''; |
|
|
|
d.userOrganization = d.userOrganization ? UserAttribute.organizationDataSource[d.userOrganization - 1] : ''; |
|
|
|
|
|
|
|
d.idPhoto ? d.idPhoto = qiniu.domain + '/' + d.idPhoto : '' |
|
|
|
d.vitae ? d.vitae = qiniu.domain + '/' + d.vitae : '' |
|
|
@ -701,6 +701,77 @@ async function addMembersBulk(ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//岗位评级
|
|
|
|
async function getPositionRating(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { limit, page } = ctx.query; |
|
|
|
|
|
|
|
const findObj = {}; |
|
|
|
if (Number(limit) > 0 && Number(page) >= 0) { |
|
|
|
findObj.limit = Number(limit); |
|
|
|
findObj.offset = Number(page) * Number(limit); |
|
|
|
} |
|
|
|
|
|
|
|
const list = await models.PositionRating.findAndCountAll(findObj); |
|
|
|
if (list.rows.length) { |
|
|
|
const userIds = list.rows.map(u => u.pepUserId); |
|
|
|
/**查询user信息 */ |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
const { database: pepEmis } = clickHouse.pepEmis.opts.config |
|
|
|
|
|
|
|
const userRes = await clickHouse.hr.query(` |
|
|
|
SELECT |
|
|
|
user.id as userId, |
|
|
|
user.name AS userName, |
|
|
|
user.people_code AS userCode, |
|
|
|
basicDataPost.name AS userPost, |
|
|
|
department.name AS depName, |
|
|
|
department.id AS depId, |
|
|
|
user.job AS userJob, |
|
|
|
user.active_status AS userActiveStatus, |
|
|
|
user.organization AS userOrganization |
|
|
|
FROM ${pepEmis}.user AS user |
|
|
|
LEFT JOIN ${pepEmis}.basicdata_post AS basicDataPost |
|
|
|
ON ${pepEmis}.basicdata_post.id = user.post |
|
|
|
LEFT JOIN ${pepEmis}.department_user AS department_user |
|
|
|
ON department_user.user = user.id |
|
|
|
LEFT JOIN ${pepEmis}.department AS department |
|
|
|
ON department.id = department_user.department |
|
|
|
where user.id in (${userIds.join(",")} ) |
|
|
|
`).toPromise();
|
|
|
|
|
|
|
|
const rslt = []; |
|
|
|
list.rows.map(item => { |
|
|
|
const userInfo = userRes && userRes.filter(u => item.pepUserId == u.userId); |
|
|
|
item.dataValues.department = userInfo.map(u => { return { depName: u.depName, depId: u.depId } }); |
|
|
|
item.dataValues.userName = userInfo.length && userInfo[0].userName; |
|
|
|
item.d |
|
|
|
rslt.push({ |
|
|
|
...item.dataValues, |
|
|
|
department: userInfo.map(u => { return { depName: u.depName, depId: u.depId } }), |
|
|
|
userName: userInfo.length && userInfo[0].userName, |
|
|
|
userPost: userInfo.length && userInfo[0].userPost |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
ctx.body = { |
|
|
|
rows: rslt, |
|
|
|
count: list.count |
|
|
|
} |
|
|
|
} else { |
|
|
|
ctx.body = list; |
|
|
|
} |
|
|
|
ctx.status = 200; |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { |
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
module.exports = { |
|
|
|
add, |
|
|
|
edit, |
|
|
@ -714,4 +785,5 @@ module.exports = { |
|
|
|
nativePlaceList, |
|
|
|
workPlaceList, |
|
|
|
maritalList, |
|
|
|
getPositionRating |
|
|
|
} |