派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-05-13 275ab635e9bb15e083462abf15070d601b577e62
src/components/LayerController/logic/SourcesPollution.js
New file
@@ -0,0 +1,22 @@
/**
 * 污染源
 *  */
// 请求接口数据
const mapApi = require('../../../api/mapApi').default
// 使用封装方法
const AnimalService = require('../service/AnimalService').default
module.exports = function () {
  this.init = async (layer, L) => {
    this.animalService = new AnimalService({
      L: L,
      layer: layer
    })
    const result = await mapApi.getSourcesPoll()
    console.log(result)
    const resultData = result.Result.DataInfo || []
    const polygon = L.polygon(resultData, { color: 'yellow' })
    polygon.addTo(layer)
  }
}