From 5d3d6bbf729314e71c2deaaa02e60a223cfba990 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 21 Nov 2024 13:48:12 +0800
Subject: [PATCH] 代码回滚

---
 src/pages/layout/components/scomponents/layersControl.vue |  242 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 215 insertions(+), 27 deletions(-)

diff --git a/src/pages/layout/components/scomponents/layersControl.vue b/src/pages/layout/components/scomponents/layersControl.vue
index 6313690..2294922 100644
--- a/src/pages/layout/components/scomponents/layersControl.vue
+++ b/src/pages/layout/components/scomponents/layersControl.vue
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2024-10-31 10:47:29
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-18 17:07:09
+ * @LastEditTime: 2024-11-19 15:53:37
  * @FilePath: \bigScreen\src\pages\layout\components\scomponents\layersControl.vue
  * @Description:
  *
@@ -90,6 +90,7 @@
 const closePanoramaPopup = () => {
   panoramaShow.value = false
 }
+let addPupoLayers = {}
 
 const data = [
   {
@@ -105,6 +106,18 @@
       {
         url: VITE_APP_BASE + 'mx/tile_02/tileset.json',
         label: 'tile_02'
+      },
+      {
+        url: VITE_APP_BASE + 'mx/tile_03/tileset.json',
+        label: 'tile_03'
+      },
+      {
+        url: VITE_APP_BASE + 'mx/tile_04/tileset.json',
+        label: 'tile_04'
+      },
+      {
+        url: VITE_APP_BASE + 'mx/tile_05/tileset.json',
+        label: 'tile_05'
       },
     ],
     layerName: 'hgyq'
@@ -142,7 +155,31 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
         className: 'yjc-box',
         showPanel: false,
-        layerName: 'yjc'
+        layerName: 'yjc',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       },
       {
         id: '3-2',
@@ -157,7 +194,31 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
         className: 'ysf-box',
         showPanel: false,
-        layerName: 'fm'
+        layerName: 'fm',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       },
 
       {
@@ -173,7 +234,7 @@
             layerName: 'gsgw',
             source: gsgw,
             color: DC.Color.BLUE,
-            height: 5,
+            height: 65,
           },
           {
             id: '3-3-2',
@@ -183,7 +244,7 @@
             layerName: 'wsgw',
             source: wsgw,
             color: DC.Color.BLACK,
-            height: 10,
+            height: 68,
           },
           {
             id: '3-3-3',
@@ -193,7 +254,7 @@
             layerName: 'rqgw',
             source: rqgw,
             color: DC.Color.RED,
-            height: 15,
+            height: 71,
           },
           {
             id: '3-3-4',
@@ -203,7 +264,7 @@
             layerName: 'ysgw',
             source: ysgw,
             color: DC.Color.CYAN,
-            height: 20,
+            height: 75,
           },
         ]
       },
@@ -218,7 +279,31 @@
           type: 4,
           size: 1000
         },
-        layerName: 'wstsbz'
+        layerName: 'wstsbz',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       },
 
       {
@@ -234,7 +319,31 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/sk.png',
         className: 'sk-box',
         showPanel: false,
-        layerName: 'sk'
+        layerName: 'sk',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       },
 
       {
@@ -250,7 +359,31 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjb.png',
         className: 'yjb-box',
         showPanel: false,
-        layerName: 'yjb'
+        layerName: 'yjb',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       },
 
       {
@@ -266,7 +399,31 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/xfs.png',
         className: 'xfs-box',
         showPanel: false,
-        layerName: 'xfs'
+        layerName: 'xfs',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroy()
+          if (!attrParams.imageUrl) {
+            return
+          }
+          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl">
+                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroy()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPupoLayers[attrParams.name].addOverlay(divIcon)
+        }
       }
     ]
   },
@@ -274,17 +431,40 @@
   {
     id: '4',
     label: '风险源',
-    type: 'layer',
-    subType: 'labelPoint',
-    method: getRiskList,
-    params: {
-      size: 1000
-    },
-    showParams: 'category',
-    className: 'fxy-box',
-    backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
-    showPanel: false,
-    layerName: 'fxy'
+    children: [
+      {
+        id: '4-1',
+        label: '一般',
+        type: 'layer',
+        subType: 'labelPoint',
+        method: getRiskList,
+        params: {
+          riskLevel: 1,
+          size: 1000
+        },
+        showParams: 'category',
+        className: 'fxy-ordinary',
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
+        showPanel: false,
+        layerName: 'fxyOrdinary',
+      },
+      {
+        id: '4-2',
+        label: '较大',
+        type: 'layer',
+        subType: 'labelPoint',
+        method: getRiskList,
+        params: {
+          riskLevel: 2,
+          size: 1000
+        },
+        showParams: 'category',
+        className: 'fxy-larger',
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
+        showPanel: false,
+        layerName: 'fxyLarger',
+      }
+    ]
   },
 
   {
@@ -311,7 +491,6 @@
     incident: (e) => {
       const { attrParams } = e.overlay
       panoramaTitle.value = attrParams.name
-
       if (
         attrParams.url.indexOf("http://vr.jxpskj.com:180") != -1
       ) {
@@ -320,7 +499,6 @@
           "/panorama"
         )
       }
-
       panoramaUrl.value = attrParams.url
       panoramaShow.value = true
     }
@@ -428,7 +606,8 @@
 
               divIcon.attrParams = i
 
-              let incident = () => { }
+              let incident = () => {
+              }
 
               if (item.incident) incident = item.incident
 
@@ -481,7 +660,7 @@
           item.source.features.forEach(i => {
             let polylineVolume = new DC.PolylineVolume(
               i.geometry.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
-              computeCircle(0.3)
+              computeCircle(2)
             )
 
             polylineVolume.setStyle({
@@ -567,7 +746,14 @@
 // watch(sharedData, (newValue) => {
 // });
 
-
+// 销毁
+function destroy() {
+  let arr = Object.keys(addPupoLayers)
+  arr.filter(i => i != 'hgyq').forEach(i => {
+    addPupoLayers[i] && window.$viewer.removeLayer(addPupoLayers[i])
+  })
+  addPupoLayers = {}
+}
 
 onUnmounted(() => {
   tileLayers && window.$viewer.removeLayer(tileLayers)
@@ -575,6 +761,8 @@
   arr.filter(i => i != 'hgyq').forEach(i => {
     addTileLayers[i] && window.$viewer.removeLayer(addTileLayers[i])
   })
+  // 弹窗销毁
+  destroy()
 
   EventBus.off('restHandleCheckChange', restHandleCheckChange)
   EventBus.off('restHandleDelChange', restHandleDelChange)

--
Gitblit v1.9.3