From 9a37c5e1b2190c3f6ec71483923922189091dd52 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 18 Dec 2024 09:42:01 +0800
Subject: [PATCH] 事件模拟更新

---
 src/pages/map/components/scomponents/layersControl.vue |  711 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 500 insertions(+), 211 deletions(-)

diff --git a/src/pages/map/components/scomponents/layersControl.vue b/src/pages/map/components/scomponents/layersControl.vue
index e455183..1694931 100644
--- a/src/pages/map/components/scomponents/layersControl.vue
+++ b/src/pages/map/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-12-02 19:46:13
+ * @LastEditTime: 2024-12-10 14:33:31
  * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
  * @Description:
  *
@@ -50,10 +50,13 @@
 </template>
 
 <script setup>
-let addPupoLayers = {}
+let addPopLayers = {}
 let addTileLayers = {}
 let tileLayers = new DC.TilesetLayer('tileLayers')
 window.$viewer.addLayer(tileLayers)
+
+let planToBuild = new DC.HtmlLayer('planToBuild')
+window.$viewer.addLayer(planToBuild)
 
 const {
   show: showLayerControl
@@ -71,18 +74,20 @@
 import { getList as getRiskList } from "@/api/riskSource/riskSource"
 import { getPanoramaList } from "@/api/panorama/"
 import yqfw from "@/assets/json/yqfw"
-import gsgw from "@/assets/json/gsgw"
-import rqgw from "@/assets/json/rqgw"
+// import gsgw from "@/assets/json/gsgw"
+// import rqgw from "@/assets/json/rqgw"
 import wsgw from "@/assets/json/wsgw"
 import ysgw from "@/assets/json/ysgw"
 import { onUnmounted } from 'vue'
 import EventBus from 'utils/bus'
 import { usePointStore } from 'store/usepoint'
 const pointStore = usePointStore()
+import { useRouter } from 'vue-router'
+const router = useRouter()
 
 const { VITE_APP_BASE } = import.meta.env
 // , '7', 
-let indexPoint = ref(['1', '5'])
+let indexPoint = ref(['1', '5', '7'])
 
 const treeRef = ref(null)
 
@@ -107,23 +112,23 @@
     subType: '3Dtile',
     urlData: [
       {
-        url: VITE_APP_BASE + 'newMx/mx/tile_01/tileset.json',
+        url: VITE_APP_BASE + 'mx/tile_01/tileset.json',
         label: 'tile_01'
       },
       {
-        url: VITE_APP_BASE + 'newMx/mx/tile_02/tileset.json',
+        url: VITE_APP_BASE + 'mx/tile_02/tileset.json',
         label: 'tile_02'
       },
       {
-        url: VITE_APP_BASE + 'newMx/mx/tile_03/tileset.json',
+        url: VITE_APP_BASE + 'mx/tile_03/tileset.json',
         label: 'tile_03'
       },
       {
-        url: VITE_APP_BASE + 'newMx/mx/tile_04/tileset.json',
+        url: VITE_APP_BASE + 'mx/tile_04/tileset.json',
         label: 'tile_04'
       },
       {
-        url: VITE_APP_BASE + 'newMx/mx/tile_05/tileset.json',
+        url: VITE_APP_BASE + 'mx/tile_05/tileset.json',
         label: 'tile_05'
       },
     ],
@@ -150,102 +155,197 @@
     label: '应急空间',
     children: [
       {
+        parentId: '3',
         id: '3-1',
         label: '应急池',
-        type: 'layer',
-        subType: 'labelPoint',
-        method: getList,
-        params: {
-          type: 1,
-          size: 1000
-        },
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
-        className: 'yjc-box',
-        showPanel: false,
-        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">
-            <div>${attrParams.fullName}</div>
-            <img src="${attrParams.imageUrl}" />
+        children: [
+          {
+            parentId: '3-1',
+            id: '3-1-1',
+            label: '园区',
+            type: 'layer',
+            subType: 'labelPoint',
+            method: getList,
+            params: {
+              type: 1,
+              size: 1000,
+              category: 1
+            },
+            backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
+            className: 'yjc-box',
+            showPanel: false,
+            layerName: 'yjc-yq',
+            incident: (e) => {
+              const { attrParams } = e.overlay
+              // 删除
+              destroyPop()
+              if (!attrParams.firmName) {
+                return
+              }
+              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
+              window.$viewer.addLayer(addPopLayers[attrParams.id])
+              let iconEl = `<div class="marsBlueGradientPnl">
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
                 </div>`
-          let divIcon = new DC.DivIcon(
-            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
-            `<div class="public-map-popup-two">
+              let divIcon = new DC.DivIcon(
+                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 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',
-        label: '阀门',
-        type: 'layer',
-        subType: 'labelPoint',
-        method: getList,
-        params: {
-          type: 2,
-          size: 1000
-        },
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
-        className: 'ysf-box',
-        showPanel: false,
-        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">
-                  <div>${attrParams.fullName}</div>
-                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+              )
+              let incident = () => {
+                destroyPop()
+              }
+              divIcon.on(DC.MouseEventType.CLICK, incident)
+              addPopLayers[attrParams.id].addOverlay(divIcon)
+            }
+          },
+          {
+            parentId: '3-1',
+            id: '3-1-2',
+            label: '企业',
+            type: 'layer',
+            subType: 'labelPoint',
+            method: getList,
+            params: {
+              type: 1,
+              size: 1000,
+              category: 2
+            },
+            backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
+            className: 'yjc-box',
+            showPanel: false,
+            layerName: 'yjc-qy',
+            incident: (e) => {
+              const { attrParams } = e.overlay
+              // 删除
+              destroyPop()
+              if (!attrParams.firmName) {
+                return
+              }
+              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
+              window.$viewer.addLayer(addPopLayers[attrParams.id])
+              let iconEl = `<div class="marsBlueGradientPnl">
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
                 </div>`
-          let divIcon = new DC.DivIcon(
-            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
-            `<div class="public-map-popup-two">
+              let divIcon = new DC.DivIcon(
+                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
+                `<div class="public-map-popup-two">
                     ${iconEl}
                   </div>`
-          )
-          let incident = () => {
-            destroy()
-          }
-          divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
-        }
+              )
+              let incident = () => {
+                destroyPop()
+              }
+              divIcon.on(DC.MouseEventType.CLICK, incident)
+              addPopLayers[attrParams.id].addOverlay(divIcon)
+            }
+          },
+        ]
       },
 
       {
+        parentId: '3',
+        id: '3-2',
+        label: '阀门',
+        children: [
+          {
+            parentId: '3-2',
+            id: '3-2-1',
+            label: '园区',
+            type: 'layer',
+            subType: 'labelPoint',
+            method: getList,
+            params: {
+              type: 2,
+              size: 1000,
+              category: 1
+            },
+            backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
+            className: 'ysf-box',
+            showPanel: false,
+            layerName: 'fm-yq',
+            incident: (e) => {
+              const { attrParams } = e.overlay
+              // 删除
+              destroyPop()
+              if (!attrParams.firmName) {
+                return
+              }
+              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
+              window.$viewer.addLayer(addPopLayers[attrParams.id])
+              let iconEl = `<div class="marsBlueGradientPnl">
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
+                </div>`
+              let divIcon = new DC.DivIcon(
+                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
+                `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+              )
+              let incident = () => {
+                destroyPop()
+              }
+              divIcon.on(DC.MouseEventType.CLICK, incident)
+              addPopLayers[attrParams.id].addOverlay(divIcon)
+            }
+          },
+          {
+            parentId: '3-2',
+            id: '3-2-2',
+            label: '企业',
+            type: 'layer',
+            subType: 'labelPoint',
+            method: getList,
+            params: {
+              type: 2,
+              size: 1000,
+              category: 2
+            },
+            backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
+            className: 'ysf-box',
+            showPanel: false,
+            layerName: 'fm-qy',
+            incident: (e) => {
+              const { attrParams } = e.overlay
+              // 删除
+              destroyPop()
+              if (!attrParams.firmName) {
+                return
+              }
+              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
+              window.$viewer.addLayer(addPopLayers[attrParams.id])
+              let iconEl = `<div class="marsBlueGradientPnl">
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
+                </div>`
+              let divIcon = new DC.DivIcon(
+                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
+                `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+              )
+              let incident = () => {
+                destroyPop()
+              }
+              divIcon.on(DC.MouseEventType.CLICK, incident)
+              addPopLayers[attrParams.id].addOverlay(divIcon)
+            }
+          }
+        ]
+      },
+
+      {
+        parentId: '3',
         id: '3-3',
         label: '公共管网',
         children: [
           // 给水管网、污水管网、燃气管网、雨水管网
           {
-            id: '3-3-1',
-            label: '给水管网',
-            type: 'layer',
-            subType: 'geojsonPipe',
-            layerName: 'gsgw',
-            source: gsgw,
-            color: DC.Color.BLUE.withAlpha(0.9),
-            height: 65,
-          },
-          {
+            parentId: '3-3',
             id: '3-3-2',
             label: '污水管网',
             type: 'layer',
@@ -253,19 +353,10 @@
             layerName: 'wsgw',
             source: wsgw,
             color: DC.Color.DARKBLUE.withAlpha(0.9),
-            height: 68,
+            height: 60.2,
           },
           {
-            id: '3-3-3',
-            label: '燃气管网',
-            type: 'layer',
-            subType: 'geojsonPipe',
-            layerName: 'rqgw',
-            source: rqgw,
-            color: DC.Color.RED.withAlpha(0.9),
-            height: 71,
-          },
-          {
+            parentId: '3-3',
             id: '3-3-4',
             label: '雨水管网',
             type: 'layer',
@@ -273,31 +364,57 @@
             layerName: 'ysgw',
             source: ysgw,
             color: DC.Color.CYAN.withAlpha(0.9),
-            height: 75,
+            height: 60,
           },
+          // {
+          //   id: '3-3-1',
+          //   label: '给水管网',
+          //   type: 'layer',
+          //   subType: 'geojsonPipe',
+          //   layerName: 'gsgw',
+          //   source: gsgw,
+          //   color: DC.Color.BLUE.withAlpha(0.9),
+          //   height: 60.4,
+          // },
+          // {
+          //   id: '3-3-3',
+          //   label: '燃气管网',
+          //   type: 'layer',
+          //   subType: 'geojsonPipe',
+          //   layerName: 'rqgw',
+          //   source: rqgw,
+          //   color: DC.Color.RED.withAlpha(0.9),
+          //   height: 60.6,
+          // },
         ]
       },
 
       {
+        parentId: '3',
         id: '3-4',
         label: '污水提升泵站',
         type: 'layer',
         subType: 'labelPoint',
         method: getList,
+        // className: 'sk-box',
+        // showPanel: false,
         params: {
           type: 4,
           size: 1000
         },
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wstsb.png',
+        className: 'yjc-box',
+        showPanel: false,
         layerName: 'wstsbz',
         incident: (e) => {
           const { attrParams } = e.overlay
           // 删除
-          destroy()
+          destroyPop()
           if (!attrParams.imageUrl) {
             return
           }
-          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
-          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
           let iconEl = `<div class="marsBlueGradientPnl">
                   <div>${attrParams.fullName}</div>
                   <img src="${attrParams.imageUrl}" width="160" height="160" />
@@ -309,14 +426,15 @@
                   </div>`
           )
           let incident = () => {
-            destroy()
+            destroyPop()
           }
           divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
         }
       },
 
       {
+        parentId: '3',
         id: '3-5',
         label: '水库',
         type: 'layer',
@@ -333,14 +451,14 @@
         incident: (e) => {
           const { attrParams } = e.overlay
           // 删除
-          destroy()
+          destroyPop()
           if (!attrParams.imageUrl) {
             return
           }
-          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
-          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
           let iconEl = `<div class="marsBlueGradientPnl">
-                   <div>${attrParams.fullName}</div>
+                   <div>${attrParams.firmName}</div>
                   <img src="${attrParams.imageUrl}" width="160" height="160" />
                 </div>`
           let divIcon = new DC.DivIcon(
@@ -350,14 +468,15 @@
                   </div>`
           )
           let incident = () => {
-            destroy()
+            destroyPop()
           }
           divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
         }
       },
 
       {
+        parentId: '3',
         id: '3-6',
         label: '应急泵',
         type: 'layer',
@@ -374,15 +493,15 @@
         incident: (e) => {
           const { attrParams } = e.overlay
           // 删除
-          destroy()
-          if (!attrParams.imageUrl) {
+          destroyPop()
+          if (!attrParams.firmName) {
             return
           }
-          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
-          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
           let iconEl = `<div class="marsBlueGradientPnl">
-                  <div>${attrParams.fullName}</div>
-                  <img src="${attrParams.imageUrl}" width="160" height="160" />
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
                 </div>`
           let divIcon = new DC.DivIcon(
             new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -391,14 +510,15 @@
                   </div>`
           )
           let incident = () => {
-            destroy()
+            destroyPop()
           }
           divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
         }
       },
 
       {
+        parentId: '3',
         id: '3-8',
         label: '沟渠',
         type: 'layer',
@@ -413,23 +533,24 @@
         showPanel: false,
         layerName: 'gouqu'
       },
