智慧园区前端大屏
shuishen
2024-12-06 f116a472f8aa9823aceef2d325f17165d394c575
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-03 13:44:43
 * @LastEditTime: 2024-12-06 16:13:43
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -152,6 +152,7 @@
    label: '应急空间',
    children: [
      {
        parentId: '3',
        id: '3-1',
        label: '应急池',
        type: 'layer',
@@ -175,8 +176,8 @@
          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>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -192,6 +193,7 @@
        }
      },
      {
        parentId: '3',
        id: '3-2',
        label: '阀门',
        type: 'layer',
@@ -215,8 +217,8 @@
          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>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -233,11 +235,13 @@
      },
      {
        parentId: '3',
        id: '3-3',
        label: '公共管网',
        children: [
          // 给水管网、污水管网、燃气管网、雨水管网
          {
            parentId: '3-3',
            id: '3-3-2',
            label: '污水管网',
            type: 'layer',
@@ -248,6 +252,7 @@
            height: 60.2,
          },
          {
            parentId: '3-3',
            id: '3-3-4',
            label: '雨水管网',
            type: 'layer',
@@ -281,6 +286,7 @@
      },
      {
        parentId: '3',
        id: '3-4',
        label: '污水提升泵站',
        type: 'layer',
@@ -324,6 +330,7 @@
      },
      {
        parentId: '3',
        id: '3-5',
        label: '水库',
        type: 'layer',
@@ -365,6 +372,7 @@
      },
      {
        parentId: '3',
        id: '3-6',
        label: '应急泵',
        type: 'layer',
@@ -388,8 +396,8 @@
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>${attrParams.firmName}</div>
            <div>${attrParams.mainFuncName}</div>
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -406,6 +414,7 @@
      },
      {
        parentId: '3',
        id: '3-8',
        label: '沟渠',
        type: 'layer',
@@ -437,6 +446,7 @@
      //   layerName: 'fsclz'
      // },
      {
        parentId: '3',
        id: '3-10',
        label: '排水口',
        type: 'layer',
@@ -460,8 +470,8 @@
          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>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -499,6 +509,7 @@
    label: '风险源',
    children: [
      {
        parentId: '4',
        id: '4-1',
        label: '一般',
        type: 'layer',
@@ -520,9 +531,9 @@
          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>
            <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),
@@ -538,6 +549,7 @@
        }
      },
      {
        parentId: '4',
        id: '4-2',
        label: '较大',
        type: 'layer',
@@ -559,9 +571,9 @@
          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>
            <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),
@@ -577,6 +589,7 @@
        }
      },
      {
        parentId: '4',
        id: '4-9',
        label: '暂定',
        type: 'layer',
@@ -736,6 +749,7 @@
}
const handleCheckChange = (data) => {
  let options = treeRef.value?.getCheckedNodes()
  collectedNodes.value = []
  collectNodesWithFlag(data)
@@ -884,9 +898,16 @@
              computeCircle(1.6)
            )
            polylineVolume.setStyle({
              material: item.color
            })
            if (i.properties.RefName.indexOf('拟建') != -1) {
              polylineVolume.setStyle({
                material: DC.Color.fromBytes(234, 93, 240, 230)
              })
            } else {
              polylineVolume.setStyle({
                material: item.color
              })
            }
            addTileLayers[item.layerName].addOverlay(polylineVolume)
          })
        } else {
@@ -973,14 +994,20 @@
}
const restHandleDelChange = (key) => {
  let checkIds = treeRef.value?.getCheckedKeys()
  if (checkIds && !checkIds.some(i => i == key)) {
    return
  }
  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key)))
  handleCheckChange([findObjectById(data, key)])
  let selectData = findObjectById(data, key)
  let parentId = null
  if (selectData && 'parentId' in selectData) parentId = selectData.parentId
  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key) && i != parentId))
  handleCheckChange([selectData])
}
// 飞到园区范围
@@ -1012,10 +1039,8 @@
// 关闭所有选中的,除了倾斜,园区分布,空中全景
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`)
@@ -1026,7 +1051,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', `4-9`)
@@ -1049,14 +1073,16 @@
// 销毁
function destroyPop () {
  let arr = Object.keys(addPopLayers)
  if (arr.length > 0) {
    arr.forEach(i => {
      addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
      addPopLayers[i] = null
      delete addPopLayers[i]
    })
    addPopLayers = {}
  if (addPopLayers && addPopLayers != null) {
    let arr = Object.keys(addPopLayers)
    if (arr.length > 0) {
      arr.forEach(i => {
        addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
        addPopLayers[i] = null
        delete addPopLayers[i]
      })
      addPopLayers = {}
    }
  }
}