智慧园区前端大屏
linwe
2024-12-02 1cf6b2cc8069d20fbff9a2f5a3514a484df1188f
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-01 21:45:13
 * @LastEditTime: 2024-12-02 19:46:13
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -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', 
@@ -106,7 +108,26 @@
    type: 'layer',
    subType: '3Dtile',
    urlData: [
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_01/tileset.json',
        label: 'tile_01'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_02/tileset.json',
        label: 'tile_02'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_03/tileset.json',
        label: 'tile_03'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_04/tileset.json',
        label: 'tile_04'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_05/tileset.json',
        label: 'tile_05'
      },
    ],
    layerName: 'hgyq'
  },
@@ -158,7 +179,7 @@
            <img src="${attrParams.imageUrl}" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
@@ -198,7 +219,7 @@
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
@@ -284,7 +305,7 @@
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
@@ -325,7 +346,7 @@
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
@@ -366,7 +387,7 @@
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
@@ -469,11 +490,10 @@
          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, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-three">
                    ${iconEl}
                  </div>`
@@ -506,12 +526,11 @@
          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, 64),
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-three">
                    ${iconEl}
                  </div>`
@@ -713,7 +732,7 @@
              }
              let divIcon = new DC.DivIcon(
                new DC.Position(i.lng, i.lat, 64),
                new DC.Position(i.lng, i.lat, i.ele || 64),
                `<div class="public-map-popup ${item.className || ''}">
                    ${iconEl}
                  </div>`
@@ -896,13 +915,49 @@
onMounted(() => {
  setTimeout(() => {
    handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
    // handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
  }, 3000)
})
// const sharedData = computed(() => pointStore.sharedData);
// 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 () {
@@ -923,10 +978,15 @@
  }
  let arr = Object.keys(addTileLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
    addTileLayers[i] = null
    delete addTileLayers[i]
  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
  // 弹窗销毁