+      // {
+      //   id: '3-9',
+      //   label: '废水处理站',
+      //   type: 'layer',
+      //   subType: 'labelPoint',
+      //   method: getList,
+      //   params: {
+      //     type: 9,
+      //     size: 1000
+      //     // name: '吉水县绿源污水处理厂',
+      //   },
+      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
+      //   className: 'xfs-box',
+      //   showPanel: false,
+      //   layerName: 'fsclz'
+      // },
       {
-        id: '3-9',
-        label: '废水处理站',
-        type: 'layer',
-        subType: 'labelPoint',
-        method: getList,
-        params: {
-          type: 9,
-          size: 1000
-          // name: '吉水县绿源污水处理厂',
-        },
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
-        className: 'xfs-box',
-        showPanel: false,
-        layerName: 'fsclz'
-      },
-      {
+        parentId: '3',
         id: '3-10',
         label: '排水口',
         type: 'layer',
@@ -442,23 +563,48 @@
         backgroundIcon: VITE_APP_BASE + 'img/mapicon/psk.png',
         className: 'xfs-box',
         showPanel: false,
-        layerName: 'psk'
+        layerName: 'psk',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroyPop()
+          if (!attrParams.firmName) {
+            return
+          }
+          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
+          window.$viewer.addLayer(addPopLayers[attrParams.id])
+          let iconEl = `<div class="marsBlueGradientPnl">
+            <div>企业名称:${attrParams.firmName}</div>
+            <div>作用:${attrParams.mainFuncName}</div>
+                </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
+            `<div class="public-map-popup-two">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroyPop()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPopLayers[attrParams.id].addOverlay(divIcon)
+        }
       },
