From 24d2724aaf2f8331fc179c87595eb9a4720cf8a9 Mon Sep 17 00:00:00 2001
From: wangqi <magical1908@outlook.com>
Date: 星期三, 31 三月 2021 14:32:40 +0800
Subject: [PATCH] 修改文件接口路徑
---
src/components/LayerController/logic/WasteGas.js | 63 +++++++++++++++++++------------
1 files changed, 38 insertions(+), 25 deletions(-)
diff --git a/src/components/LayerController/logic/WasteGas.js b/src/components/LayerController/logic/WasteGas.js
index 4613288..b2ead2d 100644
--- a/src/components/LayerController/logic/WasteGas.js
+++ b/src/components/LayerController/logic/WasteGas.js
@@ -2,38 +2,41 @@
* 搴熸皵
*/
const AnimalService = require('../service/AnimalService').default
-const AjaxUtils = require('../../../utils/AjaxUtils').default
+// const AjaxUtils = require('../../../utils/AjaxUtils').default
+// 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img
+const defaultImg = '/assets/images/map/exhaust/fq_blue.png'
+const setting = '/assets/images/map/exhaust/fq_gray.png'
+
+const mapApi = require('../../../api/mapApi').default
module.exports = function () {
/**
* 杩斿洖marker瀵硅薄鏁扮粍
* @param L leaflet瀵硅薄
*/
- this.init = (layer, L) => {
+ this.init = async (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,
- id: '',
- monType: 1,
- userCode: 'wenchun.deng',
- monDuration: '',
- epName: '',
- secdDeptId: '',
- contrLevel: '',
- dataStatus: '',
- dataFlag: '',
- runStatus: '',
- emissTypeId: ''
- }, function (res) {
- const data = res.data.Result.DataInfo
- // console.log(data)
- 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 res = await mapApi.GetWasteGas()
+ const data = res.Result.DataInfo || {}
+ console.log(data)
+ for (let i = 0; i < data.length; i++) {
+ // 缁忕含搴� 浣嶇疆
+ const positionX = data[i].Latitude
+ const positionY = data[i].Longitude
+ // 瀹氫箟绫诲瀷 鐢ㄦ潵鍖哄垎鏁版嵁
+ const judgeValue = data[i].StorageQty
+ var iconUrl = this.differentTypes(judgeValue)
+
+ const marker = L.marker.magic([positionX, positionY], {
+ icon: L.icon({
+ iconUrl: iconUrl,
+ iconSize: [50, 50],
+ iconAnchor: [25, 25]
+ })
+ })
+ layer.addLayer(marker)
+ // layer.addLayer(L.marker([positionX, positionY], {}))
+ }
}
this.bindTooltip = (layer) => {
@@ -45,4 +48,14 @@
console.log(e)
this.animalService.pulseEffect(e.latlng)
}
+ // 涓嶅悓绫诲瀷鍥剧墖灏佽
+ this.differentTypes = (judgeValue) => {
+ var effectOfChange
+ if (judgeValue === 1) {
+ effectOfChange = defaultImg
+ } else {
+ effectOfChange = setting
+ }
+ return effectOfChange
+ }
}
--
Gitblit v1.8.0