| | |
| | | * @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: |
| | | * |
| | |
| | | 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 = [] |
| | | } |
| | | ) |
| | | |
| | |
| | | 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 = ` |
| | |
| | | |
| | | 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 |