From 493ef0c05b05606dc74219ce3f4d3301ec85ad0d Mon Sep 17 00:00:00 2001
From: zhengpz <1838927346@qq.com>
Date: Sun, 22 Aug 2021 20:14:21 +0800
Subject: [PATCH] 研判模块表跳转传参

---
 src/views/securityUnitOperation/economicTable.vue |  150 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 110 insertions(+), 40 deletions(-)

diff --git a/src/views/securityUnitOperation/economicTable.vue b/src/views/securityUnitOperation/economicTable.vue
index cf7fa57..b149b5a 100644
--- a/src/views/securityUnitOperation/economicTable.vue
+++ b/src/views/securityUnitOperation/economicTable.vue
@@ -2,12 +2,18 @@
   <basic-container>
     <avue-crud
       :option="tableOption"
-      :data="tableData"
       :table-loading="loading"
-      :page.sync="tablePage"
+      :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>
@@ -17,10 +23,16 @@
 import XLSX from "xlsx";
 import { mapGetters } from "vuex";
 import { selectJj } from "../../api/securityUnitOperation/securityUnitOperation";
+import { lazyTreeJu } from "../../api/index/index";
 export default {
   name: "公司经济情况智能分析详情表",
   data() {
     return {
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
       value1: "",
       value2: "",
       tableData: [
@@ -55,11 +67,6 @@
         //   bz: ""
         // }
       ],
-      tablePage: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0
-      },
       tableOption: {
         excelBtn: true,
         delBtn: false,
@@ -135,35 +142,14 @@
             label: "所属辖区",
             prop: "jurname",
             searchSpan: 4,
-            type: "select",
+            type: "tree",
             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: [
               {
@@ -273,18 +259,102 @@
     }
   },
   methods: {
-    dateChange() {},
-    getTableData() {
-      selectJj({ current: 1, size: 10 }).then(res => {
+    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;
+      let param = {};
+      param["jurisdiction"] = params["jurisdiction"] || "";
+      param["enterpriseName"] = params["enterpriseName"] || "";
+      param["current"] = page.currentPage;
+      param["size"] = page.pageSize;
+      selectJj(param).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.tableData = res.data.data;
+        this.loading = false;
+      });
+    },
+    getSubOfficeData() {
+      lazyTreeJu().then(res => {
         if (res.data.code === 200) {
-          this.tableData = res.data.data;
-          this.loading = false;
+          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["jurisdiction"] || "";
+      let enterpriseName = object["enterpriseName"] || "";
+      let obj = { jurisdiction: jurisdiction, enterpriseName: enterpriseName };
+      this.onLoad(this.page, obj);
     }
   },
   mounted() {
-    this.getTableData();
+    this.getLocationParams();
+    this.getSubOfficeData();
   }
 };
 </script>

--
Gitblit v1.9.3