智慧园区前端大屏
linwe
2024-12-02 1cf6b2cc8069d20fbff9a2f5a3514a484df1188f
src/pages/map/components/scomponents/layersControl.vue
@@ -79,6 +79,8 @@
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', 
@@ -488,8 +490,7 @@
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <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),
@@ -525,9 +526,8 @@
          destroy()
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>${attrParams.firmName || ''}</li>
            <li>${attrParams.riskLevelName || ''}</li>
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>${attrParams.name || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -915,7 +915,7 @@
onMounted(() => {
  setTimeout(() => {
    handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
    // handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
  }, 3000)
})
@@ -923,6 +923,42 @@
// watch(sharedData, (newValue) => {
// });
// 关闭所有选中的,除了倾斜,园区分布,空中全景
const closeAll = () => {
  EventBus.emit('restHandleDelChange', `2`)
  EventBus.emit('restHandleDelChange', `3`)
  EventBus.emit('restHandleDelChange', `3-1`)
  EventBus.emit('restHandleDelChange', `3-2`)
  EventBus.emit('restHandleDelChange', `3-3`)
  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`)
  EventBus.emit('restHandleDelChange', `4-1`)
  EventBus.emit('restHandleDelChange', `4-2`)
  EventBus.emit('restHandleDelChange', `8`)
  destroy()
}
// 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)