| | |
| | | |
| | | module.exports = function () { |
| | | /** |
| | | * 返回marker对象数组 |
| | | * @param L leaflet对象 |
| | | */ |
| | | * 返回marker对象数组 |
| | | * @param L leaflet对象 |
| | | */ |
| | | this.init = async (layer, L) => { |
| | | // const SolidWasteIcon = this.SolidWasteIcon() |
| | | this.animalService = new AnimalService({ |
| | |
| | | layer: layer |
| | | }) |
| | | const res = await mapApi.getCompany() |
| | | console.log(res) |
| | | // console.log(res) |
| | | const data = res.Result.DataInfo || {} |
| | | for (let i = 0; i < data.length; i++) { |
| | | console.log(data[i]) |
| | | // console.log(data[i]) |
| | | // 经纬度 位置 |
| | | const positionX = data[i].Latitude |
| | | const positionY = data[i].Longitude |
| | | |
| | | var iconUrl = companyImg |
| | | const marker = L.marker.magic([positionX, positionY], { |
| | | const marker = L.marker([positionX, positionY], { |
| | | icon: L.icon({ |
| | | iconUrl: iconUrl, |
| | | iconSize: [50, 50], |
| | | iconAnchor: [25, 25] |
| | | }) |
| | | iconSize: [30, 30], |
| | | iconAnchor: [13, 5] |
| | | }), |
| | | test: data[i] |
| | | }) |
| | | |
| | | marker.bindTooltip(data[i].name, { |
| | | permanent: true, |
| | | offset: [0, 14], |
| | | direction: 'bottom', |
| | | className: 'company-bindTooltip' |
| | | }).bindPopup('<div class="company-bindTooltip-hover"><h3>污染物产生统计</h3><ul>' + |
| | | '<li>生产设施:30(个)</li>' + |
| | | '<li>治理设施:30(个)</li>' + |
| | | '</ul></div>') |
| | | .on('mouseover', (e) => marker.openPopup()) |
| | | .on('mouseout', (e) => marker.closePopup()) |
| | | layer.addLayer(marker) |
| | | } |
| | | } |
| | | |
| | | this.bindTooltip = (layer) => { |
| | | console.log(layer) |
| | | return '企业' |
| | | } |
| | | |
| | | this.clickListener = (e) => { |
| | | this.animalService.pulseEffect(e.latlng) |
| | | console.log(e) |
| | | return this.PublicBounced.$el |
| | | /* |
| | | * 点位点击事件 |
| | | * |
| | | * */ |
| | | this.clickListener = (e) => { |
| | | // this.animalService.pulseEffect(e.latlng) |
| | | const dataValue = { |
| | | StoragePlaceId: e.layer.options.test.name |
| | | } |
| | | debugger |
| | | console.log(dataValue) |
| | | // return this.PublicBounced.$el |
| | | } |
| | | } |
| | | } |