智慧园区前端大屏
shuishen
2024-12-26 ebc79da8a1c5a72fb9ec66da407692c0cde01eba
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-24 16:31:17
 * @LastEditTime: 2024-12-25 15:32:04
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -73,7 +73,7 @@
import { getList, getGouQu } from "@/api/space/space"
import { getList as getRiskList } from "@/api/riskSource/riskSource"
import { getPanoramaList } from "@/api/panorama/"
import yqfw_01 from "@/assets/json/yqfw_01"
import yqfw from "@/assets/json/yqfw"
// import gsgw from "@/assets/json/gsgw"
// import rqgw from "@/assets/json/rqgw"
import wsgw from "@/assets/json/wsgw"
@@ -112,11 +112,11 @@
    subType: '3Dtile',
    urlData: [
      {
        url: VITE_APP_BASE + 'mx/tile_01/tileset.json',
        url: '/zhyqTileset/mx/tile_01/tileset.json',
        label: 'tile_01'
      },
      {
        url: VITE_APP_BASE + 'mx/tile_02/tileset.json',
        url: '/zhyqTileset/mx/tile_02/tileset.json',
        label: 'tile_02'
      },
    ],
@@ -145,7 +145,7 @@
      {
        parentId: '3',
        id: '3-1',
        label: '应急池',
        label: '初期雨水收集池',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
@@ -156,7 +156,7 @@
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
        showPanel: false,
        layerName: 'yjc-yq',
        layerName: 'cq-yssjc',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
@@ -187,175 +187,30 @@
      {
        parentId: '3',
        id: '3-2',
        label: '阀门',
        children: [
          {
            parentId: '3-2',
            id: '3-2-1',
            label: '园区',
            type: 'layer',
            subType: 'labelPoint',
            method: getList,
            params: {
              type: 2,
              size: 1000,
              category: 1
            },
            backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
            className: 'ysf-box',
            showPanel: false,
            layerName: 'fm-yq',
            incident: (e) => {
              const { attrParams } = e.overlay
              // 删除
              destroyPop()
              if (!attrParams.firmName) {
                return
              }
              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
              window.$viewer.addLayer(addPopLayers[attrParams.id])
              let iconEl = `<div class="marsBlueGradientPnl">
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
              let divIcon = new DC.DivIcon(
                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
                `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
              )
              let incident = () => {
                destroyPop()
              }
              divIcon.on(DC.MouseEventType.CLICK, incident)
              addPopLayers[attrParams.id].addOverlay(divIcon)
            }
          },
          {
            parentId: '3-2',
            id: '3-2-2',
            label: '企业',
            type: 'layer',
            subType: 'labelPoint',
            method: getList,
            params: {
              type: 2,
              size: 1000,
              category: 2
            },
            backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
            className: 'ysf-box',
            showPanel: false,
            layerName: 'fm-qy',
            incident: (e) => {
              const { attrParams } = e.overlay
              // 删除
              destroyPop()
              if (!attrParams.firmName) {
                return
              }
              addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
              window.$viewer.addLayer(addPopLayers[attrParams.id])
              let iconEl = `<div class="marsBlueGradientPnl">
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
              let divIcon = new DC.DivIcon(
                new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
                `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
              )
              let incident = () => {
                destroyPop()
              }
              divIcon.on(DC.MouseEventType.CLICK, incident)
              addPopLayers[attrParams.id].addOverlay(divIcon)
            }
          }
        ]
      },
      {
        parentId: '3',
        id: '3-3',
        label: '公共管网',
        children: [
          // 给水管网、污水管网、燃气管网、雨水管网
          {
            parentId: '3-3',
            id: '3-3-2',
            label: '污水管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'wsgw',
            source: wsgw,
            color: DC.Color.DARKBLUE.withAlpha(0.9),
            height: 60.2,
          },
          {
            parentId: '3-3',
            id: '3-3-4',
            label: '雨水管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'ysgw',
            source: ysgw,
            color: DC.Color.CYAN.withAlpha(0.9),
            height: 60,
          },
          // {
          //   id: '3-3-1',
          //   label: '给水管网',
          //   type: 'layer',
          //   subType: 'geojsonPipe',
          //   layerName: 'gsgw',
          //   source: gsgw,
          //   color: DC.Color.BLUE.withAlpha(0.9),
          //   height: 60.4,
          // },
          // {
          //   id: '3-3-3',
          //   label: '燃气管网',
          //   type: 'layer',
          //   subType: 'geojsonPipe',
          //   layerName: 'rqgw',
          //   source: rqgw,
          //   color: DC.Color.RED.withAlpha(0.9),
          //   height: 60.6,
          // },
        ]
      },
      {
        parentId: '3',
        id: '3-4',
        label: '污水提升泵站',
        label: '事故应急池',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        // className: 'sk-box',
        // showPanel: false,
        params: {
          type: 4,
          size: 1000
          type: 2,
          size: 1000,
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wstsb.png',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
        showPanel: false,
        layerName: 'wstsbz',
        layerName: 'sg-yjc',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          if (!attrParams.imageUrl) {
          if (!attrParams.firmName) {
            return
          }
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
                  <div>${attrParams.fullName}</div>
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -367,8 +222,66 @@
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        parentId: '3',
        id: '3-3',
        label: '切断阀',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 3,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
        className: 'ysf-box',
        showPanel: false,
        layerName: 'qdf',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        id: '3-4',
        label: '闸坝',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 4,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/zb.png',
        className: 'sk-box',
        showPanel: false,
        layerName: 'zb'
      },
      {
@@ -416,7 +329,7 @@
      {
        parentId: '3',
        id: '3-6',
        label: '应急泵',
        label: '坑塘',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
@@ -424,10 +337,10 @@
          type: 6,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjb.png',
        className: 'yjb-box',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/kt.png',
        className: 'sk-box',
        showPanel: false,
        layerName: 'yjb',
        layerName: 'kt',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
@@ -457,92 +370,49 @@
      {
        parentId: '3',
        id: '3-8',
        label: '沟渠',
        type: 'layer',
        subType: 'geojsonPolygon',
        method: getGouQu,
        params: {
          type: 8,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/gouqu.png',
        className: 'xfs-box',
        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'
      // },
      {
        parentId: '3',
        id: '3-10',
        label: '排水口',
        id: '3-7',
        label: '洼地',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 10,
          type: 7,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/psk.png',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/wd.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'psk',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
        layerName: 'wd'
      },
      // {
      //   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'
      // }
      {
        parentId: '3',
        id: '3-8',
        label: '桥梁',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 8,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ql.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'ql'
      },
      {
        parentId: '3',
        id: '3-9',
        label: '雨水管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'ysgw',
        source: ysgw,
        color: DC.Color.CYAN.withAlpha(0.9),
        height: 60,
      },
    ]
  },
@@ -630,46 +500,47 @@
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        parentId: '4',
        id: '4-9',
        label: '暂定',
        type: 'layer',
        subType: 'labelPoint',
        method: getRiskList,
        params: {
          riskLevel: 9,
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-zd',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd.png',
        showPanel: false,
        layerName: 'fxyZdLarger',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>${attrParams.firmName || ''}</li>
            <li>${attrParams.name || ''}</li>
            <li>${attrParams.riskLevelName || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-three">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      }
      // {
      //   parentId: '4',
      //   id: '4-9',
      //   label: '暂定',
      //   type: 'layer',
      //   subType: 'labelPoint',
      //   method: getRiskList,
      //   params: {
      //     riskLevel: 9,
      //     size: 1000
      //   },
      //   showParams: 'category',
      //   className: 'fxy-zd',
      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd.png',
      //   showPanel: false,
      //   layerName: 'fxyZdLarger',
      //   incident: (e) => {
      //     const { attrParams } = e.overlay
      //     // 删除
      //     destroyPop()
      //     addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
      //     window.$viewer.addLayer(addPopLayers[attrParams.name])
      //     let iconEl = `<div class="marsBlueGradientPnl">
      //       <li>${attrParams.firmName || ''}</li>
      //       <li>${attrParams.name || ''}</li>
      //       <li>${attrParams.riskLevelName || ''}</li>
      //       </div>`
      //     let divIcon = new DC.DivIcon(
      //       new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
      //       `<div class="public-map-popup-three">
      //               ${iconEl}
      //             </div>`
      //     )
      //     let incident = () => {
      //       destroyPop()
      //     }
      //     divIcon.on(DC.MouseEventType.CLICK, incident)
      //     addPopLayers[attrParams.name].addOverlay(divIcon)
      //   }
      // }
    ]
  },
@@ -679,7 +550,7 @@
    type: 'layer',
    subType: 'geojsonWall',
    layerName: 'yqfw',
    source: yqfw_01
    source: yqfw
  },
  {
@@ -710,7 +581,8 @@
      panoramaShow.value = true
    }
  },
  {
  /* {
    id: '8',
    label: '地面全景分布',
    type: 'layer',
@@ -737,7 +609,7 @@
      panoramaUrl.value = attrParams.url
      panoramaShow.value = true
    }
  },
  }, */
]
// let modellayer = new DC.VectorLayer("modellayer").addTo(window.$viewer)
@@ -804,10 +676,10 @@
        if (!addTileLayers[item.layerName]) {
          // addTileLayers[item.layerName] = []
          // let tile = window.$viewer.delegate.scene.primitives.add(new window.$Cesium.Cesium3DTileset({
          //   url: '/zhyq/mx/tile_01/tileset.json',
          //   url: '/zhyq-lc/mx/tile_01/tileset.json',
          // }))
          //   url: '/zhyq/mx/tile_01/tileset.json',
          //   url: '/zhyq-lc/mx/tile_01/tileset.json',
          // }), 121323)
          // item.urlData.forEach(i => {
@@ -901,9 +773,11 @@
          addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
          window.$viewer.addLayer(addTileLayers[item.layerName])
          item.source.features.forEach(i => {
          console.log(item.source.geometries, 906666)
          item.source.geometries.forEach(i => {
            let wall = new DC.Wall(
              i.geometry.coordinates[0].map(d => [d[0], d[1], 125].join(',')).join(';')
              i.coordinates[0].map(d => [d[0], d[1], 125].join(',')).join(';')
            )
            wall.setStyle({
@@ -933,14 +807,14 @@
            }
            return positions
          }
          item.source.features.forEach(i => {
          console.log(item.source.geometries, 465465)
          item.source.geometries.forEach(i => {
            let polylineVolume = new DC.PolylineVolume(
              i.geometry.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
              i.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
              computeCircle(1.6)
            )
            if (i.properties.RefName.indexOf('拟建') != -1) {
            if ('properties' in i && i.properties?.RefName.indexOf('拟建') != -1) {
              polylineVolume.setStyle({
                material: DC.Color.fromBytes(255, 0, 0, 230)
              })
@@ -1105,16 +979,14 @@
  EventBus.emit('restHandleDelChange', `2`)
  EventBus.emit('restHandleDelChange', `3-1`)
  EventBus.emit('restHandleDelChange', `3-2`)
  // 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-3`)
  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', `3-9`)
  EventBus.emit('restHandleDelChange', `4-1`)
  EventBus.emit('restHandleDelChange', `4-2`)
  EventBus.emit('restHandleDelChange', `4-9`)