| | |
| | | const defaultImg = '/assets/images/map/solidwaste/voc.png' |
| | | const setting = '/assets/images/map/solidwaste/gf_green.png' |
| | | |
| | | // 请求接口数据 |
| | | const mapApi = require('../../../api/mapApi').default |
| | | // 使用封装方法 |
| | | const AnimalService = require('../service/AnimalService').default |
| | | |
| | | const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default |
| | | |
| | | module.exports = function () { |
| | | /** |
| | |
| | | * @param L leaflet对象 |
| | | */ |
| | | this.init = async (layer, L) => { |
| | | // const SolidWasteIcon = this.SolidWasteIcon() |
| | | this.animalService = new AnimalService({ |
| | | L: L, |
| | | layer: layer |
| | | }) |
| | | const res = await mapApi.getSolidWaste() |
| | | // console.log(res) |
| | | const data = res.Result.DataInfo || {} |
| | | for (let i = 0; i < data.length; i++) { |
| | | const result = await mapApi.getSolidWaste() |
| | | const getSolidWasteData = result.Result.DataInfo || {} |
| | | // 循环遍历数据 根据进行marker 的创建 |
| | | for (let i = 0; i < getSolidWasteData.length; i++) { |
| | | // 经纬度 位置 |
| | | const positionX = data[i].Latitude |
| | | const positionY = data[i].Longitude |
| | | const positionX = getSolidWasteData[i].Latitude |
| | | const positionY = getSolidWasteData[i].Longitude |
| | | |
| | | // 定义类型 用来区分数据的不同 |
| | | const judgeValue = data[i].StorageQty |
| | | // 定义类型 用来区分数据的不同 1.接口接口数据来进行数据的判断 2.根据数据类型的不同,进行不同类型的图片显示 |
| | | const judgeValue = getSolidWasteData[i].StorageQty |
| | | var iconUrl = this.differentTypes(judgeValue) |
| | | |
| | | const marker = L.marker.magic([positionX, positionY], { |
| | | const marker = L.marker([positionX, positionY], { |
| | | test: getSolidWasteData[i], |
| | | icon: L.icon({ |
| | | iconUrl: iconUrl, |
| | | iconSize: [50, 50], |
| | | iconAnchor: [25, 25] |
| | | }) |
| | | }) |
| | | |
| | | layer.addLayer(marker) |
| | | } |
| | | } |
| | | |
| | | this.bindTooltip = (layer) => { |
| | | return '测试固废' |
| | | return layer.options.test.Name |
| | | } |
| | | |
| | | this.clickListener = (e) => { |
| | | this.clickListener = async (e) => { |
| | | this.animalService.pulseEffect(e.latlng) |
| | | // this.setPanTo(e.latlng, 200) |
| | | console.log(e) |
| | | return this.PublicBounced.$el |
| | | const dataValue = { |
| | | StoragePlaceId: e.layer.options.test.StoragePlaceId |
| | | } |
| | | const result = await mapApi.getSolidWasteBaseInfo(dataValue) |
| | | // console.log(result) |
| | | const PublicBounced = window.Vue.extend(publicBounced) |
| | | const instance = new PublicBounced() |
| | | instance.$mount() |
| | | document.body.appendChild(instance.$el) |
| | | instance.setData(result.Result.DataInfo, 'gufei') |
| | | } |
| | | |
| | | // panTo |
| | | this.setPanTo = (pos, value) => { |
| | | var position = pos |
| | | position = this.layer.latLngToLayerPoint(position) |
| | | position.y += value |
| | | position = this.layer.layerPointToLatLng(position) |
| | | this.layer.flyTo(position) |
| | | } |
| | | |
| | | // 不同类型图片封装 |
| | |
| | | } |
| | | return effectOfChange |
| | | } |
| | | // 固废点击进行的 内容的设置 |
| | | // SetSolidWasteContent (config, containerPopup) { |
| | | // this.SolidWastePopup = containerPopup |
| | | // } |
| | | } |