-      {
-        id: '3-11',
-        label: '污水池',
-        type: 'layer',
-        subType: 'labelPoint',
-        method: getList,
-        params: {
-          type: 11,
-          size: 1000
-        },
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsc.png',
-        className: 'xfs-box',
-        showPanel: false,
-        layerName: 'wsc'
-      }
+      // {
+      //   id: '3-11',
+      //   label: '污水池',
+      //   type: 'layer',
+      //   subType: 'labelPoint',
+      //   method: getList,
+      //   params: {
+      //     type: 11,
+      //     size: 1000
+      //   },
+      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsc.png',
+      //   className: 'xfs-box',
+      //   showPanel: false,
+      //   layerName: 'wsc'
+      // }
     ]
   },
 
@@ -467,6 +613,7 @@
     label: '风险源',
     children: [
       {
+        parentId: '4',
         id: '4-1',
         label: '一般',
         type: 'layer',
@@ -478,17 +625,19 @@
         },
         showParams: 'category',
         className: 'fxy-ordinary',
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-yb.png',
         showPanel: false,
         layerName: 'fxyOrdinary',
         incident: (e) => {
           const { attrParams } = e.overlay
           // 删除
-          destroy()
-          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
-          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          destroyPop()
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
           let iconEl = `<div class="marsBlueGradientPnl">
-            <li>${attrParams.name || ''}</li>
+            <li>企业名称:${attrParams.firmName || ''}</li>
+            <li>风险等级:${attrParams.riskLevelName || ''}</li>
+            <li>行业类别:${attrParams.name || ''}</li>
             </div>`
           let divIcon = new DC.DivIcon(
             new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -497,13 +646,14 @@
                   </div>`
           )
           let incident = () => {
-            destroy()
+            destroyPop()
           }
           divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
         }
       },
       {
+        parentId: '4',
         id: '4-2',
         label: '较大',
         type: 'layer',
@@ -515,17 +665,19 @@
         },
         showParams: 'category',
         className: 'fxy-larger',
-        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-jd.png',
         showPanel: false,
         layerName: 'fxyLarger',
         incident: (e) => {
           const { attrParams } = e.overlay
           // 删除
-          destroy()
-          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
-          window.$viewer.addLayer(addPupoLayers[attrParams.name])
+          destroyPop()
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
           let iconEl = `<div class="marsBlueGradientPnl"> 
-            <li>${attrParams.name || ''}</li>
+            <li>企业名称:${attrParams.firmName || ''}</li>
+            <li>风险等级:${attrParams.riskLevelName || ''}</li>
+            <li>行业类别:${attrParams.name || ''}</li>
             </div>`
           let divIcon = new DC.DivIcon(
             new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -534,10 +686,50 @@
                   </div>`
           )
           let incident = () => {
-            destroy()
+            destroyPop()
           }
           divIcon.on(DC.MouseEventType.CLICK, incident)
-          addPupoLayers[attrParams.name].addOverlay(divIcon)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
+        }
+      },
+      {
+        parentId: '4',
+        id: '4-9',
+        label: '暂定',
+        type: 'layer',
+        subType: 'labelPoint',
+        method: getRiskList,
+        params: {
+          riskLevel: 9,
+          size: 1000
+        },
+        showParams: 'category',
+        className: 'fxy-zd',
+        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd.png',
+        showPanel: false,
+        layerName: 'fxyZdLarger',
+        incident: (e) => {
+          const { attrParams } = e.overlay
+          // 删除
+          destroyPop()
+          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
+          window.$viewer.addLayer(addPopLayers[attrParams.name])
+          let iconEl = `<div class="marsBlueGradientPnl"> 
+            <li>${attrParams.firmName || ''}</li>
+            <li>${attrParams.name || ''}</li>
+            <li>${attrParams.riskLevelName || ''}</li>
+            </div>`
+          let divIcon = new DC.DivIcon(
+            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
+            `<div class="public-map-popup-three">
+                    ${iconEl}
+                  </div>`
+          )
+          let incident = () => {
+            destroyPop()
+          }
+          divIcon.on(DC.MouseEventType.CLICK, incident)
+          addPopLayers[attrParams.name].addOverlay(divIcon)
         }
       }
     ]
