From 2d50c51214f0ced8c992a415c72ea33b519fff59 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 03 Sep 2021 15:53:05 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhba_regulatory

---
 src/views/statisticalQueryManagement/businessStatistics.vue |  257 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 163 insertions(+), 94 deletions(-)

diff --git a/src/views/statisticalQueryManagement/businessStatistics.vue b/src/views/statisticalQueryManagement/businessStatistics.vue
index 2b3db34..0919ab9 100644
--- a/src/views/statisticalQueryManagement/businessStatistics.vue
+++ b/src/views/statisticalQueryManagement/businessStatistics.vue
@@ -2,12 +2,22 @@
   <basic-container>
     <avue-crud
       :option="tableOption"
+      :table-loading="loading"
       :data="tableData"
-      :page.sync="tablePage"
+      :page.sync="page"
       :permission="permissionList"
-      :before-open="beforeOpen"
-      @date-change="dateChange"
-      @row-click="handleRowClick"
+      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"
     >
     </avue-crud>
   </basic-container>
@@ -16,37 +26,42 @@
 import FileSaver from "file-saver";
 import XLSX from "xlsx";
 import { mapGetters } from "vuex";
+import {
+  selectYw,
+  dictionaryList
+} from "../../api/statisticalQueryManagement/statisticalQueryManagement";
+import { lazyTreeJu,lazyTrees } from "../../api/index/index";
 export default {
   name: "业务情况统计",
   data() {
     return {
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
       value1: "",
       value2: "",
       tableData: [
-        {
-          company: "江西省永安保安服务有限公司",
-          subOffice: "南昌市公安局",
-          customer: "76",
-          num: "1124",
-        },
-        {
-          company: "南昌市赣水保安服务有限公司",
-          subOffice: "东湖分局",
-          customer: "85",
-          num: "1428",
-        },
-        {
-          company: "江西中业兴达保安服务有限公司",
-          subOffice: "西湖分局",
-          customer: "46",
-          num: "974",
-        },
+        // {
+        //   company: "江西省永安保安服务有限公司",
+        //   subOffice: "南昌市公安局",
+        //   customer: "76",
+        //   num: "1124"
+        // },
+        // {
+        //   company: "南昌市赣水保安服务有限公司",
+        //   subOffice: "东湖分局",
+        //   customer: "85",
+        //   num: "1428"
+        // },
+        // {
+        //   company: "江西中业兴达保安服务有限公司",
+        //   subOffice: "西湖分局",
+        //   customer: "46",
+        //   num: "974"
+        // }
       ],
-      tablePage: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0,
-      },
       tableOption: {
         excelBtn: true,
         delBtn: false,
@@ -68,66 +83,56 @@
         column: [
           {
             label: "公司名称",
-            prop: "company",
+            prop: "enterpriseName",
+            search: true,
+            searchSpan: 4,
+            display: false
+          },
+          {
+            label: "单位类型",
+            prop: "stats",
             search: true,
             searchSpan: 4,
             display: false,
-          },
-
-          {
-            label: "所属辖区",
-            prop: "subOffice",
-            searchSpan: 4,
             type: "select",
             props: {
-              label: "label",
-              value: "value",
+              label: "dictValue",
+              value: "dictKey"
             },
-            // cascaderItem: ["city", "area"],
-            // dicUrl:subofficeOptions,
-            dicData: [
-              {
-                value: "0",
-                label: "南昌市公安局",
-              },
-              {
-                value: "2",
-                label: "东湖分局",
-              },
-              {
-                value: "3",
-                label: "西湖分局",
-              },
-              {
-                value: "4",
-                label: "青云谱分局",
-              },
-              {
-                value: "5",
-                label: "青山湖分局",
-              },
-            ],
+            dicData: []
+          },
+          {
+            label: "所属辖区",
+            prop: "jurname",
+            searchSpan: 4,
+            type: "tree",
+            props: {
+              label: "title",
+              value: "id"
+            },
+            dicData: [],
             search: true,
             rules: [
               {
                 required: true,
                 message: "请选择所属辖区",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "服务对象数量",
-            prop: "customer",
-            display: false,
+            prop: "fwnum",
+            display: false
           },
           {
             label: "保安员人数",
-            prop: "num",
-            display: false,
-          },
-        ],
+            prop: "znum",
+            display: false
+          }
+        ]
       },
+      loading: true
     };
   },
   computed: {
@@ -137,37 +142,101 @@
         addBtn: this.vaildData(this.permission.post_add, false),
         viewBtn: this.vaildData(this.permission.post_view, false),
         delBtn: this.vaildData(this.permission.post_delete, false),
-        editBtn: this.vaildData(this.permission.post_edit, false),
+        editBtn: this.vaildData(this.permission.post_edit, false)
       };
-    },
+    }
   },
   methods: {
-    handleRowClick(row, event, column) {
-      this.$router.push({ path: "/statisticalQueryManagement/businessStatisticsDetail" });
+    getSubOfficeData() {
+      lazyTrees().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);
+        }
+      });
     },
-    dateChange() {},
-    // 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;
-    // }
+    getDictionaryList() {
+      dictionaryList().then(res => {
+        if (res.data.code === 200) {
+          this.tableOption.column.forEach(item => {
+            if (item.label == "单位类型") {
+              item.dicData = res.data.data;
+            }
+          });
+        }
+      });
+    },
+    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["deptid"] = params["enterpriseName"] || "";
+      param["stats"] = params["stats"] || "";
+      param["current"] = page.currentPage;
+      param["size"] = page.pageSize;
+      selectYw(param).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.tableData = data.records;
+        this.loading = false;
+      });
+    },
+    handleRowClick(row, column, cell, event) {
+      if (column.label == "服务对象数量") {
+        this.$router.push({
+          path:
+            "/statisticalQueryManagement/businessStatisticsDetail?&departmentid=" +
+            row.departmentid
+        });
+      } else if (column.label == "保安员人数") {
+        this.$router.push({
+          path:
+            "/statisticalQueryManagement/securityGuardDetail?departmentid=" +
+            row.departmentid
+        });
+      }
+    },
+    cellStyle(row, column, rowIndex, columnIndex) {
+      // if (columnIndex == 4 || columnIndex == 5) {
+      // }
+    }
   },
-  mounted() {},
+  mounted() {
+    this.getSubOfficeData();
+    this.getDictionaryList();
+  }
 };
 </script>
 <style lang="scss" scoped>
+/deep/ .businessStatisticsStyle .el-table__row:hover td:nth-child(7),
+/deep/ .businessStatisticsStyle .el-table__row:hover td:nth-child(6) {
+  cursor: pointer !important;
+}
 </style>

--
Gitblit v1.9.3