caojunjie 1 rok temu
rodzic
commit
754b215da8
1 zmienionych plików z 57 dodań i 4 usunięć
  1. 57 4
      src/components/bill/billDetailList.vue

+ 57 - 4
src/components/bill/billDetailList.vue

@@ -2,7 +2,7 @@
   <div>
     <avue-crud :option="option" :table-loading="loading" :data="data" :search.sync="search" ref="crud"
       @refresh-change="refreshChange" @selection-change="selectionChange" @search-change="searchChange"
-      @saveColumn="saveColumn" :page.sync="page" @on-load="onLoad">
+      @saveColumn="saveColumn" :page.sync="page" @on-load="onLoad" :summary-method="summaryMethod">
       <template slot="costTypeSearch">
         <breakdown-select v-model="search.costType" :configuration="breakConfiguration"></breakdown-select>
       </template>
@@ -34,6 +34,7 @@
 <script>
 import option from './config/mainList.json'
 import { getBillList } from "@/api/financialManagement/paymentRequest";
+import _ from "lodash";
 
 export default {
   name: "index",
@@ -93,6 +94,52 @@ export default {
     // this.option = await this.getColumnData(this.getColumnName(45), option);
   },
   methods: {
+      // 合计计算
+      summaryMethod({ columns, data }) {
+          const sums = [];
+          if (columns.length > 0) {
+              columns.forEach((item, index) => {
+                  sums[0] = '合计'
+                  // 选择要合计的参数
+                  if (
+                      item.property == "amount" ||
+                      item.property == "settlementAmount" ||
+                      item.property == "invoiceAmount"
+                  ) {
+                      let amountSum = 0;
+                      let settlementAmountSum = 0;
+                      let invoiceAmountSum = 0;
+                      if (this.goodsListSave.length > 0) {
+                          this.goodsListSave.forEach(e => {
+                              amountSum = _.add(amountSum, Number(e.amount));
+                              settlementAmountSum = _.add(settlementAmountSum, Number(e.settlementAmount));
+                              invoiceAmountSum = _.add(invoiceAmountSum, Number(e.invoiceAmount));
+                          })
+                      } else {
+                          this.data.forEach(e => {
+                              amountSum = _.add(amountSum, Number(e.amount));
+                              settlementAmountSum = _.add(settlementAmountSum, Number(e.settlementAmount));
+                              invoiceAmountSum = _.add(invoiceAmountSum, Number(e.invoiceAmount));
+                          })
+                      }
+                      // 结算金额合计
+                      if (item.property == "settlementAmount") {
+                          sums[index] = settlementAmountSum ? settlementAmountSum.toFixed(0) : "0.00";
+                      }
+                      // 开票金额合计
+                      if (item.property == "invoiceAmount") {
+                          sums[index] = invoiceAmountSum ? invoiceAmountSum.toFixed(0) : "0.00";
+                      }
+                      // 金额合计
+                      if (item.property == "amount") {
+                          sums[index] = amountSum ? amountSum.toFixed(2) : "0.00";
+                      }
+                  }
+              })
+          }
+          return sums;
+      },
+
     importStagList(row, index) {
       // this.goodsListSave.push(row);
       this.$refs.crud.toggleSelection([row]);
@@ -130,12 +177,18 @@ export default {
     },
     onLoad(page, params) {
 
+          // 堆存日期搜索
       if(params && params.rentStartDate ){
-        params.createStartDate = params.rentStartDate[0] + " " + "00:00:00"?params.rentStartDate[0] + " " + "00:00:00":'';
-        params.createEndDate = params.rentStartDate[1] + " " + "23:59:59"?params.rentStartDate[1] + " " + "23:59:59":'';
+        params.rentStartDateList = params.rentStartDate
         this.$delete(params, 'rentStartDate')
       }
-       
+      // 生成账单日期搜索
+        if(params && params.createTime ){
+            params.createStartDate = params.createTime[0] + " " + "00:00:00"?params.createTime[0] + " " + "00:00:00":'';
+            params.createEndDate = params.createTime[1] + " " + "23:59:59"?params.createTime[1] + " " + "23:59:59":'';
+            this.$delete(params, 'createTime')
+        }
+
       this.loading = true;
       params = {
         ...params,