@@ -661,6 +853,7 @@
 }
 
 const handleCheckChange = (data) => {
+
   let options = treeRef.value?.getCheckedNodes()
   collectedNodes.value = []
   collectNodesWithFlag(data)
@@ -683,22 +876,36 @@
           // })
           addTileLayers[item.layerName] = []
           item.urlData.forEach((m, ind) => {
-            let tile = new DC.Tileset(m.url, {
-              maximumMemoryUsage: 1024,
-              maximumScreenSpaceError: 8,
-              skipLevels: 5,
+            addTileLayers[item.layerName][ind] = new DC.Tileset(m.url, {
+              // maximumMemoryUsage: 1024,
+              // maximumScreenSpaceError: 8,
+              // skipLevels: 5,
+              // skipLevelOfDetail: true,
+              // skipScreenSpaceErrorFactor: 128,
+              // progressiveResolutionHeightFraction: 0.5,
+              // baseScreenSpaceError: 1024
+
+
               skipLevelOfDetail: true,
+              baseScreenSpaceError: 1024,
+              maximumScreenSpaceError: 16, // 数值加大,能让最终成像变模糊
               skipScreenSpaceErrorFactor: 128,
-              progressiveResolutionHeightFraction: 0.5,
-              baseScreenSpaceError: 1024
+              skipLevels: 5,
+              immediatelyLoadDesiredLevelOfDetail: false,
+              loadSiblings: true, // 如果为true则不会在已加载完概况房屋后,自动从中心开始超清化房屋
+              cullWithChildrenBounds: true,
+              cullRequestsWhileMoving: true,
+              cullRequestsWhileMovingMultiplier: 10, // 值越小能够更快的剔除
+              preloadWhenHidden: true,
+              preferLeaves: true,
+              maximumMemoryUsage: 64, // 内存分配变小有利于倾斜摄影数据回收,提升性能体验
+              progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
+              dynamicScreenSpaceErrorDensity: 0.5, // 数值加大,能让周边加载变快
+              dynamicScreenSpaceErrorFactor: 1, // 不知道起了什么作用没,反正放着吧先
+              dynamicScreenSpaceError: true, // 根据测试,有了这个后,会在真正的全屏加载完之后才清晰化房屋
             })
-            tile.setSplitDirection(1)
             // tile.setHeight(-420)
-            // tile.setSplitDirection(-1)
-            window.$viewer.sceneSplit.addTileset(tile)
-            tileLayers.addOverlay(tile)
-            window.$viewer.sceneSplit.enable = false
-            addTileLayers[item.layerName][ind] = tile
+            tileLayers.addOverlay(addTileLayers[item.layerName][ind])
           })
         } else {
           addTileLayers[item.layerName].forEach(m => m.show = true)
@@ -792,12 +999,37 @@
           item.source.features.forEach(i => {
             let polylineVolume = new DC.PolylineVolume(
               i.geometry.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
-              computeCircle(2)
+              computeCircle(1.6)
             )
 
-            polylineVolume.setStyle({
-              material: item.color
-            })
+            if (i.properties.RefName.indexOf('拟建') != -1) {
+              polylineVolume.setStyle({
+                material: DC.Color.fromBytes(255, 0, 0, 230)
+              })
+
+              let features = window.$turf.featureCollection(
+                i.geometry.coordinates.map(d => window.$turf.point([d[0], d[1]]))
+              )
+
+              let planCenter = window.$turf.center(features)
+
+              let planDivIcon = new DC.DivIcon(
+                new DC.Position(planCenter.geometry.coordinates[0], planCenter.geometry.coordinates[1], 60.5),
+                `<div class="public-map-popup">
+                     <div class="map-name">拟建</div>
+                  <div class="map-icon">
+                    <img src="${VITE_APP_BASE + 'img/mapicon/nj-ys.png'}">
+                  </div>
+                  </div>`
+              )
+
+              planToBuild.addOverlay(planDivIcon)
+            } else {
+              polylineVolume.setStyle({
+                material: item.color
+              })
+            }
+
             addTileLayers[item.layerName].addOverlay(polylineVolume)
           })
         } else {
@@ -843,6 +1075,10 @@
           window.$viewer && window.$viewer.removeLayer(addTileLayers[item.layerName])
           addTileLayers[item.layerName] = null
           delete addTileLayers[item.layerName]
+
+          if (item.layerName == 'ysgw' && planToBuild) {
+            planToBuild.clear()
+          }
         }
       }
     }
