From b6d9bbb38cc344d1538439750c3db5a4a6b0d79a Mon Sep 17 00:00:00 2001
From: zhengpz <1838927346@qq.com>
Date: Sun, 22 Aug 2021 17:53:53 +0800
Subject: [PATCH] 首页及表完善

---
 src/views/statisticalQueryManagement/securityGuardStatistics.vue |  217 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 155 insertions(+), 62 deletions(-)

diff --git a/src/views/statisticalQueryManagement/securityGuardStatistics.vue b/src/views/statisticalQueryManagement/securityGuardStatistics.vue
index 5a9e63c..e11611d 100644
--- a/src/views/statisticalQueryManagement/securityGuardStatistics.vue
+++ b/src/views/statisticalQueryManagement/securityGuardStatistics.vue
@@ -2,12 +2,19 @@
   <basic-container>
     <avue-crud
       :option="tableOption"
+      :table-loading="loading"
       :data="tableData"
-      :page.sync="tablePage"
-       :table-loading="loading"
+      :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"
       @row-click="handleRowClick"
       class="rowClick"
     >
@@ -19,10 +26,17 @@
 import XLSX from "xlsx";
 import { mapGetters } from "vuex";
 import { selectLi } 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: [
@@ -63,11 +77,6 @@
         //   socialSecurity: "21535",
         // },
       ],
-      tablePage: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0,
-      },
       tableOption: {
         align: "center",
         viewBtn: true,
@@ -93,7 +102,7 @@
             prop: "deptname",
             search: true,
             searchSpan: 4,
-            display: false,
+            display: false
           },
           {
             label: "所属辖区",
@@ -101,71 +110,71 @@
             searchSpan: 4,
             type: "select",
             props: {
-              label: "label",
-              value: "value",
+              label: "title",
+              value: "value"
             },
-            // cascaderItem: ["city", "area"],
-            // dicUrl:subofficeOptions,
+            // dicUrl: "/api/information/lazyTreeJu",
+            // dicMethod:'post',
             dicData: [
-              {
-                value: "0",
-                label: "南昌市公安局",
-              },
-              {
-                value: "2",
-                label: "东湖分局",
-              },
-              {
-                value: "3",
-                label: "西湖分局",
-              },
-              {
-                value: "4",
-                label: "青云谱分局",
-              },
-              {
-                value: "5",
-                label: "青山湖分局",
-              },
+              // {
+              //   value: "0",
+              //   label: "南昌市公安局"
+              // },
+              // {
+              //   value: "2",
+              //   label: "东湖分局"
+              // },
+              // {
+              //   value: "3",
+              //   label: "西湖分局"
+              // },
+              // {
+              //   value: "4",
+              //   label: "青云谱分局"
+              // },
+              // {
+              //   value: "5",
+              //   label: "青山湖分局"
+              // }
             ],
             search: true,
             rules: [
               {
                 required: true,
                 message: "请选择所属辖区",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "保安员总数",
             prop: "num",
-            display: false,
+            display: false
           },
           {
             label: "持证上岗人数",
             prop: "cznum",
-            display: false,
+            display: false
           },
           {
             label: "未派遣人数",
             prop: "wpaiqnum",
-            display: false,
+            display: false
           },
           {
             label: "派遣人数",
             prop: "paiqnum",
-            display: false,
+            display: false
           },
           {
             label: "未采集照片人数",
             prop: "wcaijnum",
-            display: false,
+            display: false
           },
           {
             label: "资格审查异常人数",
             prop: "yicnum",
-            display: false,
+            display: false
           },
           // {
           //   label: "过考保安人数",
@@ -175,12 +184,12 @@
           {
             label: "缴纳社保人数",
             prop: "sbnum",
-            display: false,
-          },
-        ],
+            display: false
+          }
+        ]
       },
       companyName: "",
-      loading:true,
+      loading: true
     };
   },
   computed: {
@@ -190,26 +199,110 @@
         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: {
+    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);
+        }
+      });
+    },
+    rowSave(row, done, loading) {
+      adddata(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        },
+        error => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowUpdates(row, index, done, loading) {
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        },
+        error => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    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;
+      // if (!params) {
+      //   params = { current: page.currentPage, size: page.pageSize };
+      // }
+      let param = {};
+      param["jurisdiction"] = params["jurname"] ? params["jurname"] : "";
+      param["deptid"] =  "";
+      param["current"] = page.currentPage;
+      param["size"] = page.pageSize;
+      selectLi(param).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.tableData = res.data.data;
+        // this.data = data.records;
+        console.log(this.data);
+        this.loading = false;
+        // this.selectionClear();
+      });
+    },
     // toCompanyDetails() {
     //   this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
     // },
     handleRowClick(row, event, column) {
       this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
     },
-    dateChange() {},
-    getTableData() {
-      selectLi({current: 1, size: 10 }).then(res => {
-        if (res.data.code === 200) {
-          this.tableData = res.data.data;
-          this.loading = false;
-        }
-      });
-    }
+    // getTableData() {
+    //   selectLi({ 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, {
@@ -231,12 +324,12 @@
     // }
   },
   mounted() {
-    this.getTableData();
-  },
+    this.getSubOfficeData();
+  }
 };
 </script>
-<style lang="scss" scoped> 
-/deep/ .rowClick .el-table__row:hover td{
+<style lang="scss" scoped>
+/deep/ .rowClick .el-table__row:hover td {
   cursor: pointer;
 }
 </style>

--
Gitblit v1.9.3