Browse Source

付费申请 弹窗新加合计

Qukatie 6 months ago
parent
commit
b836c980b8
1 changed files with 31 additions and 3 deletions
  1. 31 3
      src/views/iosBasicData/PaymentApplication/assembly/searchPopup.vue

+ 31 - 3
src/views/iosBasicData/PaymentApplication/assembly/searchPopup.vue

@@ -5,7 +5,7 @@
             :close-on-click-modal="false">
             <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" id="out-table"
                 :header-cell-class-name="headerClassName" @search-change="searchChange" @search-reset="searchReset"
-                @selection-change="selectionChange" :search.sync="query">
+                @selection-change="selectionChange" :search.sync="query" :summary-method="summaryMethod">
                 <template slot="menuLeft">
                     <div style="display:flex;">
                         <el-tabs v-model="activeName" @tab-click="handleClick">
@@ -115,6 +115,7 @@ export default {
                 // header: false,
                 tip: false,
                 selection: true,
+                showSummary: true,
                 selectable: (row, index) => {
                     return !row.disabled
                 },
@@ -274,6 +275,26 @@ export default {
         // this.option = await this.getColumnData(this.getColumnName(309.6), this.optionBack);
     },
     methods: {
+        // 合计计算
+        summaryMethod({ columns, data }) {
+            const sums = [];
+            if (columns.length > 0) {
+                columns.forEach((item, index) => {
+                    let prop = item.property
+                    sums[0] = '合计'
+                    if (['currentStlAmountRMB', 'currentStlAmountUSD'].includes(prop)) {
+                        let values = this.selectionList.map(item => Number(item[prop] || 0));
+                        let all = values.length !== 0 ? sums[index] = values.reduce((a, b) => {
+                            return a + b;
+                        }) : 0
+                        if (prop == 'currentStlAmountRMB' || prop == 'currentStlAmountUSD') {
+                            sums[index] = all
+                        }
+                    }
+                })
+            }
+            return sums;
+        },
         handleClick(val) {
             if (this.activeName == 'query') {
                 this.data = this.queryData
@@ -291,7 +312,7 @@ export default {
                 this.$set(item, 'disabled', true)
                 this.pickData.push(item)
                 this.data = this.data.filter(row => row.accBillNo != item.accBillNo);
-                this.queryData=this.data
+                this.queryData = this.data
             })
         },
         allCancel() {
@@ -299,7 +320,7 @@ export default {
                 this.$set(item, 'disabled', false)
                 this.queryData.push(item)
                 this.data = this.data.filter(row => row.accBillNo != item.accBillNo);
-                this.pickData=this.data
+                this.pickData = this.data
             })
         },
         pick(row, index) {
@@ -567,6 +588,9 @@ export default {
                     this.data = arr
 
                 }).finally(() => {
+                    this.$nextTick(() => {
+                        this.$refs.crud.doLayout();
+                    });
                     this.loading = false;
                 })
             }
@@ -669,4 +693,8 @@ export default {
 ::v-deep .el-col-md-8 {
     width: 24.33333%;
 }
+
+::v-deep .el-dialog__body {
+    padding: 6px 20px !important;
+}
 </style>