智慧园区前端大屏
shuishen
2024-12-02 b67f46b4a768b4cd72d4e463c5dffefe977ddeb7
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-02 21:12:23
 * @LastEditTime: 2024-12-02 22:04:17
 * @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', 
@@ -167,14 +169,13 @@
          const { attrParams } = e.overlay
          // 删除
          destroy()
          if (!attrParams.imageUrl) {
            return
          }
          // if (!attrParams.imageUrl) {
          //   return
          // }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>${attrParams.fullName}</div>
            <img src="${attrParams.imageUrl}" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -413,22 +414,22 @@
        showPanel: false,
        layerName: 'gouqu'
      },
      {
        id: '3-9',
        label: '废水处理站',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 9,
          size: 1000
          // name: '吉水县绿源污水处理厂',
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'fsclz'
      },
      // {
      //   id: '3-9',
      //   label: '废水处理站',
      //   type: 'layer',
      //   subType: 'labelPoint',
      //   method: getList,
      //   params: {
      //     type: 9,
      //     size: 1000
      //     // name: '吉水县绿源污水处理厂',
      //   },
      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
      //   className: 'xfs-box',
      //   showPanel: false,
      //   layerName: 'fsclz'
      // },
      {
        id: '3-10',
        label: '排水口',
@@ -444,21 +445,21 @@
        showPanel: false,
        layerName: 'psk'
      },
      {
        id: '3-11',
        label: '污水池',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 11,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsc.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'wsc'
      }
      // {
      //   id: '3-11',
      //   label: '污水池',
      //   type: 'layer',
      //   subType: 'labelPoint',
      //   method: getList,
      //   params: {
      //     type: 11,
      //     size: 1000
      //   },
      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsc.png',
      //   className: 'xfs-box',
      //   showPanel: false,
      //   layerName: 'wsc'
      // }
    ]
  },
@@ -488,8 +489,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 +525,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),
@@ -914,7 +913,7 @@
onMounted(() => {
  setTimeout(() => {
    handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
    // handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
  }, 3000)
})
@@ -922,6 +921,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)