智慧园区前端大屏
shuishen
2024-12-03 57e4d6cb8209d13dbc9265636b456ee61a3ff5be
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 12:51:24
 * @LastEditTime: 2024-12-03 13:29:41
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -550,6 +550,45 @@
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        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)
        }
      }
    ]
  },
@@ -965,6 +1004,8 @@
  EventBus.emit('restHandleDelChange', `4`)
  EventBus.emit('restHandleDelChange', `4-1`)
  EventBus.emit('restHandleDelChange', `4-2`)
  EventBus.emit('restHandleDelChange', `4-9`)
  EventBus.emit('restHandleDelChange', `8`)
  destroyPop()
}
@@ -984,13 +1025,13 @@
// 销毁
function destroyPop () {
  let arr = Object.keys(addPopLayers)
  if(arr.length > 0){
  if (arr.length > 0) {
    arr.forEach(i => {
    addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
    addPopLayers[i] = null
    delete addPopLayers[i]
  })
  addPopLayers = {}
      addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
      addPopLayers[i] = null
      delete addPopLayers[i]
    })
    addPopLayers = {}
  }
}