报表的合计优化

This commit is contained in:
季圣华
2021-10-24 14:58:40 +08:00
parent 921b268d9f
commit 35ec29a0f8

View File

@@ -386,22 +386,23 @@ export const JeecgListMixin = {
let numKey = 'rowIndex' let numKey = 'rowIndex'
let totalRow = { [numKey]: '合计' } let totalRow = { [numKey]: '合计' }
//移除不需要合计的列 //移除不需要合计的列
let removeCols = 'action,mBarCode,barCode,name,standard,model,categoryName,unitName,serialNo,unitPrice,purchaseDecimal,operTime,oTime' let parseCols = 'initialStock,currentStock,currentStockPrice,initialAmount,thisMonthAmount,currentAmount,inSum,inSumPrice,' +
'outSum,outSumPrice,outInSumPrice,operNumber,allPrice,numSum,priceSum,prevSum,thisSum,thisAllPrice,billMoney,changeAmount,' +
'allPrice,safetystock,currentNumber,linjieNumber'
columns.forEach(column => { columns.forEach(column => {
let { key, dataIndex } = column let { key, dataIndex } = column
if (![key, dataIndex].includes(numKey)) { if (![key, dataIndex].includes(numKey)) {
let total = 0 let total = 0
dataSource.forEach(data => { dataSource.forEach(data => {
total += Number.parseFloat(data[dataIndex]) if(parseCols.indexOf(dataIndex)>-1) {
total += Number.parseFloat(data[dataIndex])
} else {
total = '-'
}
}) })
if (Number.isNaN(total)) { if (total !== '-') {
total = '-'
} else {
total = total.toFixed(2) total = total.toFixed(2)
} }
if(removeCols.indexOf(dataIndex)>-1) {
total = '-'
}
totalRow[dataIndex] = total totalRow[dataIndex] = total
} }
}) })