|
@@ -84,7 +84,7 @@
|
|
|
<span class="span_text">{{ priceStatus }}</span>
|
|
|
</div>
|
|
|
|
|
|
- <el-table class="wenzi" :data="warehouseList.records" style="width: 100%; margin-top: 20px"
|
|
|
+ <el-table show-summary :summary-method="getSummaries" class="wenzi" :data="warehouseList.records" style="width: 100%; margin-top: 20px"
|
|
|
ref="warehouseList.records" @row-click="handleRowClick" @selection-change="handleSelectionChange">
|
|
|
<!-- <el-table-column
|
|
|
:selectable="selectInit"
|
|
@@ -448,6 +448,34 @@
|
|
|
this.showType = this.isShow
|
|
|
},
|
|
|
methods: {
|
|
|
+ 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 (!values.every(value => isNaN(value))) {
|
|
|
+ if(index==9||index==10){
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0).toFixed(2)
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ sums[index] = '';
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
onChange() {
|
|
|
this.$refs.upload
|
|
|
.handleSaveBill()
|