Jelajahi Sumber

点击电井反向高亮

YaolongHan 4 tahun lalu
induk
melakukan
6280227f06
1 mengubah file dengan 65 tambahan dan 2 penghapusan
  1. 65 2
      src/views/overview/MapView.vue

+ 65 - 2
src/views/overview/MapView.vue

@@ -78,6 +78,7 @@ export default {
       direction: '竖屏',
       show: false,
       legendList: [], // 图例列表
+      shopsList:[],//所有强电井对应的店铺
     }
   },
   props: {},
@@ -254,6 +255,7 @@ export default {
             // t.name = t.data.Name
             t.name = ''
           }
+          t.connect('onMouseDown',this,this.clickMapPlace)
         })
         this.fParser.wallList.forEach((t) => this.scene.addItem(t))
         this.fParser.virtualWallList.forEach((t) => this.scene.addItem(t))
@@ -369,6 +371,10 @@ export default {
             this.scene.addItem(t)
             // t.connect('legendItemClick', t, this.handleClickLegendItem)
           })
+
+          // 获取本层楼所有电井对应的商铺 id
+          this.shopLisghtWell();
+
           // this.view.fitSceneToView()
           // this.view.minScale = this.view.scale
           if (this.$refs.canvasFun) {
@@ -384,6 +390,58 @@ export default {
           Toast.clear();
         })
     },
+    // 点击底图商铺高亮对应的电井
+    shopLisghtWell() {
+      const getParams = {
+        plazaId: this.plazaId,
+        floor: this.floorid,
+      };
+      queryShops({ getParams }).then((res) => {
+        let shopsnumList = [];
+        if (res.data && res.data.length) {
+          for (let floor in res.data[0]) {
+            shopsnumList = res.data[0][floor].map((obj) => {
+                const shoplist = obj.shopsnumList.split(",");
+                return Object.assign(obj, {
+                  shopList: shoplist,
+                });
+              });
+          }
+        }
+        this.shopsList = shopsnumList;
+      });
+    },
+    // 点击底图空间
+    clickMapPlace(item,e){
+      let wellId = null;
+      let wellItem = null //;对应的强电井
+      if(item.data.Name){
+        this.shopsList.forEach(equip=>{
+          equip.shopList.forEach(shop=>{
+            if(item.data.Name == shop){
+              wellId = equip.wellnum;
+            }
+          })
+        })
+      }
+      this.topologyParser.imageLegendList.forEach(eqItem=>{
+        eqItem.data.AttachObjectIds.forEach((objId)=>{
+            if(objId.id == wellId){
+              // 点击空间高亮
+                wellItem = eqItem
+            }
+        })
+      })
+     if(wellItem){
+        setTimeout(()=>{
+        this.clearHightLight();
+        item.highLightFlag = true;
+        wellItem.selected = true;
+        })
+     }else{
+         this.clearHightLight();
+     }
+    },
     // 顶楼为多张图时计数器
     countRf(len) {
       this.count++
@@ -441,7 +499,7 @@ export default {
               this.fParser.spaceList.forEach((item) => {
                 if (shopsnumList.findIndex((name) => name == item.data.Name) != -1) {
                   item.highLightFlag = true
-                  item.zOrder = 30
+                  // item.zOrder = 30
                 }
               })
             }
@@ -451,7 +509,12 @@ export default {
     },
     // 清除电井关联商铺的高亮状态
     clearHightLight() {
-      ItemColor.spaceHighColor = new SColor('#FBF2CC')
+      // 所有电井置为 select = false
+      this.topologyParser.imageLegendList.forEach(eqItem=>{
+        eqItem.selected = false;
+      })
+
+      ItemColor.spaceHighColor = new SColor('#FBF2CC');
       this.fParser.spaceList.forEach((item) => {
         item.highLightFlag = false
         item.zOrder = ItemOrder.spaceOrder