From 88f3b0dbbb5df9ee3127851b0f1641856d770554 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 11 Sep 2025 22:53:39 +0800
Subject: [PATCH] feat:突发事件模拟优化

---
 src/pages/map/components/scomponents/layersControl.vue |   63 ++++++++-----------------------
 1 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/src/pages/map/components/scomponents/layersControl.vue b/src/pages/map/components/scomponents/layersControl.vue
index 95bcdd4..272f9b1 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: 2025-09-07 20:23:17
+ * @LastEditTime: 2025-09-11 22:51:34
  * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
  * @Description:
  *
@@ -745,51 +745,7 @@
 watch(
     () => mapStore.needSelectID,
     (newValue, oldValue) => {
-        if (curAddClassDoms.length > 0) {
-            curAddClassDoms.forEach(dom => {
-                dom.classList.remove('is-need-item')
-            })
-
-            curAddClassDoms = []
-        }
-
-        if (newValue.length > 0) {
-            addTileLayers['qyfb']?.getOverlays().forEach(item => {
-                newValue.forEach(id => {
-                    if (item.attrParams.id == id) {
-                        let dom = item.delegate.children[0]
-
-                        dom.classList.add('is-need-item')
-
-                        curAddClassDoms.push(dom)
-                    }
-                })
-            })
-
-            addTileLayers['sg-yjc']?.getOverlays().forEach(item => {
-                newValue.forEach(id => {
-                    if (item.attrParams.id == id) {
-                        let dom = item.delegate.children[0]
-
-                        dom.classList.add('is-need-item')
-
-                        curAddClassDoms.push(dom)
-                    }
-                })
-            })
-
-            addTileLayers['zb']?.getOverlays().forEach(item => {
-                newValue.forEach(id => {
-                    if (item.attrParams.id == id) {
-                        let dom = item.delegate.children[0]
-
-                        dom.classList.add('is-need-item')
-
-                        curAddClassDoms.push(dom)
-                    }
-                })
-            })
-        }
+        curAddClassDoms = []
     }
 )
 
@@ -902,6 +858,10 @@
                         data.filter(i => i.lng && i.lng != '' && i.lat && i.lat != '').forEach(i => {
                             let iconEl = ''
 
+                            let flag = mapStore.needSelectID.some(o => i.id === o)
+
+                            flag && curAddClassDoms.push(i)
+
                             if ('showPanel' in item && item.showPanel == false) {
                                 if (item.backgroundIcon) {
                                     iconEl = `
@@ -919,7 +879,7 @@
 
                             let divIcon = new DC.DivIcon(
                                 new DC.Position(i.lng, i.lat, i.ele || 64),
-                                `<div class="public-map-popup ${item.className || ''}">
+                                `<div class="public-map-popup ${item.className || ''} ${flag ? 'is-need-item' : ''}">
                     ${iconEl}
                   </div>`
                             )
@@ -947,6 +907,15 @@
 
                             addTileLayers[item.layerName].addOverlay(divIcon)
                         })
+
+                        if (curAddClassDoms.length == 1) {
+                            window.$viewer.zoomToPosition(new DC.Position(curAddClassDoms[0].lng, curAddClassDoms[0].lat, 3000, 0, -90, 0))
+                        }
+
+                        if (curAddClassDoms.length > 1) {
+                            let center = window.$turf.midpoint(...curAddClassDoms.map(i => window.$turf.point([i.lng, i.lat])))
+                            window.$viewer.zoomToPosition(new DC.Position(center.geometry.coordinates[0], center.geometry.coordinates[1], 4200, 0, -90, 0))
+                        }
                     })
                 } else {
                     addTileLayers[item.layerName].show = true

--
Gitblit v1.9.3