派生自 wuyushui/SewerAndRainNetwork

seatonwan9
2021-05-30 d195225b4e628e541caca0944d54fec027572a06
src/components/LayerController/logic/GovernEquipment.js
@@ -2,13 +2,15 @@
 * 污染源
 */
// 信息组件
// const SourcePollutionIndex = require('../../base-page/RiskSource/RiskSourceIndex.vue').default
const GovernEquipmentIndex = require('../../base-page/RiskSource/RiskSourceIndex.vue').default
// 使用封装方法
const AnimalService = require('../service/AnimalService').default
// 请求接口数据
const mapApi = require('../../../api/mapApi').default
// 公共方法 panTo() 引用
// const { setPanTo } = require('../../../utils/utils')
const { setPanTo } = require('../../../utils/utils')
const governGreen = '/assets/images/map/governEquipment/govern_green.png'
module.exports = function () {
  /**
@@ -20,17 +22,16 @@
      L: L,
      layer: layer
    })
    const result = await mapApi.getEnvironmentRiskPoint()
    const data = result[0]
    const data = await mapApi.getGovernEquipment()
    for (let i = 0; i < data.length; i++) {
      const postion = [data[i].Latitude, data[i].Longitude] // 坐标
      const iconUrl = this.sourcePollutionIconUrl(1) // 治理设施图标
      const iconUrl = this.governIconUrl(data[i].status) // 治理设施图标
      const marker = L.marker(postion, {
        totransferData: data[i],
        icon: L.icon({
          iconUrl: iconUrl,
          iconSize: [20, 20],
          iconAnchor: [10, 10]
          iconSize: [30, 30],
          iconAnchor: [15, 15]
        })
      })
      layer.addLayer(marker)
@@ -38,15 +39,47 @@
  }
  /**
   * 提示窗
   * @param layer
   * @returns {string}
   */
  this.bindTooltip = (layer) => {
    return layer.options.totransferData.governName
  }
  /**
   * 信息弹窗
   * @param e
   */
  this.clickListener = (e) => {
    // 脉冲效果
    this.animalService.pulseEffect(e.latlng)
    // 信息弹窗平移
    setPanTo(e.latlng, 200)
    // 弹框标题
    const title = e.layer.options.totransferData.Name
    window.$layer.open({
      content: {
        comp: GovernEquipmentIndex, // 组件
        parent: this, // 父组件
        data: { // 传递的参数
          riskSourceId: e.layer.options.totransferData.no
        }
      },
      title: title // 标题
    })
  }
  /**
   * 治理设施图标配置
   * @param t
   * @returns {string}
   */
  this.sourcePollutionIconUrl = (t) => {
  this.governIconUrl = (t) => {
    let iconUrl = null
    switch (t) {
      case 1:
        iconUrl = ''
        iconUrl = governGreen
        break
      case 2:
        iconUrl = ''