| | |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | :summary-method="getSummaries" |
| | | show-summary |
| | | @sort-change="sortChange" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | return 'custom-row' |
| | | }, |
| | | getSummaries(param) { |
| | | const { columns, data } = param |
| | | const sums = [] |
| | | const i = 7 |
| | | columns.forEach((column, index) => { |
| | | if (index === i) { |
| | | sums[index] = '总数' |
| | | return |
| | | } |
| | | const values = data.map(item => Number(item[column.property])) |
| | | if (column.property === 'qty') { |
| | | sums[index] = values.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | // return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 |
| | | } |
| | | }, 0) |
| | | |
| | | sums[index] += ' 单' |
| | | } |
| | | if (column.property === 'relse_qty') { |
| | | sums[index] = values.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | // return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 |
| | | } |
| | | }, 0) |
| | | |
| | | sums[index] += ' 单' |
| | | } |
| | | }) |
| | | |
| | | this.$nextTick(() => { |
| | | this.$refs.tableDataRef.doLayout() |
| | | }) |
| | | return sums |
| | | } |
| | | } |
| | | } |