From 57b93c75dac23bd9b4c8400d32169eaef62414d5 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期五, 14 五月 2021 15:52:17 +0800 Subject: [PATCH] 点击弹窗加筛选条件 --- src/components/LayerController/service/WmsLayerService.js | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/LayerController/service/WmsLayerService.js b/src/components/LayerController/service/WmsLayerService.js index 0094a71..fbc74bd 100644 --- a/src/components/LayerController/service/WmsLayerService.js +++ b/src/components/LayerController/service/WmsLayerService.js @@ -1,5 +1,5 @@ import AjaxUtils from '../../../utils/AjaxUtils' -import { PIPELINE_WMS } from '../../../conf/Constants' +import { WMS_URL } from '../../../conf/Constants' import Popup from '@views/popup/Popup' import WmsLayerList from '../dataset/WmsLayerList' @@ -80,17 +80,19 @@ if (filter.length > 0) { params.cql_filter = filter } - this.wmsLayer = this.L.tileLayer.wms(PIPELINE_WMS, params).addTo(this.map) + this.wmsLayer = this.L.tileLayer.wms(WMS_URL, params).addTo(this.map) } clickListener () { window.map.on('click', (e) => { // console.log(e) + window.layerFactory.clearHighlight() this.featureGroup.clearLayers() var point = this.map.latLngToContainerPoint(e.latlng, this.map.getZoom()) var size = this.map.getSize() // const bbox = this.L.latLngBounds(this.L.latLng(e.latlng.lng, e.latlng.lat)).toBBoxString() const layers = this.wmsLayerList.getLayers() + const filter = this.wmsLayerList.getFilters() if (layers.length > 0) { const params = Object.assign({ LAYERS: layers, @@ -101,7 +103,10 @@ Y: Math.round(point.y), BBOX: this.map.getBounds().toBBoxString() }, this.params) - AjaxUtils.get4JsonDataByUrl(PIPELINE_WMS, params, (res) => { + if (filter.length > 0) { + params.cql_filter = filter + } + AjaxUtils.get4JsonDataByUrl(WMS_URL, params, (res) => { const features = res.data.features /** * { -- Gitblit v1.8.0