From d195225b4e628e541caca0944d54fec027572a06 Mon Sep 17 00:00:00 2001
From: seatonwan9 <seatonwan9@163.com>
Date: 星期日, 30 五月 2021 13:35:20 +0800
Subject: [PATCH] 治理设施测试
---
src/components/LayerController/logic/GovernEquipment.js | 51 +++++++++++++++++++++----
public/assets/images/map/governEquipment/govern_green.png | 0
src/conf/Constants.js | 8 ++--
src/conf/layers/LayerEnvRisk.js | 8 ++--
src/api/mapApi.js | 3 +
public/assets/governEquipment.json | 22 +++++++++++
6 files changed, 75 insertions(+), 17 deletions(-)
diff --git a/public/assets/governEquipment.json b/public/assets/governEquipment.json
new file mode 100644
index 0000000..17d1b68
--- /dev/null
+++ b/public/assets/governEquipment.json
@@ -0,0 +1,22 @@
+[
+ {
+ "no": 0,
+ "company": "鎵瓙鐭冲寲",
+ "plate": "鐐兼补鏉垮潡",
+ "unitName": "鑺崇儍鍘傘�佺偧娌瑰巶",
+ "governName": "纭:鍥炴敹娌荤悊璁炬柦",
+ "Longitude": 118.7936111111,
+ "Latitude": 32.2583305556,
+ "status": 1
+ },
+ {
+ "no": 1,
+ "company": "涓煩鐭冲寲",
+ "plate": "鐐兼补鏉垮潡",
+ "unitName": "鐐兼补浜岄儴",
+ "governName": "鍌寲瑁傚寲娌荤悊璁炬柦",
+ "Longitude": 114.44016,
+ "Latitude": 30.65305,
+ "status": 1
+ }
+]
diff --git a/public/assets/images/map/governEquipment/govern_green.png b/public/assets/images/map/governEquipment/govern_green.png
new file mode 100644
index 0000000..1b30b11
--- /dev/null
+++ b/public/assets/images/map/governEquipment/govern_green.png
Binary files differ
diff --git a/src/api/mapApi.js b/src/api/mapApi.js
index ae65d02..2897794 100644
--- a/src/api/mapApi.js
+++ b/src/api/mapApi.js
@@ -90,6 +90,9 @@
getSourcesPoll (data) {
return axios.get(mapUrl.getSourcesPoll, data)
},
+ getGovernEquipment (data) {
+ return axios.get('/assets/governEquipment.json', data)
+ },
getEnvironmentRisk (data) {
return axios.get('/assets/environmentRisk.json', data)
},
diff --git a/src/components/LayerController/logic/GovernEquipment.js b/src/components/LayerController/logic/GovernEquipment.js
index 3770e07..f5f174f 100644
--- a/src/components/LayerController/logic/GovernEquipment.js
+++ b/src/components/LayerController/logic/GovernEquipment.js
@@ -2,13 +2,15 @@
* 姹℃煋婧�
*/
// 淇℃伅缁勪欢
-// const SourcePollutionIndex = require('../../base-page/RiskSource/RiskSourceIndex.vue').default
+const GovernEquipmentIndex = require('../../base-page/RiskSource/RiskSourceIndex.vue').default
// 浣跨敤灏佽鏂规硶
const AnimalService = require('../service/AnimalService').default
// 璇锋眰鎺ュ彛鏁版嵁
const mapApi = require('../../../api/mapApi').default
// 鍏叡鏂规硶 panTo() 寮曠敤
-// const { setPanTo } = require('../../../utils/utils')
+const { setPanTo } = require('../../../utils/utils')
+
+const governGreen = '/assets/images/map/governEquipment/govern_green.png'
module.exports = function () {
/**
@@ -20,17 +22,16 @@
L: L,
layer: layer
})
- const result = await mapApi.getEnvironmentRiskPoint()
- const data = result[0]
+ const data = await mapApi.getGovernEquipment()
for (let i = 0; i < data.length; i++) {
const postion = [data[i].Latitude, data[i].Longitude] // 鍧愭爣
- const iconUrl = this.sourcePollutionIconUrl(1) // 娌荤悊璁炬柦鍥炬爣
+ const iconUrl = this.governIconUrl(data[i].status) // 娌荤悊璁炬柦鍥炬爣
const marker = L.marker(postion, {
totransferData: data[i],
icon: L.icon({
iconUrl: iconUrl,
- iconSize: [20, 20],
- iconAnchor: [10, 10]
+ iconSize: [30, 30],
+ iconAnchor: [15, 15]
})
})
layer.addLayer(marker)
@@ -38,15 +39,47 @@
}
/**
+ * 鎻愮ず绐�
+ * @param layer
+ * @returns {string}
+ */
+ this.bindTooltip = (layer) => {
+ return layer.options.totransferData.governName
+ }
+
+ /**
+ * 淇℃伅寮圭獥
+ * @param e
+ */
+ this.clickListener = (e) => {
+ // 鑴夊啿鏁堟灉
+ this.animalService.pulseEffect(e.latlng)
+ // 淇℃伅寮圭獥骞崇Щ
+ setPanTo(e.latlng, 200)
+ // 寮规鏍囬
+ const title = e.layer.options.totransferData.Name
+ window.$layer.open({
+ content: {
+ comp: GovernEquipmentIndex, // 缁勪欢
+ parent: this, // 鐖剁粍浠�
+ data: { // 浼犻�掔殑鍙傛暟
+ riskSourceId: e.layer.options.totransferData.no
+ }
+ },
+ title: title // 鏍囬
+ })
+ }
+
+ /**
* 娌荤悊璁炬柦鍥炬爣閰嶇疆
* @param t
* @returns {string}
*/
- this.sourcePollutionIconUrl = (t) => {
+ this.governIconUrl = (t) => {
let iconUrl = null
switch (t) {
case 1:
- iconUrl = ''
+ iconUrl = governGreen
break
case 2:
iconUrl = ''
diff --git a/src/conf/Constants.js b/src/conf/Constants.js
index 20c3f29..55b36c0 100644
--- a/src/conf/Constants.js
+++ b/src/conf/Constants.js
@@ -17,12 +17,12 @@
}
export const logicMapper = {
- wasteGasPfk: 'WasteGas.js',
- wasteWaterPfk: 'WasteWater.js',
- wasteSolidCcd: 'WasteSolid.js',
+ wasteGasPfk: 'WasteGas.js', // 搴熸皵
+ wasteWaterPfk: 'WasteWater.js', // 搴熸按
+ wasteSolidCcd: 'WasteSolid.js', // 鍥哄簾
sewersAreaGs: 'Company.js',
pipesegment: 'PipeLineAnimal.js',
- pollutionSources: 'SourcesPollution.js',
+ pollutionSourcesZlss: 'GovernEquipment.js', // 姹℃煋婧�-娌荤悊璁炬柦
envRiskChart: 'EnvironmentRisk.js', // 椋庨櫓缁熻鍥�
envRiskMajor: 'RiskSource.js', // 閲嶅ぇ椋庨櫓婧�
envRiskFirst: 'RiskSource.js', // 涓�绾ч闄╂簮
diff --git a/src/conf/layers/LayerEnvRisk.js b/src/conf/layers/LayerEnvRisk.js
index 1ca0e15..983fe54 100644
--- a/src/conf/layers/LayerEnvRisk.js
+++ b/src/conf/layers/LayerEnvRisk.js
@@ -26,7 +26,7 @@
name: '閲嶅ぇ椋庨櫓',
sname: '閲嶅ぇ椋庨櫓',
checked: false, // 榛樿閫変腑鐘舵��
- minZoom: 10,
+ // minZoom: 10,
color: 'red',
level: 0
},
@@ -36,7 +36,7 @@
sname: '涓�绾ч闄�',
checked: false, // 榛樿閫変腑鐘舵��
type: 0,
- minZoom: 10,
+ // minZoom: 10,
color: 'sandybrown',
level: 1
},
@@ -46,7 +46,7 @@
sname: '浜岀骇椋庨櫓',
checked: false,
type: 0,
- minZoom: 10,
+ // minZoom: 10,
color: 'yellow',
level: 2
},
@@ -56,7 +56,7 @@
sname: '涓夌骇椋庨櫓',
checked: false,
type: 0,
- minZoom: 10,
+ // minZoom: 10,
color: 'green',
level: 3
}
--
Gitblit v1.8.0