Bladeren bron

资源增加图层点击事件

wang_xy 2 jaren geleden
bovenliggende
commit
770d8014ac
1 gewijzigde bestanden met toevoegingen van 47 en 1 verwijderingen
  1. 47 1
      src/components/supermap-2.5d.vue

+ 47 - 1
src/components/supermap-2.5d.vue

@@ -346,7 +346,53 @@
           // });
 
         }, 3000);
-
+        that.viewer.selectedEntityChanged.addEventListener(function (entity) {
+          if(entity != undefined && Reflect.has(entity,'layerID')){
+            that.queryParams.name  = entity.pickResult[entity.layerID][0].feature.properties.Name;
+            that.queryParams.mapData  = entity.pickResult[entity.layerID][0].feature.properties.SmUserID;
+            that.queryParams.mapName  = entity.pickResult[entity.layerID][0].feature.properties.layer;
+            getDeviceList(that.queryParams).then(res => {
+              const treeLabels = [{
+                "id": null,
+                "labelCode": "999",
+                "labelName": "电视墙",
+                "cameraType": null,
+                "parentLabelCode": ""
+              }];
+              const labelChannels = [];
+              for (let i in res.data){
+                treeLabels.push({
+                  "id": null,
+                  "labelCode": res.data[i].cameraCode,
+                  "labelName": res.data[i].cameraName,
+                  "cameraType": "1",
+                  "parentLabelCode": "999"
+                })
+                labelChannels.push({
+                  "labelCode": res.data[i].cameraCode,
+                  "channelDates": [
+                    {
+                      "channelCode": res.data[i].cameraCode,
+                      "channelName": res.data[i].cameraName,
+                      "channelSn": null,
+                      "cameraType": "1",
+                      "online": "1",
+                      "cameraCode": "1"
+                    }
+                  ]
+                })
+              }
+              const dianshiqiang = [
+                {
+                  "switchTab": "2",
+                  "treeLabels": treeLabels,
+                  "labelChannels": labelChannels
+                }
+              ]
+              that.$emit('fatherMethod', dianshiqiang,res.data[0].longitude,res.data[0].latitude,res.data[0].userList);
+            });
+          }
+        });
       },
       /**
        * 地图落点