QuKatie 3 anos atrás
pai
commit
b015ffe497

Diferenças do arquivo suprimidas por serem muito extensas
+ 358 - 328
src/views/finance/otherFinancial/index.vue


+ 32 - 1
src/views/finance/payment/add-or-update.vue

@@ -12,10 +12,13 @@
           :data="tableData"
           style="width: 100%"
           @selection-change="selectionChange"
+          show-summary
+          :summary-method="getSummaries"
         >
           <el-table-column
             type="selection"
-            width="50"
+            align="center"
+            width="55"
             :selectable="selectable"
           />
           <el-table-column label="序号" type="index" width="50" />
@@ -99,6 +102,34 @@ export default {
     selectionChange(rows) {
       this.selectionList = rows;
     },
+    getSummaries(param) {
+      const { columns, data } = param;
+      console.log(columns)
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "合计";
+          return;
+        }
+        const values = this.selectionList.map((item) => Number(item[column.property]));
+        if (
+          column.property === "fQty" ||
+          column.property === "fAmtdr" ||
+          column.property === "fAmt"
+        ) {
+          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);
+        }
+      });
+      return sums;
+    },
     importDate() {
       if (this.selectionList.length == 0) {
         return this.$message.error("请选择数据");

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff