| | |
| | | /** |
| | | * 废水 |
| | | */ |
| | | const AnimalService = require('../service/AnimalService').default |
| | | const AjaxUtils = require('../../../utils/AjaxUtils').default |
| | | |
| | | // const getWasteWater = require('../../../utils/axios').default |
| | | // 公共方法 panTo() 引用 |
| | | const { setPanTo } = require('../../../utils/utils') |
| | | |
| | | const AnimalService = require('../service/AnimalService').default |
| | | const mapApi = require('../../../api/mapApi').default |
| | | // 弹窗数据引进 |
| | | const WasteWaterIndex = require('@components/base-page/WasteWater/WasteWaterIndex').default |
| | | |
| | | 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_bright_green.png' // 缺失 |
| | | const AlarmImg = '/assets/images/map/wastewater/fs_red.png' // 报警闪烁 |
| | | const WarnImg = '/assets/images/map/wastewater/fs_orange.png' // 预警闪烁 |
| | | |
| | | module.exports = function () { |
| | | /** |
| | | * 返回marker对象数组 |
| | | * @param L leaflet对象 |
| | | */ |
| | | this.init = (layer, L) => { |
| | | this.animalService = new AnimalService({ L: L, layer: layer }) |
| | | AjaxUtils.get4JsonDataByUrl('http://10.246.162.140:8080/EPInterface/DataService/EPMapService.asmx/ObtainningConInfo', { |
| | | companyId: 3900100145, |
| | | this.init = async (layer, L) => { |
| | | this.animalService = new AnimalService({ |
| | | L: L, |
| | | layer: layer |
| | | }) |
| | | const res = await mapApi.getWasteWater({ |
| | | companyId: 3900100145, // 企业名称 |
| | | id: '', |
| | | monType: 1, |
| | | userCode: 'wenchun.deng', |
| | | monType: 1, // 值为1查询废水 |
| | | userCode: 'wenchun.deng', // 角色名称 |
| | | monDuration: '', |
| | | epName: '', |
| | | secdDeptId: '', |
| | |
| | | dataFlag: '', |
| | | runStatus: '', |
| | | emissTypeId: '' |
| | | }, function (res) { |
| | | console.log(res) |
| | | const data = res.data.Result.DataInfo |
| | | for (let i = 0; i < data.length; i++) { |
| | | // 经纬度 位置 |
| | | const positionX = data[i].Latitude |
| | | const positionY = data[i].Longitude |
| | | layer.addLayer(L.marker([positionX, positionY], {})) |
| | | } |
| | | }) |
| | | const data = res.Result.DataInfo || {} |
| | | for (let i = 0; i < data.length; i++) { |
| | | // 经纬度 位置 |
| | | const positionX = data[i].Latitude |
| | | const positionY = data[i].Longitude |
| | | |
| | | // 定义类型 用来区分数据的不同 |
| | | const testValue = data[i].ContrLevel |
| | | const iconUrl = this.differentTypes(testValue) |
| | | const marker = L.marker([positionX, positionY], { |
| | | totransferData: data[i], |
| | | icon: L.icon({ |
| | | iconUrl: iconUrl, |
| | | iconSize: [35, 35], |
| | | iconAnchor: [15, 15] |
| | | }) |
| | | }) |
| | | layer.addLayer(marker) |
| | | } |
| | | } |
| | | |
| | | this.bindTooltip = (layer) => { |
| | | return 'aaaa' |
| | | return '<div class="company-bindTooltip-hover"><h3>天津石化</h3></div>' + layer.options.totransferData.Name |
| | | } |
| | | |
| | | this.clickListener = (e) => { |
| | | console.log(e) |
| | | this.animalService.pulseEffect(e.latlng) |
| | | 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 |
| | | } |
| | | }, |
| | | title: '天津石化' + title // 标题 |
| | | }) |
| | | } |
| | | |
| | | // 根据返回值的不同标记不同图片 |
| | | this.differentTypes = (testValue) => { |
| | | let testChange |
| | | switch (testValue) { |
| | | case 1: |
| | | testChange = NormalImg |
| | | break |
| | | case 2: |
| | | testChange = OffImg |
| | | break |
| | | case 3: |
| | | testChange = AbnormalImg |
| | | break |
| | | case 4: |
| | | testChange = MissImg |
| | | break |
| | | case 5: |
| | | testChange = NormalImg |
| | | break |
| | | case 6: |
| | | testChange = AlarmImg |
| | | break |
| | | case 7: |
| | | testChange = AbnormalImg |
| | | break |
| | | case 8: |
| | | testChange = WarnImg |
| | | break |
| | | } |
| | | return testChange |
| | | } |
| | | } |