Browse Source

优化地图搜索

wulanhaote
hbao 3 years ago
parent
commit
478a029daa
1 changed files with 12 additions and 10 deletions
  1. +12
    -10
      src/views/homesteadSurvey/list.vue

+ 12
- 10
src/views/homesteadSurvey/list.vue View File

@@ -2765,6 +2765,7 @@


//地图定义 //地图定义
var delete_map = ["mapZjd", "mapZrz","mapFsss"]; var delete_map = ["mapZjd", "mapZrz","mapFsss"];
var hc_land_query;
var texiao_layer_zjd; var texiao_layer_zjd;
var texiao_layer_zrz; var texiao_layer_zrz;
var texiao_layer_fsss; var texiao_layer_fsss;
@@ -2772,6 +2773,8 @@
$("#query").on("click", function () { $("#query").on("click", function () {
//数据库查询数据------------------------------------------------------start //数据库查询数据------------------------------------------------------start
var val = that.seachText; var val = that.seachText;
//删除之前查询图层
map.removeLayer(hc_land_query);
that.mapDataAll =[]; that.mapDataAll =[];
if (val == "") { if (val == "") {
that.$toast('请填写查询条件再查询'); that.$toast('请填写查询条件再查询');
@@ -2785,12 +2788,11 @@
}); });
let params = { let params = {
"deptId" : that.$cookies.get("item").deptId, "deptId" : that.$cookies.get("item").deptId,
"zjddm" : val,
"syqr" : val,
"pageSize":20,
"syqr" : val
} }
listZjdzd(params).then((response) => { listZjdzd(params).then((response) => {
if(response.rows.length>=0){
console.log(response);
if(response.rows.length != 0){
that.mapDataAll = response.rows; that.mapDataAll = response.rows;
for(var hg=0; hg < that.mapDataAll.length; hg++){ for(var hg=0; hg < that.mapDataAll.length; hg++){
var mapNum = that.mapDataAll[hg].houseDataConfirmStatus; var mapNum = that.mapDataAll[hg].houseDataConfirmStatus;
@@ -2804,7 +2806,7 @@
that.mapDataAll[hg].typeTc="宅基地"; that.mapDataAll[hg].typeTc="宅基地";
if (that.mapDataAll[hg] !=null && that.mapDataAll[hg].theGeom != null && that.mapDataAll[hg].theGeom != "") { if (that.mapDataAll[hg] !=null && that.mapDataAll[hg].theGeom != null && that.mapDataAll[hg].theGeom != "") {
//that.mapDataAll[hg].createBy = 'mapTheGeomZjdId'; //that.mapDataAll[hg].createBy = 'mapTheGeomZjdId';
var hc_land = new ol.layer.Vector({
hc_land_query = new ol.layer.Vector({
title: "add Layer", title: "add Layer",
source: new ol.source.Vector({ source: new ol.source.Vector({
projection: projection, projection: projection,
@@ -2814,11 +2816,11 @@
}), }),
style: styleZjd 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]); //获取边界区域的中心位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
map.getView().animate({ map.getView().animate({


Loading…
Cancel
Save