给商品库存报表增加合计

This commit is contained in:
季圣华
2021-10-15 02:10:42 +08:00
parent 62e27459c2
commit c41b176dae
2 changed files with 63 additions and 6 deletions

View File

@@ -376,6 +376,34 @@ export const JeecgListMixin = {
}
this.scroll.y = document.documentElement.clientHeight-searchWrapperDomLen-operatorDomLen-basicLength
}
},
/** 表格增加合计行 */
tableAddTotalRow(columns, dataSource) {
if(this.ipagination.pageSize!==10) {
let numKey = 'rowIndex'
let totalRow = { [numKey]: '合计' }
//移除不需要合计的列
let removeCols = 'action,mBarCode,purchaseDecimal'
columns.forEach(column => {
let { key, dataIndex } = column
if (![key, dataIndex].includes(numKey)) {
let total = 0
dataSource.forEach(data => {
total += Number.parseFloat(data[dataIndex])
})
if (Number.isNaN(total)) {
total = '-'
} else {
total = total.toFixed(2)
}
if(removeCols.indexOf(dataIndex)>-1) {
total = '-'
}
totalRow[dataIndex] = total
}
})
dataSource.push(totalRow)
}
}
}