diff --git a/api/app/lib/utils/constant.js b/api/app/lib/utils/constant.js index 8012eca..d1bf58e 100644 --- a/api/app/lib/utils/constant.js +++ b/api/app/lib/utils/constant.js @@ -2,19 +2,91 @@ module.exports = function (app, opts) { - const dayType = { - dayoff: '普假', - workday: '工作日', - festivals: '法定假', - } + const dayType = { + dayoff: '普假', + workday: '工作日', + festivals: '法定假', + } - const overtimeType = { - '发放加班补偿': '折算', - '调休': '调休' - } + const overtimeType = { + '发放加班补偿': '折算', + '调休': '调休' + } - return { - dayType, - overtimeType, - } + const contractDetailsColumnKeys = { + year: '年度', + serialNo: '序号', + number: '编号', + introduction: '简介', + contractNo: '合同编号', + applyDate: '申请日期', + recConDate: '收到合同日期', + contractPaper: '合同纸质版情况', + contractElec: '合同电子版情况', + department: '部门', + business: '业务线', + sale: '销售人员', + customer: '客户名称', + item: '项目名称', + itemType: '项目类型', + amount: '合同金额', + changeAmount: '变更后合同金额', + cInvoicedAmount: '累计开票金额', + cBackAmount: '累计回款金额', + invoicedBack: '开票-回款', + unInvoicedAmount: '未开票金额', + remainConAmount: '剩余合同金额', + backPercent: '回款率', + retentionMoney: '质保金', + retentionPercent: '质保金比例', + retentionTerm: '质保期', + invoiceTax1: '发票税率金额13%', + invoiceTax2: '发票税率金额9%', + invoiceTax3: '发票税率金额6%', + payType: '合同付款方式', + cost: '预支提成及委外费用', + performanceRatio: '业绩折算比例', + realPerformance: '实际业绩', + assessmentPerformance: '考核业绩', + acceptanceDate: '验收日期', + backConfirmDate: '收入确认时间', + recYear: '接单年份', + recMonth: '接单月份', + cusAttribute: '客户属性', + cusType: '客户类型', + industry: '行业', + source: '信息来源', + cusProvince: '客户省份', + cusArea: '项目所在地', + text: '备注', + } + + const invoicingDetailsColumnKeys = { + year: '年度', + serialNo: '序号', + number: '编号', + department: '部门', + sale: '销售人员', + contractNo: '合同编号', + customer: '客户名称', + item: '项目名称', + amount: '合同金额', + changeAmount: '变更后合同金额', + invoiceNo: '发票号码', + invoiceType: '开票类型', + invoiceDate: '开票日期', + invoiceAmount: '开票金额', + outputTax: '销项税额', + total: '合计', + taxRate13: '税率13%', + taxRate9: '税率9%', + taxRate6: '税率6%' + } + + return { + dayType, + overtimeType, + contractDetailsColumnKeys, + invoicingDetailsColumnKeys + } } \ No newline at end of file diff --git a/api/app/lib/utils/xlsxDownload.js b/api/app/lib/utils/xlsxDownload.js index bcd060a..1aa03e7 100644 --- a/api/app/lib/utils/xlsxDownload.js +++ b/api/app/lib/utils/xlsxDownload.js @@ -7,76 +7,76 @@ const moment = require('moment') module.exports = function (app, opts) { - //递归创建目录 同步方法 - async function makeDir (dir) { - if (!fs.existsSync(dir)) { - makeDir(path.dirname(dir)) - fs.mkdirSync(dir, function (err) { - if (err) { - throw err - } - }); - } - } + //递归创建目录 同步方法 + async function makeDir(dir) { + if (!fs.existsSync(dir)) { + makeDir(path.dirname(dir)) + fs.mkdirSync(dir, function (err) { + if (err) { + throw err + } + }); + } + } - async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) { - const fileDirPath = path.join(__dirname, `../../downloadFiles`) - makeDir(fileDirPath) - const file = new xlsx.File(); - const sheet_1 = file.addSheet('sheet_1'); + async function simpleExcelDown({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) { + const fileDirPath = path.join(__dirname, `../../downloadFiles`) + makeDir(fileDirPath) + const file = new xlsx.File(); + const sheet_1 = file.addSheet('sheet_1'); - // header - const headerStyle = new xlsx.Style(); - headerStyle.align.h = 'center'; - headerStyle.align.v = 'center'; - headerStyle.border.right = 'thin'; - headerStyle.border.rightColor = '#000000'; - headerStyle.border.bottom = 'thin'; - headerStyle.border.bottomColor = '#000000'; + // header + const headerStyle = new xlsx.Style(); + headerStyle.align.h = 'center'; + headerStyle.align.v = 'center'; + headerStyle.border.right = 'thin'; + headerStyle.border.rightColor = '#000000'; + headerStyle.border.bottom = 'thin'; + headerStyle.border.bottomColor = '#000000'; - const headerRow = sheet_1.addRow(); - const indexCell = headerRow.addCell(); - indexCell.value = '序号' - indexCell.style = headerStyle - for (let h of header) { - const cell = headerRow.addCell(); - cell.value = h.title; - cell.style = headerStyle - } + const headerRow = sheet_1.addRow(); + const indexCell = headerRow.addCell(); + indexCell.value = '序号' + indexCell.style = headerStyle + for (let h of header) { + const cell = headerRow.addCell(); + cell.value = h.title; + cell.style = headerStyle + } - // data - const style = new xlsx.Style(); - style.align.h = 'left'; - style.align.v = 'center'; - style.border.right = 'thin'; - style.border.rightColor = '#000000'; - style.border.bottom = 'thin'; - style.border.bottomColor = '#000000'; - for (let i = 0; i < data.length; i++) { - const row = sheet_1.addRow(); - const indexCell = row.addCell(); - indexCell.value = i + 1 - indexCell.style = headerStyle - for (let h of header) { - const cell = row.addCell(); - cell.value = data[i][h.key] || h.defaultValue || ''; - cell.style = style - } - } + // data + const style = new xlsx.Style(); + style.align.h = 'left'; + style.align.v = 'center'; + style.border.right = 'thin'; + style.border.rightColor = '#000000'; + style.border.bottom = 'thin'; + style.border.bottomColor = '#000000'; + for (let i = 0; i < data.length; i++) { + const row = sheet_1.addRow(); + const indexCell = row.addCell(); + indexCell.value = i + 1 + indexCell.style = headerStyle + for (let h of header) { + const cell = row.addCell(); + cell.value = data[i][h.key] || h.defaultValue || '-'; + cell.style = style + } + } - const savePath = path.join(fileDirPath, fileName) - await new Promise(function (resolve, reject) { - file.saveAs() - .pipe(fs.createWriteStream(savePath)) - .on('finish', () => { - resolve() - }); - }) - return savePath - } + const savePath = path.join(fileDirPath, fileName) + await new Promise(function (resolve, reject) { + file.saveAs() + .pipe(fs.createWriteStream(savePath)) + .on('finish', () => { + resolve() + }); + }) + return savePath + } - return { - simpleExcelDown, - makeDir - } + return { + simpleExcelDown, + makeDir + } } \ 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 23fcdb7..b2cb4f0 100644 --- a/web/client/src/sections/business/containers/performanceReport/contractDetails.jsx +++ b/web/client/src/sections/business/containers/performanceReport/contractDetails.jsx @@ -48,7 +48,7 @@ const ContractDetails = (props) => { localStorage.getItem(CONTRACTDETAILS) == null ? localStorage.setItem( CONTRACTDETAILS, - JSON.stringify(['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a10', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16']) + JSON.stringify(['year', 'serialNo', 'number', 'introduction', 'contractNo', 'applyDate', 'recConDate', 'department', 'business', 'sale', 'customer', 'item', 'itemType', 'amount']) ) : ""; attribute(); @@ -106,7 +106,7 @@ const ContractDetails = (props) => {