智慧园区前端大屏
linwe
2024-11-25 f33fb1a61a00d3ec5d6868def0b146bb69be4dc5
src/pages/layout/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-11-25 15:32:31
 * @LastEditTime: 2024-11-25 16:37:03
 * @FilePath: \bigScreen\src\pages\layout\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -59,6 +59,7 @@
})
import panorama from './popup/panorama.vue'
import { getPage } from '@/api/indParkInfo'
import { getPage as getfirmPage } from '@/api/firmInfo/firmInfo'
import { getList, getGouQu } from "@/api/space/space"
import { getList as getRiskList } from "@/api/riskSource/riskSource"
import { getPanoramaList } from "@/api/panorama/"
@@ -70,6 +71,8 @@
import { onUnmounted } from 'vue'
import EventBus from 'utils/bus'
import { usePointStore } from 'store/usepoint'
import { useRouter } from 'vue-router';
const router = useRouter();
const pointStore = usePointStore()
const { VITE_APP_BASE } = import.meta.env
@@ -100,10 +103,6 @@
    type: 'layer',
    subType: '3Dtile',
    urlData: [
      // {
      //   url: VITE_APP_BASE + 'mx/tileset.json',
      //   label: 'tile_01'
      // },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_01/tileset.json',
        label: 'tile_01'
@@ -124,27 +123,6 @@
        url: VITE_APP_BASE + 'newMx/mx/tile_05/tileset.json',
        label: 'tile_05'
      },
      // {
      //   url: 'http://localhost:9003/model/ZOebpNa0/tileset.json',
      //   label: 'tile_01'
      // },
      // {
      //   url: 'http://localhost:9003/model/QKYdBZ0b/tileset.json',
      //   label: 'tile_02'
      // },
      // {
      //   url: 'http://localhost:9003/model/QrimOmf3/tileset.json',
      //   label: 'tile_03'
      // },
      // {
      //   url: 'http://localhost:9003/model/S7E9aUgj/tileset.json',
      //   label: 'tile_04'
      // },
      // {
      //   url: 'http://localhost:9003/model/WYUq33vu/tileset.json',
      //   label: 'tile_05'
      // },
    ],
    layerName: 'hgyq'
  },
@@ -466,10 +444,24 @@
        params: {
          type: 8,
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/xfs.png',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/gouqu.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'gouqu'
      },
      {
        id: '3-9',
        label: '废水处理站',
        type: 'layer',
        subType: 'labelPoint',
        method: getfirmPage,
        params: {
          name: '吉水县绿源污水处理厂',
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'fsclz'
      }
    ]
  },
@@ -624,7 +616,13 @@
  },
]
console.log(data, 12112213213)
// let modellayer = new DC.VectorLayer("modellayer").addTo(window.$viewer)
// let model = new DC.Model("121.46748793889597,31.22345700031846,200", VITE_APP_BASE + 'gltf/dajiang.gltf')
// model.setStyle({
//   scale: 10000
// })
// modellayer.addOverlay(model)
// window.$viewer.flyToPosition("121.46748793889597,31.22345700031846,300,0,-90")
const defaultProps = {
  children: 'children',
@@ -787,7 +785,7 @@
          addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
          window.$viewer.addLayer(addTileLayers[item.layerName])
          function computeCircle (radius) {
          function computeCircle(radius) {
            var positions = []
            for (var i = 0; i < 360; i++) {
              var radians = DC.Math.toRadians(i)
@@ -862,7 +860,7 @@
  })
}
function findObjectById (data, id) {
function findObjectById(data, id) {
  // 遍历数据数组
  for (let i = 0; i < data.length; i++) {
    const item = data[i]
@@ -932,12 +930,44 @@
  }, 2000)
})
// 关闭所有选中的,除了倾斜,园区分布,空中全景
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`)
}
// 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 () {
function destroy() {
  let arr = Object.keys(addPupoLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addPupoLayers[i] && window.$viewer.removeLayer(addPupoLayers[i])