ソースを参照

地图增加图层控制

wang_xy 2 年 前
コミット
12011e0627
2 ファイル変更68 行追加13 行削除
  1. 7 0
      src/api/components/supermap.js
  2. 61 13
      src/components/supermap-2.5d.vue

+ 7 - 0
src/api/components/supermap.js

@@ -6,6 +6,13 @@ export function getSuperMap(codes) {
     method: 'get'
   })
 }
+export function getDeviceList(param) {
+  return request({
+    url: '/center-data/level/getDeviceList',
+    method: 'get',
+    params:param
+  })
+}
 
 export const iconList = {
   'marker': require('@/assets/images/cameraType/marker.png'),

+ 61 - 13
src/components/supermap-2.5d.vue

@@ -362,19 +362,21 @@
           //   show:true,
           // });
           //
-          //6.路网
-          let road = that.superMapRootUrl + "/map-mvt-roadXian/restjsr/v1/vectortile/maps/road_Xian";
-          that.mvtMap3 = that.scene.addVectorTilesMap({
-            url: road,
-            canvasWidth: 512,
-            name: 'mvt_map3',
-            viewer: that.viewer,
-            show: true,
-          });
+          if(that.showLayer){
+            //6.路网
+            let road = that.superMapRootUrl + "/map-mvt-roadXian/restjsr/v1/vectortile/maps/road_Xian";
+            that.mvtMap3 = that.scene.addVectorTilesMap({
+              url: road,
+              canvasWidth: 512,
+              name: 'mvt_map3',
+              viewer: that.viewer,
+              show: true,
+            });
 
-          //7.添加路网NAME
-          let road_name_url = that.superMapRootUrl + '/3D-road_Name_S/rest/realspace';
-          that.road_name = that.scene.open(road_name_url);
+            //7.添加路网NAME
+            let road_name_url = that.superMapRootUrl + '/3D-road_Name_S/rest/realspace';
+            that.road_name = that.scene.open(road_name_url);
+          }
           //
           // // 8.添加水系NAME
           // let shuixi_name_url = that.superMapRootUrl+'/3D-shuixi_Name/rest/realspace';
@@ -399,7 +401,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);
+            });
+          }
+        });
       },
       /**
        * 地图落点