浏览代码

灌溉数据绑定

yf_zd 4 年之前
父节点
当前提交
181160d40a
共有 1 个文件被更改,包括 49 次插入49 次删除
  1. 49 49
      src/pages/plantGuard/irrigate/irrigate.vue

+ 49 - 49
src/pages/plantGuard/irrigate/irrigate.vue

@@ -480,55 +480,6 @@ export default {
           
           
         }
         }
       });
       });
-      this.map.clearMap();
-      this.equipData.forEach(item => {
-        if (item.type == 1) {
-          var icon = "../../../../static/images/irrigate/sbPhoto.png";
-          // var icon = '../../../../static/images/1111.gif'
-        } else if (item.type == 2) {
-          var icon = "../../../../static/images/irrigate/sfjPhoto.png";
-          // var icon = '../../../../static/images/icon5.svg'
-        } else if (item.type == 3) {
-          var icon = "../../../../static/images/irrigate/dcfPhoto.png";
-        } else if (item.type == 4) {
-          var icon = "../../../../static/images/irrigate/sqPhoto.png";
-        }
-        this.marker = new AMap.Marker({
-          position: new AMap.LngLat(item["lnglat"][0], item["lnglat"][1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
-          icon: icon,
-          offset: new AMap.Pixel(-13, -30),
-          title: item["name"]
-        });
-        this.markerList.push(this.marker);
-        //信息窗体
-        this.marker.content = item["name"];
-        AMap.event.addListener(this.marker, "click", event => {
-          this.markerClick(event, item);
-        });
-        AMap.event.addListener(this.map, "click", event => {
-          if (this.infoWindow) {
-            this.infoWindow.close();
-          }
-        });
-        // this.marker.on('click', this.markerClick);
-        // this.marker.emit('click', {target: this.marker,aa:123});
-      });
-      this.$nextTick(() => {
-        this.map.add(this.markerList);
-        this.map.setFitView();
-      });
-      this.infoWindow = new AMap.InfoWindow({
-        isCustom: true, //使用自定义窗体
-        offset: new AMap.Pixel(-105, -20)
-        // anchor:'bottom-righ'
-      });
-      this.$refs.wranPopUP.initialize({
-        currEquip: {},
-        visible: true,
-        infoWindow: this.infoWindow
-      });
-      this.infoWindow.setContent(this.$refs.wranPopUP.$el);
-      this.infoWindow.open(this.map, this.equipData[0].lnglat);
     },
     },
     // 渲染要素
     // 渲染要素
     renderEle() {
     renderEle() {
@@ -590,6 +541,55 @@ export default {
           this.ctrlScrollHeight = 132;
           this.ctrlScrollHeight = 132;
         }
         }
       });
       });
+      this.map.clearMap();
+      this.equipRelayList.forEach(item => {
+        if (item.type == 1) {
+          var icon = "../../../../static/images/irrigate/sbPhoto.png";
+          // var icon = '../../../../static/images/1111.gif'
+        } else if (item.type == 2) {
+          var icon = "../../../../static/images/irrigate/sfjPhoto.png";
+          // var icon = '../../../../static/images/icon5.svg'
+        } else if (item.type == 3) {
+          var icon = "../../../../static/images/irrigate/dcfPhoto.png";
+        } else if (item.type == 4) {
+          var icon = "../../../../static/images/irrigate/sqPhoto.png";
+        }
+        this.marker = new AMap.Marker({
+          position: new AMap.LngLat(item["lnglat"][0], item["lnglat"][1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+          icon: icon,
+          offset: new AMap.Pixel(-13, -30),
+          title: item["name"]
+        });
+        this.markerList.push(this.marker);
+        //信息窗体
+        this.marker.content = item["name"];
+        AMap.event.addListener(this.marker, "click", event => {
+          this.markerClick(event, item);
+        });
+        AMap.event.addListener(this.map, "click", event => {
+          if (this.infoWindow) {
+            this.infoWindow.close();
+          }
+        });
+        // this.marker.on('click', this.markerClick);
+        // this.marker.emit('click', {target: this.marker,aa:123});
+      });
+      this.$nextTick(() => {
+        this.map.add(this.markerList);
+        this.map.setFitView();
+      });
+      this.infoWindow = new AMap.InfoWindow({
+        isCustom: true, //使用自定义窗体
+        offset: new AMap.Pixel(-105, -20)
+        // anchor:'bottom-righ'
+      });
+      this.$refs.wranPopUP.initialize({
+        currEquip: {},
+        visible: true,
+        infoWindow: this.infoWindow
+      });
+      this.infoWindow.setContent(this.$refs.wranPopUP.$el);
+      this.infoWindow.open(this.map, this.equipData[0].lnglat);
     },
     },
     markerClick(event, item) {
     markerClick(event, item) {
       this.infoWindow = new AMap.InfoWindow({
       this.infoWindow = new AMap.InfoWindow({