浏览代码

修改bug

qukaidi 3 年之前
父节点
当前提交
320eff7077
共有 2 个文件被更改,包括 67 次插入91 次删除
  1. 13 0
      src/api/statisticAnalysis/salesProfitN.js
  2. 54 91
      src/views/statisticAnalysis/salesProfitN/index.vue

+ 13 - 0
src/api/statisticAnalysis/salesProfitN.js

@@ -0,0 +1,13 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-purchase-sales/exportOrder/selSalesProfit',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size
+    }
+  })
+}

+ 54 - 91
src/views/statisticAnalysis/salesProfitN/index.vue

@@ -1,42 +1,19 @@
 <template>
   <div>
     <basic-container class="page-crad">
-      <avue-crud
-        ref="crud"
-        :option="option"
-        :data="dataList"
-        :page.sync="page"
-        :search.sync="search"
-        :cell-style="cellStyle"
-        @search-change="searchChange"
-        @current-change="currentChange"
-        @size-change="sizeChange"
-        @refresh-change="refreshChange"
-        @on-load="onLoad"
-        :table-loading="loading"
-        :summary-method="summaryMethod"
-        @saveColumn="saveColumn"
-        @resetColumn="resetColumn"
-        @search-criteria-switch="searchCriteriaSwitch"
-      >
+      <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
+        :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
+        @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
+        @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
         <template slot="menuLeft">
-          <el-button type="info" size="small" @click="outExport"
-            >导出</el-button
-          >
+          <el-button type="info" size="small" @click="outExport">导出</el-button>
         </template>
         <template slot="corpIdSearch">
           <crop-select v-model="search.corpId" corpType="KH"></crop-select>
         </template>
         <template slot="businesDateSearch">
-          <el-date-picker
-            v-model="search.businesDate"
-            type="daterange"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            format="yyyy-MM-dd"
-            value-format="yyyy-MM-dd HH:mm:ss"
-            :default-time="['00:00:00', '23:59:59']"
-          >
+          <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
+            format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
           </el-date-picker>
         </template>
       </avue-crud>
@@ -46,6 +23,7 @@
 
 <script>
 import { getToken } from "@/util/auth";
+import { getList } from "@/api/statisticAnalysis/salesProfitN"
 import _ from "lodash";
 export default {
   name: "index",
@@ -201,10 +179,8 @@ export default {
       }
     };
   },
-  filters: {
-    decimalFormat(num) {
-      return num ? Number(num).toFixed(2) : "0.00";
-    }
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(185), this.option);
   },
   methods: {
     cellStyle() {
@@ -235,66 +211,51 @@ export default {
       this.page.pageSize = val;
     },
     onLoad(page, params = {}) {
-      // this.loading = true;
-      // getList(
-      //   page.currentPage,
-      //   page.pageSize,
-      //   Object.assign(params, this.search)
-      // )
-      //   .then(res => {
-      //     if (res.data.data.records) {
-      //       res.data.data.records.forEach(e => {
-      //         e.itemLoading = true;
-      //       });
-      //     }
-      //     this.dataList = res.data.data.records ? res.data.data.records : [];
-      //     this.page.total = res.data.data.total;
-      //     if (this.page.total) {
-      //       this.option.height = window.innerHeight - 210;
-      //     }
-      //   })
-      //   .finally(() => {
-      //     this.loading = false;
-      //   });
+      this.loading = true;
+      getList(
+        page.currentPage,
+        page.pageSize,
+        Object.assign(params, this.search)
+      )
+        .then(res => {
+          if (res.data.data.records) {
+            res.data.data.records.forEach(e => {
+              e.itemLoading = true;
+            });
+          }
+          this.dataList = res.data.data.records ? res.data.data.records : [];
+          this.page.total = res.data.data.total;
+          if (this.page.total) {
+            this.option.height = window.innerHeight - 210;
+          }
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    //列保存触发
+    async saveColumn() {
+      const inSave = await this.saveColumnData(this.getColumnName(185), this.option);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    async resetColumn() {
+      this.option = this.option;
+      const inSave = await this.delColumnData(this.getColumnName(185), this.option);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
     },
-    editOpen(row) {},
     outExport() {
-      // if (!this.search.billType) {
-      //   return this.$message.error("请选择类别");
-      // }
-      // window.open(
-      //   `/api/blade-purchase-sales/exportOrder/exportProfit?${
-      //     this.website.tokenHeader
-      //   }=${getToken()}&billType=${this.search.billType}`
-      // );
+      window.open(
+        `/api/blade-purchase-sales/exportOrder/selPurchaseExport?${this.website.tokenHeader
+        }=${getToken()}&billType=${this.search.billType}`
+      );
     },
-    summaryMethod({ columns, data }) {
-      const sums = [];
-      // if (columns.length > 0) {
-      //   columns.forEach((item, index) => {
-      //     sums[0] = "合计";
-      //     if (item.property == "purchasePrice" || item.property == "amount") {
-      //       let amountSum = 0;
-      //       let purchaseAmountSum = 0;
-      //       data.forEach(e => {
-      //         amountSum = _.add(amountSum, Number(e.amount));
-      //         purchaseAmountSum = _.add(
-      //           purchaseAmountSum,
-      //           Number(e.purchasePrice)
-      //         );
-      //       });
-      //       //入库金额总计
-      //       if (item.property == "purchasePrice") {
-      //         sums[index] = micrometerFormat(purchaseAmountSum);
-      //       }
-      //       if (item.property == "amount") {
-      //         sums[index] = micrometerFormat(amountSum);
-      //       }
-      //     }
-      //   });
-      // }
-      return sums;
-    }
   }
 };
 </script>
@@ -303,9 +264,11 @@ export default {
 .page-crad ::v-deep .basic-container__card {
   height: 94.2vh;
 }
+
 ::v-deep .el-table__expanded-cell[class*="cell"] {
   padding: 0px;
 }
+
 .itemTable ::v-deep .el-table {
   width: 100%;
 }