diff --git a/src/views/WorkshopProcurement/RequestOutsourcingMaterials/index.vue b/src/views/WorkshopProcurement/RequestOutsourcingMaterials/index.vue index fb2c3ddf..60e3c545 100644 --- a/src/views/WorkshopProcurement/RequestOutsourcingMaterials/index.vue +++ b/src/views/WorkshopProcurement/RequestOutsourcingMaterials/index.vue @@ -43,6 +43,7 @@ :row-key="getRowKeys" :expand-row-keys="expands" :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}" + :summary-method="getSummaries1" border stripe style="margin-top: 3px;" @@ -271,6 +272,31 @@ export default { }) return sums }, + getSummaries1(param) { // 合计 + const { columns, data } = param + const sums = [] + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '合计' + } else if (index === 3) { + const values = data.map(item => Number(parseFloat(item['请款金额']))) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0) + sums[index] = sums[index].toFixed(2) + ' 元' + } else { + sums[index] = 'N/A' + } + } + }) + return sums + }, exportExcel() { this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '') this.supplierName0 ? this.check2 = 1 : (this.check2 = 0, this.supplierName0 = '')