diff --git a/.vscode/launch.json b/.vscode/launch.json index a4e5aaf..cd44ee8 100644 --- a/.vscode/launch.json +++ b/.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", //测试 // 镇江研发结束 // 测试 diff --git a/api/app/lib/controllers/report/achievement.js b/api/app/lib/controllers/report/achievement.js index d6faa95..483a860 100644 --- a/api/app/lib/controllers/report/achievement.js +++ b/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 } \ No newline at end of file diff --git a/api/app/lib/routes/customerContactsFollup/index.js b/api/app/lib/routes/customerContactsFollup/index.js index b8c0cee..e383452 100644 --- a/api/app/lib/routes/customerContactsFollup/index.js +++ b/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); }; \ No newline at end of file diff --git a/api/app/lib/routes/report/index.js b/api/app/lib/routes/report/index.js index 22f6b33..42f7b40 100644 --- a/api/app/lib/routes/report/index.js +++ b/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); }; \ No newline at end of file diff --git a/web/client/src/sections/business/containers/performanceReport/contractDetails.jsx b/web/client/src/sections/business/containers/performanceReport/contractDetails.jsx index e76512c..3e9bc77 100644 --- a/web/client/src/sections/business/containers/performanceReport/contractDetails.jsx +++ b/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; } diff --git a/web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx b/web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx index c5686ff..9a76a9b 100644 --- a/web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx +++ b/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; }