Browse Source

开票明细导出暂交

master
zmh 2 years ago
parent
commit
fc9239a9d3
  1. 4
      .vscode/launch.json
  2. 31
      api/app/lib/controllers/report/achievement.js
  3. 2
      api/app/lib/routes/customerContactsFollup/index.js
  4. 3
      api/app/lib/routes/report/index.js
  5. 3
      web/client/src/sections/business/containers/performanceReport/contractDetails.jsx
  6. 3
      web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx

4
.vscode/launch.json

@ -43,9 +43,9 @@
//
//
"-g postgres://FashionAdmin:123456@10.8.30.36:5432/data_center",
"--redisHost 10.8.30.112",
"--redisHost localhost",
"--redisPort 6379",
"--apiEmisUrl http://10.8.30.112:14000", //
"--apiEmisUrl http://10.8.30.103:14000", //
// "--apiEmisUrl http://10.8.30.161:1111", //
//
//

31
api/app/lib/controllers/report/achievement.js

@ -339,10 +339,39 @@ async function exportContractDetail(ctx) {
}
}
/**
* 导出开票明细表数据
*/
async function exportInvoicingDetail(ctx) {
try {
const { models } = ctx.fs.dc;
let exportData = await models.InvoiceDetail.findAll({
order: [['id', 'DESC']]
});
const { utils: { simpleExcelDown, invoicingDetailsColumnKeys } } = ctx.app.fs;
let header = [];
Object.keys(invoicingDetailsColumnKeys).map(key => {
header.push({ title: invoicingDetailsColumnKeys[key], key: key });
})
const fileName = `开票明细表_${moment().format('YYYYMMDDHHmmss')}` + '.xlsx'
const filePath = await simpleExcelDown({ data: exportData, header, fileName: fileName, needIndexCell: false })
const fileData = fs.readFileSync(filePath);
ctx.status = 200;
ctx.set('Content-Type', 'application/x-xls');
ctx.set('Content-disposition', 'attachment; filename=' + encodeURI(fileName));
ctx.body = fileData;
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
ctx.body = { name: 'ExportAllError', message: '导出开票明细表数据失败' }
}
}
module.exports = {
getReceivedDetail,//回款
getAchievementDetail,//业绩
getContractDetail,
getInvoicingDetail,
exportContractDetail
exportContractDetail,
exportInvoicingDetail
}

2
api/app/lib/routes/customerContactsFollup/index.js

@ -4,5 +4,5 @@ const report = require('../../controllers/customerContactsFollup');
module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/customerContactsFollup'] = { content: '客户联系人对接跟进', visible: false };
router.get('/customerContactsFollup', report.getReserveItemReport);
router.get('/customerContactsFollup', report.getCustomerContactsFollowup);
};

3
api/app/lib/routes/report/index.js

@ -24,4 +24,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/export/contract/detail'] = { content: '导出合同明细表', visible: false };
router.get('/export/contract/detail', achieve.exportContractDetail);
app.fs.api.logAttr['GET/export/invoicing/detail'] = { content: '导出开票明细表', visible: false };
router.get('/export/invoicing/detail', achieve.exportInvoicingDetail);
};

3
web/client/src/sections/business/containers/performanceReport/contractDetails.jsx

@ -34,7 +34,8 @@ const ContractDetails = (props) => {
default:
columns.push({
title: columnKeys[key], dataIndex: key, key: key,
render: (text, record) => text === 0 ? text : text ? text : '—', width: 32 + columnKeys[key].length * 16
render: (text, record) => text === 0 ? text : text ? text : '—',
width: 32 + columnKeys[key].length * 16
});
break;
}

3
web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx

@ -34,7 +34,8 @@ const InvoicingDetails = (props) => {
default:
columns.push({
title: columnKeys[key], dataIndex: key, key: key,
render: (text, record) => text === 0 ? text : text ? text : '—', width: 32 + columnKeys[key].length * 16
render: (text, record) => text === 0 ? text : text ? text : '—',
width: 32 + columnKeys[key].length * 16
});
break;
}

Loading…
Cancel
Save