Browse Source

表格字段名同步

master
zmh 2 years ago
parent
commit
2edf1f4a4d
  1. 72
      api/app/lib/utils/constant.js
  2. 6
      api/app/lib/utils/xlsxDownload.js
  3. 4
      web/client/src/sections/business/containers/performanceReport/contractDetails.jsx
  4. 2
      web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx

72
api/app/lib/utils/constant.js

@ -13,8 +13,80 @@ module.exports = function (app, opts) {
'调休': '调休'
}
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
}
}

6
api/app/lib/utils/xlsxDownload.js

@ -8,7 +8,7 @@ const moment = require('moment')
module.exports = function (app, opts) {
//递归创建目录 同步方法
async function makeDir (dir) {
async function makeDir(dir) {
if (!fs.existsSync(dir)) {
makeDir(path.dirname(dir))
fs.mkdirSync(dir, function (err) {
@ -19,7 +19,7 @@ module.exports = function (app, opts) {
}
}
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) {
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();
@ -59,7 +59,7 @@ module.exports = function (app, opts) {
indexCell.style = headerStyle
for (let h of header) {
const cell = row.addCell();
cell.value = data[i][h.key] || h.defaultValue || '';
cell.value = data[i][h.key] || h.defaultValue || '-';
cell.style = style
}
}

4
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) => {
<Select value={keywordTarget} onChange={setKeywordTarget} style={{ width: 150 }} >
<Select.Option value='contractNo'>合同编号</Select.Option>
<Select.Option value='department'>部门</Select.Option>
<Select.Option value='businessLine'>业务线</Select.Option>
<Select.Option value='business'>业务线</Select.Option>
</Select>
</div>
<div style={{ margin: '0px 18px' }}>

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

@ -48,7 +48,7 @@ const InvoicingDetails = (props) => {
localStorage.getItem(INVOICINGDETAILS) == null
? localStorage.setItem(
INVOICINGDETAILS,
JSON.stringify(['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a10', 'a11', 'a13'])
JSON.stringify(['year', 'serialNo', 'number', 'department', 'sale', 'contractNo', 'customer', 'item', 'amount', 'changeAmount', 'invoiceNo', 'invoiceDate'])
)
: "";
attribute();

Loading…
Cancel
Save