派生自 wuyushui/SewerAndRainNetwork

seatonwan9
2021-05-28 00b89e4c17c3d34301be0bd51604b0c29ed77c3a
src/components/LayerController/logic/EnvironmentRisk.js
@@ -1,7 +1,7 @@
/**
 * 环境风险
 */
// const EnvironmentRiskIndex = require('@components/BaseNav/').default
// const EnvironmentRiskIndex = require('@components/base-page/').default
// 请求接口数据
const mapApi = require('../../../api/mapApi').default
@@ -11,6 +11,8 @@
const echarts = require('echarts/lib/echarts')
module.exports = function () {
  // 存放环形图的数组
  let riskLayerGroup = []
  /**
   * 返回marker对象数组
   * @param L leaflet对象
@@ -20,6 +22,11 @@
      L: L,
      layer: layer
    })
    layer.addLayer(riskLayerGroup)
  }
  this.start = async () => {
    riskLayerGroup = window.layerFactory.L.featureGroup().addTo(window.layerFactory.map)
    const result = await mapApi.getRiskEnterprise()
    const features = result.features
    for (var i = 0; i < features.length; i++) {
@@ -33,25 +40,30 @@
      if (distract !== '长江沿线') {
        continue
      }
      const bgMarker = L.marker([coordinates[1], coordinates[0]], {
        icon: L.divIcon({
      window.layerFactory.L.marker([coordinates[1], coordinates[0]], {
        icon: this.animalService.L.divIcon({
          className: '',
          iconAnchor: [15, 45],
          iconSize: [40, 40],
          html: '<div style="width: 40px; height: 40px; background-color: rgba(255,255,255,1); position: relative; border-radius: 50%;"></div>'
        })
      })
      layer.addLayer(bgMarker)
      const chartMarker = L.marker([coordinates[1], coordinates[0]], {
        icon: L.divIcon({
      }).addTo(riskLayerGroup)
      // this.animalService.layer.addLayer(bgMarker)
      window.layerFactory.L.marker([coordinates[1], coordinates[0]], {
        icon: this.animalService.L.divIcon({
          className: '',
          iconAnchor: [30, 60],
          iconSize: [70, 70],
          html: '<div id="qy_id_' + qyId + '" style="width: 70px; height: 70px; background-color: transparent; position: relative; border-radius: 50%;"></div>'
        })
      })
      layer.addLayer(chartMarker)
      }).addTo(riskLayerGroup)
      chartRender(properties)
    }
  }
  this.destory = () => {
    if (riskLayerGroup) {
      riskLayerGroup.remove()
    }
  }
@@ -61,7 +73,6 @@
   * @returns {string}
   */
  this.bindTooltip = (layer) => {
  }
  /**
@@ -69,9 +80,12 @@
   * @param e
   */
  this.clickListener = (e) => {
  }
  /**
   * 环形饼图
   * @param properties
   */
  function chartRender (properties) {
    const qyId = properties.QY_ID
    const qyjc = properties.QY_JC
@@ -98,7 +112,7 @@
        {
          type: 'text',
          left: 'center',
          top: '35%',
          top: '43%', // 设置环形文字的top位置
          style: {
            text: num,
            textAlign: 'center',