@@ -884,14 +1120,20 @@
 }
 
 const restHandleDelChange = (key) => {
+
   let checkIds = treeRef.value?.getCheckedKeys()
 
   if (checkIds && !checkIds.some(i => i == key)) {
     return
   }
 
-  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key)))
-  handleCheckChange([findObjectById(data, key)])
+  let selectData = findObjectById(data, key)
+
+  let parentId = null
+  if (selectData && 'parentId' in selectData) parentId = selectData.parentId
+
+  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key) && i != parentId))
+  handleCheckChange([selectData])
 }
 
 // 飞到园区范围
@@ -910,50 +1152,97 @@
 EventBus.on('restHandleCheckChange', restHandleCheckChange)
 EventBus.on('restHandleDelChange', restHandleDelChange)
 EventBus.on('flyToyqfw', flyToyqfw)
+EventBus.on('destroyPop', destroyPop)
 
 onMounted(() => {
-  setTimeout(() => {
-    // handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
-  }, 3000)
+  handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
 })
 
 // const sharedData = computed(() => pointStore.sharedData);
 // watch(sharedData, (newValue) => {
 // });
 
+// 关闭所有选中的,除了倾斜,园区分布,空中全景
+const closeAll = () => {
+  EventBus.emit('restHandleDelChange', `2`)
+  EventBus.emit('restHandleDelChange', `3-1`)
+  EventBus.emit('restHandleDelChange', `3-2`)
+  // EventBus.emit('restHandleDelChange', `3-3-1`)
+  EventBus.emit('restHandleDelChange', `3-3-2`)
+  // EventBus.emit('restHandleDelChange', `3-3-3`)
+  EventBus.emit('restHandleDelChange', `3-3-4`)
+  EventBus.emit('restHandleDelChange', `3-4`)
+  EventBus.emit('restHandleDelChange', `3-5`)
+  EventBus.emit('restHandleDelChange', `3-6`)
+  EventBus.emit('restHandleDelChange', `3-7`)
+  EventBus.emit('restHandleDelChange', `3-8`)
+  // EventBus.emit('restHandleDelChange', `3-9`)
+  EventBus.emit('restHandleDelChange', `4-1`)
+  EventBus.emit('restHandleDelChange', `4-2`)
+  EventBus.emit('restHandleDelChange', `4-9`)
+
+  EventBus.emit('restHandleDelChange', `8`)
+  destroyPop()
+}
+
+// const sharedData = computed(() => pointStore.sharedData);
+// watch(sharedData, (newValue) => {
+// });
+// 监听当前路由路径的变化
+watch(() => router.currentRoute.value.path,
+  (newPath, oldPath) => {
+    console.log(`Current path changed from ${oldPath} to ${newPath}`)
+    closeAll()
+  },
+  { immediate: true }
+)
+
 // 销毁
