From 478a029daaa2ef30e6309bfb3bc356d8629dab2e Mon Sep 17 00:00:00 2001 From: hbao Date: Wed, 2 Mar 2022 15:01:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9C=B0=E5=9B=BE=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/homesteadSurvey/list.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/views/homesteadSurvey/list.vue b/src/views/homesteadSurvey/list.vue index 90e0a7f5..66f9bb4d 100644 --- a/src/views/homesteadSurvey/list.vue +++ b/src/views/homesteadSurvey/list.vue @@ -2765,6 +2765,7 @@ //地图定义 var delete_map = ["mapZjd", "mapZrz","mapFsss"]; + var hc_land_query; var texiao_layer_zjd; var texiao_layer_zrz; var texiao_layer_fsss; @@ -2772,6 +2773,8 @@ $("#query").on("click", function () { //数据库查询数据------------------------------------------------------start var val = that.seachText; + //删除之前查询图层 + map.removeLayer(hc_land_query); that.mapDataAll =[]; if (val == "") { that.$toast('请填写查询条件再查询'); @@ -2785,12 +2788,11 @@ }); let params = { "deptId" : that.$cookies.get("item").deptId, - "zjddm" : val, - "syqr" : val, - "pageSize":20, + "syqr" : val } listZjdzd(params).then((response) => { - if(response.rows.length>=0){ + console.log(response); + if(response.rows.length != 0){ that.mapDataAll = response.rows; for(var hg=0; hg < that.mapDataAll.length; hg++){ var mapNum = that.mapDataAll[hg].houseDataConfirmStatus; @@ -2804,7 +2806,7 @@ that.mapDataAll[hg].typeTc="宅基地"; if (that.mapDataAll[hg] !=null && that.mapDataAll[hg].theGeom != null && that.mapDataAll[hg].theGeom != "") { //that.mapDataAll[hg].createBy = 'mapTheGeomZjdId'; - var hc_land = new ol.layer.Vector({ + hc_land_query = new ol.layer.Vector({ title: "add Layer", source: new ol.source.Vector({ projection: projection, @@ -2814,11 +2816,11 @@ }), style: styleZjd }); - map.addLayer(hc_land); - var maxXMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxX; - var maxYMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxY; - var minXMap = hc_land.values_.source.featuresRtree_.rbush_.data.minX; - var minYMap = hc_land.values_.source.featuresRtree_.rbush_.data.minY; + map.addLayer(hc_land_query); + var maxXMap = hc_land_query.values_.source.featuresRtree_.rbush_.data.maxX; + var maxYMap = hc_land_query.values_.source.featuresRtree_.rbush_.data.maxY; + var minXMap = hc_land_query.values_.source.featuresRtree_.rbush_.data.minX; + var minYMap = hc_land_query.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 map.getView().animate({