派生自 wuyushui/SewerAndRainNetwork

seatonwan9
2021-05-31 dd087d8c1b1406d8438d80e02a71cc77595e7e10
src/components/LayerController/logic/WasteWater.js
@@ -1,15 +1,19 @@
/**
 * 废水
 */
// 公共方法 panTo() 引用
const { setPanTo } = require('../../../utils/utils')
const AnimalService = require('../service/AnimalService').default
const mapApi = require('../../../api/mapApi').default
// 弹窗数据引进
const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default
const WasteWaterIndex = require('@components/base-page/WasteWater/WasteWaterIndex').default
const NormalImg = '/assets/images/map/wastewater/fs_green.png' // 正常
const NormalImg = '/assets/images/map/wastewater/fs_bright_green.png' // 正常
const OffImg = '/assets/images/map/wastewater/fs_gray.png' // 停运
const AbnormalImg = '/assets/images/map/wastewater/fs_blue.png' // 异常
const MissImg = '/assets/images/map/wastewater/fs_yellow.png' // 缺失
const MissImg = '/assets/images/map/wastewater/fs_bright_green.png' // 缺失
const AlarmImg = '/assets/images/map/wastewater/fs_red.png' // 报警闪烁
const WarnImg = '/assets/images/map/wastewater/fs_orange.png' // 预警闪烁
@@ -23,10 +27,22 @@
      L: L,
      layer: layer
    })
    const res = await mapApi.getWasteWater()
    console.log(res)
    const data = res.Result.DataInfo
    console.log(data)
    const param = {
      companyId: 3900100145, // 企业编码
      id: '',
      monType: 1, // 废水
      userCode: 'wenchun.deng', // 用户名称
      monDuration: '',
      epName: '',
      secdDeptId: '',
      contrLevel: '',
      dataStatus: '',
      dataFlag: '',
      runStatus: '',
      emissTypeId: ''
    }
    const res = await mapApi.getWasteWater(param)
    const data = res.Result.DataInfo || {}
    for (let i = 0; i < data.length; i++) {
      // 经纬度 位置
      const positionX = data[i].Latitude
@@ -35,12 +51,12 @@
      // 定义类型 用来区分数据的不同
      const testValue = data[i].ContrLevel
      const iconUrl = this.differentTypes(testValue)
      const marker = L.marker.magic([positionX, positionY], {
        test: data[i],
      const marker = L.marker([positionX, positionY], {
        totransferData: data[i],
        icon: L.icon({
          iconUrl: iconUrl,
          iconSize: [50, 50],
          iconAnchor: [25, 25]
          iconSize: [30, 30],
          iconAnchor: [15, 15]
        })
      })
      layer.addLayer(marker)
@@ -48,21 +64,28 @@
  }
  this.bindTooltip = (layer) => {
    return layer.options.test.Name
    return '<div class="company-bindTooltip-hover"><h3>天津石化</h3></div>' + layer.options.totransferData.Name
  }
  this.clickListener = async (e) => {
    // console.log(e)
  this.clickListener = (e) => {
    this.animalService.pulseEffect(e.latlng)
    const dataValue = {
      StoragePlaceId: e.layer.options.test.StoragePlaceId
    }
    const result = await mapApi.getWasteWater(dataValue)
    const PublicBounced = window.Vue.extend(publicBounced)
    const instance = new PublicBounced()
    instance.setData(result)
    instance.$mount()
    document.body.appendChild(instance.$el)
    setPanTo(e.latlng, 200)
    // 弹框标题
    const title = e.layer.options.totransferData.Name
    const res = e.layer.options.totransferData
    window.$layer.open({
      content: {
        comp: WasteWaterIndex, // 组件
        parent: this, // 父组件
        data: { // 传递的参数
          // info: this.info
          storagePlaceId: res,
          OnlineMonEmissPointId: e.layer.options.totransferData.OnlineMonEmissPointId,
          LabMonPointId: res.LabMonPointId
        }
      },
      title: '天津石化' + title // 标题
    })
  }
  // 根据返回值的不同标记不同图片