-function destroy () {
-  let arr = Object.keys(addPupoLayers)
-  arr.filter(i => i != 'hgyq').forEach(i => {
-    addPupoLayers[i] && window.$viewer && window.$viewer.removeLayer(addPupoLayers[i])
-    addPupoLayers[i] = null
-    delete addPupoLayers[i]
-  })
-  addPupoLayers = {}
+function destroyPop () {
+  if (addPopLayers && addPopLayers != null) {
+    let arr = Object.keys(addPopLayers)
+    if (arr.length > 0) {
+      arr.forEach(i => {
+        addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
+        addPopLayers[i] = null
+        delete addPopLayers[i]
+      })
+      addPopLayers = {}
+    }
+  }
 }
 
 onUnmounted(() => {
+  let arr = Object.keys(addTileLayers)
+  arr.forEach(i => {
+    if (i == 'hgyq') {
+      addTileLayers[i].forEach(t => {
+        tileLayers.removeOverlay(t)
+        t = null
+      })
+    } else {
+      addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
+    }
+    addTileLayers[i] = null
+    delete addTileLayers[i]
+  })
+  addTileLayers = null
+
   if (tileLayers) {
-    tileLayers.clear()
+    tileLayers.remove()
     window.$viewer && window.$viewer.removeLayer(tileLayers)
     tileLayers = null
   }
 
-  let arr = Object.keys(addTileLayers)
-  arr.forEach(i => {
-    if (i == 'hgyq') {
-      addTileLayers[i] = null
-      delete addTileLayers[i]
-    } else {
-      addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
-      addTileLayers[i] = null
-      delete addTileLayers[i]
-    }
-  })
-  addTileLayers = null
+  if (planToBuild) {
+    planToBuild.remove()
+    window.$viewer && window.$viewer.removeLayer(planToBuild)
+    planToBuild = null
+  }
+
   // 弹窗销毁
-  destroy()
-  addPupoLayers = null
+  destroyPop()
+  addPopLayers = null
 
   EventBus.off('restHandleCheckChange', restHandleCheckChange)
   EventBus.off('restHandleDelChange', restHandleDelChange)

--
Gitblit v1.9.3