From dc91db9bb3473c3ed058f86f74359e15c035a8a5 Mon Sep 17 00:00:00 2001
From: zhengpz <1838927346@qq.com>
Date: Mon, 23 Aug 2021 22:13:10 +0800
Subject: [PATCH] 表查询完善

---
 src/views/statisticalQueryManagement/businessStatisticsDetail.vue |  179 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 109 insertions(+), 70 deletions(-)

diff --git a/src/views/statisticalQueryManagement/businessStatisticsDetail.vue b/src/views/statisticalQueryManagement/businessStatisticsDetail.vue
index 255caf1..69e6013 100644
--- a/src/views/statisticalQueryManagement/businessStatisticsDetail.vue
+++ b/src/views/statisticalQueryManagement/businessStatisticsDetail.vue
@@ -2,28 +2,39 @@
   <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"
     >
     </avue-crud>
   </basic-container>
 </template>
 <script>
-// import FileSaver from "file-saver";
-// import XLSX from "xlsx";
 import { mapGetters } from "vuex";
 import {
   selectDis,
   selectFw
 } from "../../api/statisticalQueryManagement/statisticalQueryManagement";
+import { lazyTreeJu } from "../../api/index/index";
 export default {
   name: "业务情况统计明细",
   data() {
     return {
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      query: {},
       value1: "",
       value2: "",
       tableData: [
@@ -85,8 +96,8 @@
           {
             label: "公司名称",
             prop: "gsname",
-            search: true,
-            searchSpan: 4,
+            // search: true,
+            // searchSpan: 4,
             display: false
           },
 
@@ -94,36 +105,15 @@
             label: "所属辖区",
             prop: "jurname",
             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,
+            type: "tree",
             rules: [
               {
                 required: true,
@@ -145,16 +135,29 @@
           {
             label: "服务单位名称",
             prop: "fwname",
+            props: {
+              label: "name",
+              value: "id"
+            },
+            dicData: [],
             searchLabelWidth: 110,
             search: true,
+            type: "tree",
             searchSpan: 4,
-            display: false
+            rules: [
+              {
+                required: true,
+                message: "请选择服务单位",
+                trigger: "blur"
+              }
+            ]
+            // display: false
           },
           {
             label: "保安派遣人数",
             prop: "num",
             display: false
-          },
+          }
           // {
           //   label: "备注",
           //   prop: "bz",
@@ -225,52 +228,88 @@
     }
   },
   methods: {
-    dateChange() {},
-    getTableData() {
-      let params = {
-        jurisdiction: "",
-        current: 1,
-        fid: 20,
-        deptid: "1412222709480509442",
-        size: 10
-      };
-      selectDis(params).then(res => {
-        if (res.data.code === 200) {
-          this.tableData = res.data.data;
-          this.loading = false;
-        }
+    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;
+      this.onLoad(this.page, this.query);
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+      this.onLoad(this.page, this.query);
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      let param = {};
+      param["jurisdiction"] = params["jurname"] || "";
+      param["fid"] = params["fwname"] || "";
+      param["deptid"] = params["deptid"] || "1425365559645601794";
+      param["current"] = page.currentPage;
+      param["size"] = page.pageSize;
+      selectDis(param).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.tableData = data.records;
+        this.loading = false;
       });
     },
     getFuWuList() {
       selectFw().then(res => {
         if (res.data.code === 200) {
-          this.servicesList = res.data.data;
+          this.tableOption.column.forEach(item => {
+            if (item.label == "服务单位名称") {
+              item.dicData = res.data.data;
+            }
+          });
+          // this.servicesList = res.data.data;
         }
       });
+    },
+    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);
+        }
+      });
+    },
+    getLocationParams() {
+      // let url = window.location.href;
+      // let urlArr = url.split("?")[1].split("&");
+      // var object = new Object();
+      // for (var i = 0; i < urlArr.length; i++) {
+      //   let mm = urlArr[i].split("=");
+      //   object[decodeURIComponent(mm[0])] = decodeURIComponent(mm[1]);
+      // }
+      // let jurisdiction = object["jurisdiction1"] || "";
+      // let enterpriseName = object["enterpriseName"] || "";
+      // let obj = { jurisdiction: jurisdiction, enterpriseName: enterpriseName };
+      // this.onLoad(this.page, obj);
+      this.onLoad(this.page, this.query);
     }
-    // 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.getTableData();
     this.getFuWuList();
+    this.getSubOfficeData();
+    this.getLocationParams();
   }
 };
 </script>

--
Gitblit v1.9.3