派生自 wuyushui/SewerAndRainNetwork

chenyabin
2021-03-31 637c7047467508419f7d50d63194b58ab0180f00
添加企业点图层
1个文件已添加
3个文件已修改
69 ■■■■■ 已修改文件
src/api/mapApi.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mapUrl.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/logic/Company.js 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/Constants.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mapApi.js
@@ -14,5 +14,8 @@
  },
  getSolidWaste (data) {
    return axios.get(mapUrl.getSolidWaste, data)
  },
  getCompany (data) {
    return axios.get(mapUrl.getCompany, data)
  }
}
src/api/mapUrl.js
@@ -6,3 +6,5 @@
export const GetUser = $HOST + '/user/getUser'
export const getSolidWaste = $HOST + '/wasteSolid/getSolidWaste'
export const getCompany = $HOST + '/company/getCompany'
src/components/LayerController/logic/Company.js
New file
@@ -0,0 +1,59 @@
/**
 * 固废
 */
// 区分不同类型 使用不同img
const companyImg = '/assets/images/map/company.png'
const mapApi = require('../../../api/mapApi').default
const AnimalService = require('../service/AnimalService').default
module.exports = function () {
  /**
     * 返回marker对象数组
     * @param L leaflet对象
     */
  this.init = async (layer, L) => {
    // const SolidWasteIcon = this.SolidWasteIcon()
    this.animalService = new AnimalService({
      L: L,
      layer: layer
    })
    const res = await mapApi.getCompany()
    console.log(res)
    const data = res.Result.DataInfo || {}
    for (let i = 0; i < data.length; i++) {
      // 经纬度 位置
      const positionX = data[i].Latitude
      const positionY = data[i].Longitude
      var iconUrl = companyImg
      const marker = L.marker.magic([positionX, positionY], {
        icon: L.icon({
          iconUrl: iconUrl,
          iconSize: [50, 50],
          iconAnchor: [25, 25]
        })
      })
      layer.addLayer(marker)
    }
  }
  this.bindTooltip = (layer) => {
    console.log(layer)
    return '企业'
  }
  this.clickListener = (layer) => {
    /* this.animalService.pulseEffect(e.latlng)
    console.log(e)
    return this.PublicBounced.$el
    */
    console.log(layer)
  }
  // 固废点击进行的 内容的设置
  // SetSolidWasteContent (config, containerPopup) {
  //   this.SolidWastePopup = containerPopup
  // }
}
src/conf/Constants.js
@@ -5,11 +5,12 @@
}
export const logicMapper = {
  fsqy: 'Sample.js',
  // fsqy: 'Sample.js',
  fspfk: 'Sample.js',
  fsjcd: 'Sample.js',
  wasteGasJcd: 'WasteGas.js',
  solidWasteJcd: 'SolidWaste.js'
  solidWasteJcd: 'SolidWaste.js',
  fsqy: 'Company.js'
}
export const props = {