From 5ee0d36e051d591f930ba93ba660e45f10710c3f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期四, 05 五月 2022 13:30:31 +0800
Subject: [PATCH] bug修复

---
 src/views/equipmentManagement/equipmentList/components/Content.vue |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/src/views/equipmentManagement/equipmentList/components/Content.vue b/src/views/equipmentManagement/equipmentList/components/Content.vue
index 8194efc..f3ef7b6 100644
--- a/src/views/equipmentManagement/equipmentList/components/Content.vue
+++ b/src/views/equipmentManagement/equipmentList/components/Content.vue
@@ -34,6 +34,9 @@
 import AMapLoader from "@amap/amap-jsapi-loader";
 import InfoCard from "@/views/equipmentManagement/equipmentList/components/InfoCard";
 import FormList from "@/views/equipmentManagement/equipmentList/components/FormList";
+
+import bus from "@/plugin/bus";
+
 export default {
   created() {
     window._AMapSecurityConfig = {
@@ -41,9 +44,16 @@
     };
   },
   mounted() {
-    this.searchingBtn();
-    //DOM鍒濆鍖栧畬鎴愯繘琛屽湴鍥惧垵濮嬪寲
+    this.initMap("");
+    bus.$on("refleshNode", (node) => {
+      this.nodes = node;
+      this.initNode();
+    });
   },
+  beforeDestroy() {
+    bus.$off("refleshNode");
+  },
+
   components: {
     InfoCard, //璁惧淇℃伅寮瑰眰
     FormList, //琛ㄦ牸
@@ -59,6 +69,7 @@
       center: [116.06157, 39.66157], //鍦板浘涓績
       activeNode: null, //閫変腑鐨勫湴鍥捐妭鐐�
       geocoder: {},
+      myMaker: null,
     };
   },
 
@@ -91,6 +102,9 @@
     },
     //鍒濆鍖栬妭鐐�
     initNode() {
+      if (this.myMaker) {
+        this.myMaker.destroy();
+      }
       this.nodes.filter((item, index) => {
         //鏌ヨ琛屾斂浣嶇疆
         this.geocoder.getAddress([item.lon, item.lat], (status, result) => {
@@ -123,6 +137,7 @@
           });
 
           this.map.add(marker);
+          this.myMaker = marker;
         });
       });
     },
@@ -143,25 +158,6 @@
         this.isFull = false;
       }
       this.initMap(status);
-    },
-
-    // 鏌ヨ鍒楄〃
-    searchingBtn() {
-      let param = {
-        page: 1,
-        size: 999,
-        // startTime: this.searchTime[0],
-        // endTime: this.searchTime[1],
-        inputText: "",
-      };
-      findDevList(param)
-        .then((res) => {
-          this.nodes = res.data.list;
-          this.initMap("");
-        })
-        .catch((err) => {
-          console.log(err);
-        });
     },
   },
 };

--
Gitblit v1.8.0