From 17a81d641608545682e3f79f7c6090cac48fe81a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 15 Sep 2025 18:10:01 +0800
Subject: [PATCH] feat:去除高亮

---
 src/pages/map/components/scomponents/layersControl.vue |   61 +++++++-----------------------
 1 files changed, 15 insertions(+), 46 deletions(-)

diff --git a/src/pages/map/components/scomponents/layersControl.vue b/src/pages/map/components/scomponents/layersControl.vue
index 95bcdd4..7b1f4a9 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-15 18:09:46
  * @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 = `
@@ -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