From ffc31835fb765229c420db4a651abce3f8c832fc Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 03 Sep 2021 09:47:44 +0800
Subject: [PATCH] 冲突

---
 src/views/securityUnitOperation/economicAnalysis.vue |   45 +++++++++++++++++++++++++++++++--------------
 1 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/src/views/securityUnitOperation/economicAnalysis.vue b/src/views/securityUnitOperation/economicAnalysis.vue
index 327a2b2..be41faf 100644
--- a/src/views/securityUnitOperation/economicAnalysis.vue
+++ b/src/views/securityUnitOperation/economicAnalysis.vue
@@ -17,16 +17,19 @@
             </el-select> -->
             <el-select
               class="select1"
-              v-model="value1"
+              ref="treeForm"
+              v-model="node.title"
               placeholder="请选择"
-              @change="fenjuChange"
             >
-              <el-option
-                v-for="item in options1"
-                :key="item.id"
-                :label="item.title"
-                :value="item.id"
-              >
+              <el-option style="height: auto;" :value="node">
+                <el-tree
+                  :data="options1"
+                  default-expand-all
+                  node-key="id"
+                  @node-click="handleNodeClick"
+                  :props="props"
+                >
+                </el-tree>
               </el-option>
             </el-select>
             <el-select
@@ -99,7 +102,7 @@
 <script>
 import * as echarts from "echarts";
 import echartJs from "./securityEchart.js";
-import { lazyTreeJu } from "../../api/index/index";
+import { lazyTreeJu, lazyTrees } from "../../api/index/index";
 import {
   getCompanys,
   selectPCount,
@@ -156,10 +159,23 @@
       loading1: true,
       loading2: true,
       loading3: true,
-      enterpriseName: ""
+      enterpriseName: "",
+      props: {
+        children: "children",
+        label: "title",
+        value: "id"
+      },
+      node: {} //选中的记录
     };
   },
   methods: {
+    //点击节点
+    handleNodeClick(data) {
+      this.node = data;
+      this.value1 = data.id;
+      this.$refs.treeForm.blur();
+      this.getCompanys();
+    },
     toEconomicTable() {
       this.$router.push({
         path:
@@ -172,18 +188,19 @@
       });
     },
     getFenju() {
-      lazyTreeJu().then(res => {
+      this.options1 = [];
+      this.value1 = "";
+      this.node = {};
+      lazyTrees().then(res => {
         if (res.data.code === 200) {
           this.options1 = res.data.data;
           this.value1 = this.options1[0] ? this.options1[0].id : "";
+          this.node = this.options1[0];
           this.getCompanys();
         } else {
           this.$message.error(res.msg);
         }
       });
-    },
-    fenjuChange() {
-      this.getCompanys();
     },
     pieChange() {
       this.loading2 = true;

--
Gitblit v1.9.3