Browse Source

筛选导出的(额外)字段key值

master
巴林闲侠 2 years ago
parent
commit
30f36c2b74
  1. 49
      api/app/lib/controllers/member/index.js

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

@ -277,7 +277,8 @@ async function list (ctx) {
const userRes = await memberList({
keywordTarget, keyword, limit, page, state,
hiredateStart, hiredateEnd, marital, native, workPlace,
orderBy, orderDirection, nowAttendanceTime: true
orderBy, orderDirection,
nowAttendanceTime: true
})
let { packageUser: returnD, pepUserIds } = await packageUserData(userRes, {
@ -472,9 +473,18 @@ async function exportData (ctx) {
const { models } = ctx.fs.dc;
const { clickHouse, opts: { qiniu } } = ctx.app.fs
const { simpleExcelDown, memberList, packageUserData } = ctx.app.fs.utils
const { keywordTarget, keyword, limit, page, state, keys = '' } = ctx.query
const {
keywordTarget, keyword, limit, page, state, keys = '',
hiredateStart, hiredateEnd, marital, native, workPlace,
orderBy, orderDirection,
} = ctx.query
const userRes = await memberList({ keywordTarget, keyword, limit, page, state, nowAttendanceTime: true })
const userRes = await memberList({
keywordTarget, keyword, limit, page, state,
hiredateStart, hiredateEnd, marital, native, workPlace,
orderBy, orderDirection,
nowAttendanceTime: true
})
const tableAttributes = models['Member'].tableAttributes
const optionKeys = keys.split(',')
@ -500,19 +510,26 @@ async function exportData (ctx) {
})
}
}
header = header.concat([{
title: '累计加班次数',
key: 'overTimeCount',
}, {
title: '累计加班总时长 / h',
key: 'overTimeDuration',
}, {
title: '累计请假次数',
key: 'vacateCount',
}, {
title: '累计请假总时长 / h',
key: 'vacateDuration',
},])
if (optionKeys.includes('overtimeStatistic')) {
header = header.concat([{
title: '累计加班次数',
key: 'overTimeCount',
}, {
title: '累计加班总时长 / h',
key: 'overTimeDuration',
},])
}
if (optionKeys.includes('vacateStatistic')) {
header = header.concat([{
title: '累计请假次数',
key: 'vacateCount',
}, {
title: '累计请假总时长 / h',
key: 'vacateDuration',
},])
}
// 查询累计加班次数及总时长
const statisticOvertimeRes = await clickHouse.hr.query(`
SELECT

Loading…
Cancel
Save