From 88e9acc00c5e9efa9be636c6083ea634ae04e889 Mon Sep 17 00:00:00 2001
From: zhengpz <11@qq.com>
Date: Fri, 30 Jul 2021 22:53:36 +0800
Subject: [PATCH] 对接接口

---
 src/views/securityUnitOperation/operationAnalysis.vue |  153 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 98 insertions(+), 55 deletions(-)

diff --git a/src/views/securityUnitOperation/operationAnalysis.vue b/src/views/securityUnitOperation/operationAnalysis.vue
index 9f4f237..927641f 100644
--- a/src/views/securityUnitOperation/operationAnalysis.vue
+++ b/src/views/securityUnitOperation/operationAnalysis.vue
@@ -16,21 +16,31 @@
               >
               </el-option>
             </el-select>
-            <el-select class="select1" v-model="value1" placeholder="请选择">
+            <el-select
+              class="select1"
+              v-model="value1"
+              placeholder="请选择"
+              @change="fenjuChange"
+            >
               <el-option
                 v-for="item in options1"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                :key="item.id"
+                :label="item.title"
+                :value="item.id"
               >
               </el-option>
             </el-select>
-            <el-select class="select2" v-model="value2" placeholder="请选择">
+            <el-select
+              class="select2"
+              v-model="value2"
+              placeholder="请选择"
+              @change="changeCompanys"
+            >
               <el-option
                 v-for="item in options2"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                :key="item.departmentid"
+                :label="item.enterpriseName"
+                :value="item.departmentid"
               >
               </el-option>
             </el-select>
@@ -105,11 +115,18 @@
 <script>
 import * as echarts from "echarts";
 import echartJs from "./securityEchart.js";
+import { lazyTreeJu } from "../../api/index/index";
+import {
+  queryCounts,
+  getCompanys,
+  queryYearKh,
+  queryYearG,
+} from "../../api/securityUnitOperation/securityUnitOperation";
 export default {
   data() {
     return {
-      value1: "1",
-      value2: "1",
+      value1: "",
+      value2: "",
       value0: "2012",
       options0: [
         {
@@ -137,64 +154,90 @@
           label: "2007年",
         },
       ],
-      options1: [
-        {
-          value: "1",
-          label: "南昌市公安局",
-        },
-        {
-          value: "2",
-          label: "东湖分局",
-        },
-        {
-          value: "3",
-          label: "西湖分局",
-        },
-        {
-          value: "4",
-          label: "青云谱分局",
-        },
-        {
-          value: "5",
-          label: "青山湖分局",
-        },
-      ],
-      options2: [
-        {
-          value: "1",
-          label: "江西省永安保安服务有限公司",
-        },
-        {
-          value: "2",
-          label: "南昌市赣水保安服务有限公司",
-        },
-        {
-          value: "3",
-          label: "江西中业兴达保安服务有限公司",
-        },
-      ],
+      options1: [],
+      options2: [],
     };
   },
   methods: {
     setEchart() {
       let data = [];
       let bottomEchart = echarts.init(document.getElementById("bottomEchart"));
-      bottomEchart.setOption(echartJs.bottomOption(data));
-      let middleEchart1 = echarts.init(
-        document.getElementById("middleEchart1")
-      );
-      middleEchart1.setOption(echartJs.middleOption1(data));
-      let middleEchart2 = echarts.init(
-        document.getElementById("middleEchart2")
-      );
-      middleEchart2.setOption(echartJs.middleOption2(data));
+      bottomEchart.setOption(echartJs.bottomOption1(data));
     },
     toOperationTable() {
       this.$router.push({ path: "/securityUnitOperation/operationTable" });
     },
+    getFenju() {
+      lazyTreeJu().then((res) => {
+        if (res.data.code === 200) {
+          this.options1 = res.data.data;
+          this.value1 = this.options1[0] ? this.options1[0].id : "";
+          this.getCompanys();
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    fenjuChange() {
+      this.getCompanys();
+    },
+    getCompanys() {
+      getCompanys({ jurisdiction: this.value1 }).then((res) => {
+        if (res.data.code === 200) {
+          this.options2 = res.data.data;
+          this.value2 = this.options2[0] ? this.options2[0].departmentid : "";
+          this.changeCompanys();
+        }
+      });
+    },
+    getQueryCounts() {
+      let params = {
+        jurisdiction: this.value1,
+        deptid: this.value2,
+      };
+      queryCounts(params).then((res) => {
+        if (res.data.code === 200) {
+          debugger;
+        }
+      });
+    },
+    getQueryYearKh() {
+      let params = {
+        jurisdiction: this.value1,
+        deptid: this.value2,
+      };
+      queryYearKh(params).then((res) => {
+        if (res.data.code === 200) {
+          let middleEchart2 = echarts.init(
+            document.getElementById("middleEchart2")
+          );
+          middleEchart2.setOption(echartJs.middleOption2(res.data.data));
+        }
+      });
+    },
+    getQueryYearG() {
+      let params = {
+        jurisdiction: this.value1,
+        deptid: this.value2,
+      };
+      queryYearG().then((res) => {
+        if (res.data.code === 200) {
+          let middleEchart1 = echarts.init(
+            document.getElementById("middleEchart1")
+          );
+          middleEchart1.setOption(echartJs.middleOption1(res.data.data));
+        }
+      });
+    },
+    changeCompanys() {
+      // this.getQueryCounts();
+      this.getQueryYearKh();
+      this.getQueryYearG();
+    },
   },
   mounted() {
     this.setEchart();
+    this.getFenju();
   },
 };
 </script>

--
Gitblit v1.9.3