|
|
@ -55,7 +55,7 @@ |
|
|
|
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|
|
|
</div> |
|
|
|
<div class=""> |
|
|
|
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange"> |
|
|
|
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange" show-summary :summary-method="getSummaries"> |
|
|
|
<el-table-column fixed type="selection" align="center" width="50" /> |
|
|
|
<el-table-column fixed label="序号" type="index" :index="indexMethod" align="center" width="80" /> |
|
|
|
<el-table-column fixed label="操作" align="center" width="180"> |
|
|
@ -476,6 +476,32 @@ export default { |
|
|
|
this.getList() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 合计 |
|
|
|
getSummaries(param) { |
|
|
|
const { columns, data } = param |
|
|
|
const sums = [] |
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
sums[index] = '合计' |
|
|
|
return |
|
|
|
} |
|
|
|
const values = data.map(item => Number(item[column.property])) |
|
|
|
if (column.property === 'manufactorSettlementPrice' || column.property === 'freight' || column.property === 'estimateRebate' || column.property === 'expectCost' || column.property === 'uploadMoney' || column.property === 'secondaryUploadMoney' || column.property === 'stayDetermineMoney' || column.property === 'money' || column.property === 'diffAmount' || column.property === 'adjustmentMoney') { |
|
|
|
sums[index] = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr) |
|
|
|
if (!isNaN(value)) { |
|
|
|
return Math.round((parseFloat(prev) + parseFloat(curr)) * 100) / 100 |
|
|
|
} else { |
|
|
|
return Math.round((parseFloat(prev)) * 100) / 100 |
|
|
|
} |
|
|
|
}, 0) |
|
|
|
sums[index] += '' |
|
|
|
} else { |
|
|
|
sums[index] = '' |
|
|
|
} |
|
|
|
}) |
|
|
|
return sums |
|
|
|
}, |
|
|
|
resetState() { |
|
|
|
this.viewState = 1 |
|
|
|
}, |
|
|
|