From 8eccc9770ab63dc608c4d0bdc520f69e2f0ba065 Mon Sep 17 00:00:00 2001
From: zhengpz <1838927346@qq.com>
Date: Sun, 22 Aug 2021 20:57:27 +0800
Subject: [PATCH] 表完善

---
 src/views/statisticalQueryManagement/businessStatistics.vue |  134 +++++++++++++++++++++++---------------------
 1 files changed, 69 insertions(+), 65 deletions(-)

diff --git a/src/views/statisticalQueryManagement/businessStatistics.vue b/src/views/statisticalQueryManagement/businessStatistics.vue
index 193f143..62103cf 100644
--- a/src/views/statisticalQueryManagement/businessStatistics.vue
+++ b/src/views/statisticalQueryManagement/businessStatistics.vue
@@ -2,12 +2,19 @@
   <basic-container>
     <avue-crud
       :option="tableOption"
-      :data="tableData"
-      :page.sync="tablePage"
       :table-loading="loading"
+      :data="tableData"
+      :page.sync="page"
       :permission="permissionList"
-      :before-open="beforeOpen"
-      @date-change="dateChange"
+      ref="crud"
+      @row-update="rowUpdates"
+      @row-save="rowSave"
+      @search-change="searchChange"
+      @search-reset="searchReset"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
       @cell-click="handleRowClick"
       :cell-style="cellStyle"
       class="businessStatisticsStyle"
@@ -20,10 +27,16 @@
 import XLSX from "xlsx";
 import { mapGetters } from "vuex";
 import { selectYw } from "../../api/statisticalQueryManagement/statisticalQueryManagement";
+import { lazyTreeJu } from "../../api/index/index";
 export default {
   name: "业务情况统计",
   data() {
     return {
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
       value1: "",
       value2: "",
       tableData: [
@@ -46,11 +59,6 @@
         //   num: "974"
         // }
       ],
-      tablePage: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0
-      },
       tableOption: {
         excelBtn: true,
         delBtn: false,
@@ -84,33 +92,10 @@
             searchSpan: 4,
             type: "select",
             props: {
-              label: "label",
-              value: "value"
+              label: "title",
+              value: "id"
             },
-            // cascaderItem: ["city", "area"],
-            // dicUrl:subofficeOptions,
-            dicData: [
-              {
-                value: "0",
-                label: "南昌市公安局"
-              },
-              {
-                value: "2",
-                label: "东湖分局"
-              },
-              {
-                value: "3",
-                label: "西湖分局"
-              },
-              {
-                value: "4",
-                label: "青云谱分局"
-              },
-              {
-                value: "5",
-                label: "青山湖分局"
-              }
-            ],
+            dicData: [],
             search: true,
             rules: [
               {
@@ -132,7 +117,7 @@
           }
         ]
       },
-       loading:true,
+      loading: true
     };
   },
   computed: {
@@ -147,6 +132,53 @@
     }
   },
   methods: {
+    getSubOfficeData() {
+      lazyTreeJu().then(res => {
+        if (res.data.code === 200) {
+          this.tableOption.column.forEach(item => {
+            if (item.label == "所属辖区") {
+              item.dicData = res.data.data;
+            }
+          });
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+     searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      let param = {};
+      param["jurisdiction"] = params["jurname"] ? params["jurname"] : "";
+      param["deptid"] = "";
+      param["current"] = page.currentPage;
+      param["size"] = page.pageSize;
+      selectYw(param).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.tableData = res.data.data;
+        this.loading = false;
+      });
+    },
     handleRowClick(row, column, cell, event) {
       if (column.label == "服务对象数量" || column.label == "保安员人数") {
         this.$router.push({
@@ -158,37 +190,9 @@
       // if (columnIndex == 4 || columnIndex == 5) {
       // }
     },
-    dateChange() {},
-    getTableData() {
-      selectYw({current: 1, size: 10 }).then(res => {
-        if (res.data.code === 200) {
-          this.tableData = res.data.data;
-          this.loading = false;
-        }
-      });
-    }
-    // downExcel() {
-    //   let et = XLSX.utils.table_to_book(document.getElementById("table"));
-    //   let etout = XLSX.write(et, {
-    //     bookType: "xlsx",
-    //     bookSST: true,
-    //     type: "array"
-    //   });
-    //   try {
-    //     FileSaver.saveAs(
-    //       new Blob([etout], {
-    //         type: "application/octet-stream"
-    //       }),
-    //       `表.xlsx`
-    //     ); //导出的文件名
-    //   } catch (e) {
-    //     console.log(e, etout);
-    //   }
-    //   return etout;
-    // }
   },
   mounted() {
-    this.getTableData();
+    this.getSubOfficeData();
   }
 };
 </script>

--
Gitblit v1.9.3