智慧园区前端大屏
shuishen
2024-11-08 ae92636a63fa2dcbc5708b7a27d6fd291e1c1981
src/views/layout/components/scomponents/layersControl.vue
@@ -4,9 +4,9 @@
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-07 17:17:21
 * @FilePath: \bigScreen\src\views\layout\components\scomponents\layersControl.vue
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
-->
<template>
  <public-box>
@@ -50,7 +50,10 @@
import { getList } from "@/api/space/space"
import { getList as getRiskList } from "@/api/riskSource/riskSource"
import yqfw from "@/assets/json/yqfw"
import pipeLine from "@/assets/json/line"
import gsgw from "@/assets/json/gsgw"
import rqgw from "@/assets/json/rqgw"
import wsgw from "@/assets/json/wsgw"
import ysgw from "@/assets/json/ysgw"
import { onUnmounted } from 'vue'
const { VITE_APP_BASE } = import.meta.env
@@ -205,10 +208,50 @@
  {
    id: '6',
    label: '地下管网',
    type: 'layer',
    subType: 'geojsonPipe',
    layerName: 'dxgw',
    source: pipeLine
    children: [
      // 给水管网、污水管网、燃气管网、雨水管网
      {
        id: '6-1',
        label: '给水管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'gsgw',
        source: gsgw,
        color: DC.Color.BLUE,
        height: 1,
      },
      {
        id: '6-2',
        label: '污水管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'wsgw',
        source: wsgw,
        color: DC.Color.BLACK,
        height: 2,
      },
      {
        id: '6-3',
        label: '燃气管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'rqgw',
        source: rqgw,
        color: DC.Color.RED,
        height: 3,
      },
      {
        id: '6-4',
        label: '雨水管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'ysgw',
        source: ysgw,
        color: DC.Color.CYAN,
        height: 4,
      },
    ]
  },
]
@@ -224,10 +267,10 @@
    return 'arr'
  }
}
// 用于存储收集到的节点的数组
// 用于存储收集到的节点的数组
const collectedNodes = reactive([])
// 递归函数,收集所有 flag 为 true 的子节点
// 递归函数,收集所有 flag 为 true 的子节点
const collectNodesWithFlag = (nodes) => {
  if (checkType(nodes) == 'obj') {
    if (nodes.type == 'layer') {
@@ -351,7 +394,7 @@
            )
            polylineVolume.setStyle({
              material: DC.Color.RED
              material: item.color
            })
            addTileLayers[item.layerName].addOverlay(polylineVolume)
          })
@@ -376,9 +419,9 @@
}
onMounted(() => {
  // handleCheckChange(data.filter(i => i.id == '1'), {
  //   checkedKeys: ['1']
  // })
  handleCheckChange(data.filter(i => i.id == '1'), {
    checkedKeys: ['1']
  })
})
onUnmounted(() => {
@@ -416,4 +459,4 @@
    }
  }
}
</style>
</style>