From dd087d8c1b1406d8438d80e02a71cc77595e7e10 Mon Sep 17 00:00:00 2001 From: seatonwan9 <seatonwan9@163.com> Date: 星期一, 31 五月 2021 13:34:26 +0800 Subject: [PATCH] 治理设施查询 --- src/components/LayerController/logic/GovernEquipment.js | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/components/LayerController/logic/GovernEquipment.js b/src/components/LayerController/logic/GovernEquipment.js index 3770e07..fc2b021 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/GovernEquipment/WasteWaterIndex').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,11 +22,10 @@ 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({ @@ -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: { // 浼犻�掔殑鍙傛暟 + governId: 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 = '' -- Gitblit v1.8.0