From 0fc3f32bf0fa7dc76b8aa126d5429e343f19cfc9 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 27 Dec 2022 09:26:27 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=B2=97=E4=BD=8D=E8=AF=84=E7=BA=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/member/index.js | 122 ++++++++++++++---- api/app/lib/routes/member/index.js | 3 + .../actions/employeeInformation.js | 11 ++ .../sections/humanAffairs/containers/index.js | 2 +- .../containers/positionRating.jsx | 18 +-- web/client/src/utils/webapi.js | 1 + 6 files changed, 122 insertions(+), 35 deletions(-) diff --git a/api/app/lib/controllers/member/index.js b/api/app/lib/controllers/member/index.js index 3b6c8fa..3d1a661 100644 --- a/api/app/lib/controllers/member/index.js +++ b/api/app/lib/controllers/member/index.js @@ -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 } \ No newline at end of file diff --git a/api/app/lib/routes/member/index.js b/api/app/lib/routes/member/index.js index 9c7bb8a..6208ba5 100644 --- a/api/app/lib/routes/member/index.js +++ b/api/app/lib/routes/member/index.js @@ -38,4 +38,7 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['GET/members/export'] = { content: '导出员工信息', visible: true }; router.get('/members/export', member.exportData); + + app.fs.api.logAttr['GET/members/position_rating'] = { content: '查询岗位评级信息', visible: true }; + router.get('/members/position_rating', member.getPositionRating); }; \ No newline at end of file diff --git a/web/client/src/sections/humanAffairs/actions/employeeInformation.js b/web/client/src/sections/humanAffairs/actions/employeeInformation.js index c0ef65a..b0b0b4d 100644 --- a/web/client/src/sections/humanAffairs/actions/employeeInformation.js +++ b/web/client/src/sections/humanAffairs/actions/employeeInformation.js @@ -56,4 +56,15 @@ export function getAttendanceOvertime(query) {//加班统计 msg: { option: "加班统计" }, reducer: { name: "AttendanceOvertime", params: { noClear: true } }, }); +} +export function getPositionRating(query){//岗位评级 + return (dispatch) => basicAction({ + type: "get", + dispatch: dispatch, + actionType: "GET_POSITION_RATING", + query: query, + url: `${ApiTable.getPositionRating}`, + msg: { option: "岗位评级" }, + reducer: { name: "positionRating", params: { noClear: true } }, + }); } \ No newline at end of file diff --git a/web/client/src/sections/humanAffairs/containers/index.js b/web/client/src/sections/humanAffairs/containers/index.js index 0d0dec5..52c2246 100644 --- a/web/client/src/sections/humanAffairs/containers/index.js +++ b/web/client/src/sections/humanAffairs/containers/index.js @@ -35,7 +35,7 @@ import PersonnelFilesDetail from './personnelFilesDetail'; export { - PersonnelFiles, EmployeeInformation, DeptArchives,PositionRating, + PersonnelFiles, EmployeeInformation, DeptArchives, PositionRating, AttendanceStatistics, LeaveStatistics, OvertimeStatistics, AppointmentRecords, PersonnelDistribution, ResourceRepository, DepartmentTrainRecord, diff --git a/web/client/src/sections/humanAffairs/containers/positionRating.jsx b/web/client/src/sections/humanAffairs/containers/positionRating.jsx index 74f01ad..63749a5 100644 --- a/web/client/src/sections/humanAffairs/containers/positionRating.jsx +++ b/web/client/src/sections/humanAffairs/containers/positionRating.jsx @@ -37,7 +37,7 @@ const PositionRating = (props) => { obj.hiredateStart = '' obj.hiredateEnd = '' } - dispatch(humanAffairs.getMemberList({ ...obj, ...query, ...order })).then((res) => {//查询人员列表 + dispatch(humanAffairs.getPositionRating({ ...obj, ...query, ...order })).then((res) => {//查询人员列表 if (res.success) { setArchivesList(res.payload?.data?.rows) setLimits(res.payload?.data?.count) @@ -58,30 +58,30 @@ const PositionRating = (props) => { ), width: 160, - dataIndex: "departmrnt", - key: "departmrnt", + dataIndex: "department", + key: "department", render: (_, r, index) => { return (
{ - r.departmrnt.map((ite, idx) => { + r.department.map((ite, idx) => { let departmentsArr = [] - for (let i = 0; i < r.departmrnt.length; i++) { - departmentsArr.push(r.departmrnt[i].name) + for (let i = 0; i < r.department.length; i++) { + departmentsArr.push(r.department[i].depName) } return (
{idx == 0 ? (
- {ite.name} + {ite.depName}
) : ('') } { - r.departmrnt.length > 1 && idx == 1 ? ( + r.department.length > 1 && idx == 1 ? (
- +{r.departmrnt.length - 1} + +{r.department.length - 1}
) : ('') diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 51df842..8ff83a8 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -37,6 +37,7 @@ export const ApiTable = { editSalesMember: 'sales/member/modify', delSalesMember: 'sales/member/del', addSalesMemberBulk: 'add/sales/members/bulk', + getPositionRating: 'members/position_rating', //部门培训记录 getDepartmentTrainRecord: 'department/train/record/list',