Browse Source

(*)岗位评级列表展示

master
周沫沫历险记 2 years ago
parent
commit
0fc3f32bf0
  1. 122
      api/app/lib/controllers/member/index.js
  2. 3
      api/app/lib/routes/member/index.js
  3. 11
      web/client/src/sections/humanAffairs/actions/employeeInformation.js
  4. 2
      web/client/src/sections/humanAffairs/containers/index.js
  5. 18
      web/client/src/sections/humanAffairs/containers/positionRating.jsx
  6. 1
      web/client/src/utils/webapi.js

122
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
}

3
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);
};

11
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 } },
});
}

2
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,

18
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) => {
</div>
),
width: 160,
dataIndex: "departmrnt",
key: "departmrnt",
dataIndex: "department",
key: "department",
render: (_, r, index) => {
return (
<div style={{ display: 'flex' }}>
{
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 (
<div key={idx} style={{ display: 'flex' }}>
{idx == 0 ?
(<div style={{ padding: '0px 4px 1px 4px ', color: '#FFFFFF', fontSize: 12, background: 'rgba(0,90,189,0.8)', borderRadius: 2, marginRight: 4 }}>
{ite.name}
{ite.depName}
</div>) : ('')
}
{
r.departmrnt.length > 1 && idx == 1 ? (
r.department.length > 1 && idx == 1 ? (
<Tooltip content={departmentsArr.join(',')} trigger="click" style={{ lineHeight: 2 }}>
<div style={{ padding: '0px 4px 1px 4px ', color: 'rgba(0,90,189,0.8)', fontSize: 12, marginRight: 4, cursor: "pointer", }}>
+{r.departmrnt.length - 1}
+{r.department.length - 1}
</div>
</Tooltip>
) : ('')

1
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',

Loading…
Cancel
Save