|
|
@ -38,11 +38,6 @@ async function exportData(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { simpleExcelDown } = ctx.app.fs.utils; |
|
|
|
let exportData = await models.EmployeeCommunicate.findAll({ |
|
|
|
attributes: ['id', 'personalName', 'job', 'departmentName', 'communicateDate', 'communicateContent', |
|
|
|
'communicateResult', 'valuation', 'communicateCondition', 'nextPlan'], |
|
|
|
order: [['id', 'ASC']] |
|
|
|
}); |
|
|
|
const columnKeys = { |
|
|
|
personalName: '被沟通人', |
|
|
|
job: '岗位', |
|
|
@ -55,9 +50,15 @@ async function exportData(ctx) { |
|
|
|
nextPlan: '下一步工作计划或提升方向' |
|
|
|
} |
|
|
|
let header = []; |
|
|
|
let attributes = ['id']; |
|
|
|
Object.keys(columnKeys).map(key => { |
|
|
|
header.push({ title: columnKeys[key], key: key }); |
|
|
|
attributes.push(key); |
|
|
|
}) |
|
|
|
let exportData = await models.EmployeeCommunicate.findAll({ |
|
|
|
attributes: attributes, |
|
|
|
order: [['id', 'ASC']] |
|
|
|
}); |
|
|
|
const fileName = `员工沟通统计_${moment().format('YYYYMMDDHHmmss')}` + '.xlsx' |
|
|
|
const filePath = await simpleExcelDown({ data: exportData, header, fileName: fileName, format: 'YYYY-MM-DD', formatKey: 'communicateDate' }) |
|
|
|
const fileData = fs.readFileSync(filePath); |
|
|
|