diff --git a/src/components/Map/MapGisDrawing.vue b/src/components/Map/MapGisDrawing.vue index 7e4656de..7dc04724 100644 --- a/src/components/Map/MapGisDrawing.vue +++ b/src/components/Map/MapGisDrawing.vue @@ -122,7 +122,9 @@ export default { zoom: 15, minZoom: 5, //地图缩小限制 maxZoom: 18.3, //地图放大限制 + resolution:Math.random() * 0.00000001 }), + //view: new ol.View({ol.view.getResolution() + Math.random() * 0.00000001)});//随机数缩放实现刷新 }); that.mapData= that.message; var zjdTc; @@ -140,12 +142,12 @@ export default { // zjddmNew = that.$cookies.get("item").zjddm; // } // } - var cql_filter_all = "dept_id='" + that.$cookies.get("map").deptId + "'" + "and zjddm='" + that.$cookies.get("map").zjddm + "'"; + var cql_filter_all = "dept_id='" + that.$cookies.get("search").deptId + "'" + "and zjddm='" + that.$cookies.get("search").zjddm + "'"; console.log(cql_filter_all); console.log(that.$cookies.get("item")); console.log(that.$cookies.get("search")); - zjdTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + zjdTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_zjdzd', @@ -153,13 +155,14 @@ export default { cql_filter: cql_filter_all, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(zjdTc); //宅基地图层查询开始 ------------------start //自然幢图层查询开始 ------------------start - zrzTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + zrzTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_zrz', @@ -167,14 +170,15 @@ export default { cql_filter: cql_filter_all, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(zrzTc); //自然幢图层查询结束 ------------------end //附属设施图层查询开始 ------------------start - fsssTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + fsssTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_fsss', @@ -182,6 +186,7 @@ export default { cql_filter: cql_filter_all, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(fsssTc); @@ -200,6 +205,7 @@ export default { " \"type\": \"Feature\",\n" + " \"geometry\":" + this.message + "}"), }), + resolution:Math.random() * 0.00000001, style: new ol.style.Style({ fill: new ol.style.Fill({ //矢量图层填充颜色,以及透明度 @@ -222,9 +228,10 @@ export default { map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 - zoom: 17.9, // 缩放级别 + zoom: 16.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); // let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); // map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); @@ -242,6 +249,7 @@ export default { " \"type\": \"Feature\",\n" + " \"geometry\":" + rightJoin + "}"), }), + resolution:Math.random() * 0.00000001, style: new ol.style.Style({ fill: new ol.style.Fill({ //矢量图层填充颜色,以及透明度 @@ -267,6 +275,7 @@ export default { zoom: 16.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); // let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); // map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); @@ -462,6 +471,7 @@ export default { zoom: 17.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); // let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); // map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); @@ -504,6 +514,7 @@ export default { zoom: 16.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); } } @@ -549,14 +560,16 @@ export default { zoom: 16.9, minZoom: 5, //地图缩小限制 maxZoom: 18, //地图放大限制 + resolution:Math.random() * 0.00000001, }), }); + //view.setResolution(view.getResolution() + Math.random() * 0.00000001);//随机数缩放实现刷新 //获取坐标是否存在 //var Zb; //村边界查询开始 ------------------------------start var cql_filter = "dept_id='" + that.$cookies.get("item").deptId + "'"; - var cunTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var cunTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_border_village', @@ -596,6 +609,7 @@ export default { .then((data) => { console.log(data); let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize()); + resolution:resolution + Math.random() * 0.00000001, map.getView().fit(data.bbox); map.getView().setResolution(resolution); // var datamap = data.bbox; @@ -613,8 +627,8 @@ export default { //村边界查询开始 ------------------------------end //宅基地图层查询开始 ------------------start //var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'"; - var zjdTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var zjdTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_zjdzd', @@ -747,6 +761,7 @@ export default { zoom: 17.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); // let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); // map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); @@ -789,6 +804,7 @@ export default { zoom: 16.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); // let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); // map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); diff --git a/src/views/homesteadSurvey/add.vue b/src/views/homesteadSurvey/add.vue index c22b9bf4..f8c3ece8 100644 --- a/src/views/homesteadSurvey/add.vue +++ b/src/views/homesteadSurvey/add.vue @@ -20,9 +20,9 @@
- +
- +

宅基地

@@ -3163,8 +3163,8 @@ //this.$cookies.set("item",""); if(this.$cookies.get("search") !=null &&this.$cookies.get("search").zjddm !="" && this.$cookies.get("search").zjddm !=undefined && this.$cookies.get("search").zjddm !=null){ this.ztMap =false; - this.$cookies.set("map",this.$cookies.get("search")); - console.log(this.$cookies.get("map")); + //this.$cookies.set("map",this.$cookies.get("search")); + console.log(this.$cookies.get("search")); }else { this.ztMap =true; } @@ -3178,10 +3178,7 @@ this.backMap.backMapZjdAData = this.cookiesInfo.mapZjdAData; this.backMap.deptId = this.cookiesInfo.mapZjdAData.deptId; this.backMap.zjddm = this.cookiesInfo.mapZjdAData.zjddm; - if(this.ztMap){ - this.$cookies.set("map",this.backMap); - } - this.form.theGeom = this.cookiesInfo.mapZjdAData.theGeom; + //this.form.theGeom = this.cookiesInfo.mapZjdAData.theGeom; //this.enterMapZjddm = this.cookiesInfo.mapZjdAData.zjddm; //返回地图值记录----end this.active = this.cookiesInfo.active; @@ -3193,7 +3190,9 @@ this.getnhdmlist(); this.getBaseUrl(); this.getZjd(); - //this.mapClickLoading(); + if(this.ztMap){ + this.$cookies.set("search",this.backMap); + } let zrz = this.cookiesInfo.mapZrzAData; let fsss = this.cookiesInfo.mapFsssAData; if(this.cookiesInfo.active=="3"){ @@ -3341,9 +3340,9 @@ }); }, mounted(){ - if(this.active ==1){ - this.mapClickLoading(); - } + // if(this.active ==1 && !this.ztMap){ + // this.mapClickLoading(); + // } }, methods: { showPic(){ @@ -4249,9 +4248,9 @@ //this.enterMap=""; //this.$cookies.set("item",""); if(this.ztMap && this.enterMap ==1){ - this.$cookies.set("map",this.backMap); + this.$cookies.set("search",this.backMap); } else { - this.$cookies.set("map",""); + this.$cookies.set("search",""); } this.$router.push({name:'homesteadList'}); // } @@ -4522,6 +4521,7 @@ this.form.djName = res.dictLabel } }) + this.mapClickLoading(); }); }else{ let params = { @@ -4556,6 +4556,7 @@ this.form.suyqrdm = response.rows[0].suyqrdm this.form.zl = response.rows[0].suyqrmc } + this.mapClickLoading(); }); } }, diff --git a/src/views/homesteadSurvey/list.vue b/src/views/homesteadSurvey/list.vue index 6d15a89c..29f64245 100644 --- a/src/views/homesteadSurvey/list.vue +++ b/src/views/homesteadSurvey/list.vue @@ -1390,10 +1390,10 @@ mounted(){ }, created(){ - if(location.href.indexOf("#reloaded")==-1){ - location.href=location.href+"#reloaded"; - location.reload(); - } + // if(location.href.indexOf("#reloaded")==-1){ + // location.href=location.href+"#reloaded"; + // location.reload(); + // } this.getDicts("zjlx").then(response => { this.zjlxOptions = response.data; }); @@ -1429,15 +1429,15 @@ this.getDicts("member_remark").then(response => { this.cybzOptions = response.data; }); - if(this.$cookies.get("map") != null && this.$cookies.get("map") !="" && this.$cookies.get("map")!=undefined){ - if(this.$cookies.get("map").activeBtn !=null){ - if(this.$cookies.get("map").activeBtn == 4){ - this.activeBtn = this.$cookies.get("map").activeBtn; + if(this.$cookies.get("search") != null && this.$cookies.get("search") !="" && this.$cookies.get("search")!=undefined){ + if(this.$cookies.get("search").activeBtn !=null){ + if(this.$cookies.get("search").activeBtn == 4){ + this.activeBtn = this.$cookies.get("search").activeBtn; this.item = this.$cookies.get("item"); - this.mapAddJump = this.$cookies.get("map").backMapZjdAData.deptId; - this.backTheGeom = this.$cookies.get("map").backMapZjdAData.theGeom; - this.mapZjdData = this.$cookies.get("map").backMapZjdAData; - this.mapZjdTeAll.mapZjdAData = this.$cookies.get("map").backMapZjdAData; + this.mapAddJump = this.$cookies.get("search").backMapZjdAData.deptId; + this.backTheGeom = this.$cookies.get("search").backMapZjdAData.theGeom; + this.mapZjdData = this.$cookies.get("search").backMapZjdAData; + this.mapZjdTeAll.mapZjdAData = this.$cookies.get("search").backMapZjdAData; this.zjdHcDy = 1; this.mapZjdDataTure = 1; this.mapAddJumpNum =1; @@ -1844,7 +1844,7 @@ }, // 返回 onClickLeft(){ - this.$cookies.set("map","") + this.$cookies.set("search","") this.$router.push('/homesteadSurvey/index'); }, onConfirmhncysjly(value){ @@ -2921,6 +2921,7 @@ zoom: 10, minZoom: 5, //地图缩小限制 maxZoom: 18.3, //地图放大限制 + resolution:Math.random() * 0.00000001, }), interactions: ol.interaction.defaults({ pinchRotate: false // 移动端禁止地图旋转 @@ -2949,8 +2950,8 @@ } else { cql_filter = "dept_id='" + that.$cookies.get("item").deptId + "'"; } - var cunTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var cunTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_border_village', @@ -2958,6 +2959,7 @@ cql_filter: cql_filter, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); //定位查询位置 @@ -3016,6 +3018,7 @@ zoom: 17.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); } else if(that.backTheGeom !="" && that.backTheGeom !=undefined && that.backTheGeom.substring(0,1) =="[") { //that.newHt ="1"; @@ -3055,9 +3058,11 @@ zoom: 16.9, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); }else { let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize()); + resolution:resolution + Math.random() * 0.00000001, map.getView().fit(data.bbox); map.getView().setResolution(resolution); } @@ -3069,8 +3074,8 @@ //村边界查询开始 ------------------------------end //宅基地图层查询开始 ------------------start //var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'"; - var zjdTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var zjdTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_zjdzd', @@ -3078,14 +3083,15 @@ cql_filter: cql_filter, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(zjdTc); //宅基地图层查询开始 ------------------start //自然幢图层查询开始 ------------------start - var zrzTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var zrzTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_zrz', @@ -3093,14 +3099,15 @@ cql_filter: cql_filter, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(zrzTc); //自然幢图层查询开始 ------------------start //附属设施图层查询开始 ------------------start - var fsssTc= new ol.layer.Tile({ - source: new ol.source.TileWMS({ + var fsssTc= new ol.layer.Image({ + source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms", params: { LAYERS: 'zjd_dc:t_house_survey_fsss', @@ -3108,6 +3115,7 @@ cql_filter: cql_filter, SRID: 3857, }, + resolution:Math.random() * 0.00000001, }), }); map.addLayer(fsssTc); @@ -3516,6 +3524,7 @@ zoom: 17.8, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); }); //定位当前位置 ------end @@ -3704,6 +3713,7 @@ zoom: 15.8, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); } // listFsss(paramsZrz).then((response) => { @@ -4396,6 +4406,7 @@ }) .then((data) => { let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize()); + resolution:resolution + Math.random() * 0.00000001, map.getView().fit(data.bbox); map.getView().setResolution(resolution); // var datamap = data.bbox; @@ -4431,6 +4442,7 @@ serverType: "geoserver", crossOrigin: "anonymous", }, + resolution:Math.random() * 0.00000001, }); //查询宅基地图层 @@ -4443,6 +4455,7 @@ serverType: "geoserver", crossOrigin: "anonymous", }, + resolution:Math.random() * 0.00000001, }); //查询自然幢图层 @@ -4455,6 +4468,7 @@ serverType: "geoserver", crossOrigin: "anonymous", }, + resolution:Math.random() * 0.00000001, }); //查询附属设施图层 @@ -4467,6 +4481,7 @@ serverType: "geoserver", crossOrigin: "anonymous", }, + resolution:Math.random() * 0.00000001, }); @@ -4619,7 +4634,7 @@ "zjddm": obj.zjddm, } that.$cookies.set("search", "") - that.$cookies.set("map", "") + //that.$cookies.set("map", "") console.log(document.cookie.split(';').length) console.log(params); listZjdzd(params).then((response) => { @@ -4663,6 +4678,7 @@ zoom: 17.8, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); function createLabelStyleMap() { @@ -4717,7 +4733,7 @@ "zjddm": obj.zjddm, } that.$cookies.set("search", "") - that.$cookies.set("map", "") + //that.$cookies.set("map", "") listZjdzd(params).then((response) => { that.mapZjdData = response.rows[0]; //that.mapZjdAData.active = 1; @@ -4762,6 +4778,7 @@ zoom: 17.8, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); }); }); @@ -4788,7 +4805,7 @@ "pageSize": 20, } that.$cookies.remove("search") - that.$cookies.set("map", "") + //that.$cookies.set("map", "") listZjdzd(params).then((response) => { that.mapZjdData = response.rows[0]; that.mapZjdData.active = 1; @@ -4801,6 +4818,7 @@ } //that.mapfsssData.active = 4; that.mapfsssData = response.data; + console.log(that.mapfsssData); that.mapZjdTeAll.mapFsssAData = that.mapfsssData; that.zjdHcDy = obj.zjddm; var styleZjd = new ol.style.Style({ @@ -4833,6 +4851,7 @@ zoom: 17.8, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 + resolution:Math.random() * 0.00000001, }); }); }); @@ -5285,17 +5304,15 @@ this.mapZjdTeAll.active =1; this.$cookies.set("search",this.mapZjdTeAll); this.$router.push({path:'/homesteadSurvey/add'}); - } - if(this.mapZrzData !=undefined && this.mapZrzData !=""){ + }else if(this.mapZrzData !=undefined && this.mapZrzData !=""){ if(this.mapZjdTeAll.mapZjdAData !=""){ - this.mapZjdTeAll.active =3; + this.mapZjdTeAll.active = 3; this.$cookies.set("search",this.mapZjdTeAll); this.$router.push({path:'/homesteadSurvey/add'}); } else { this.$toast("必须有宅基地数据才能进入自然幢核查"); } - } - if(this.mapFsssData !=undefined && this.mapFsssData !=""){ + }else { if(this.mapZjdTeAll.mapZjdAData !="") { this.mapZjdTeAll.active = 4; this.$cookies.set("search", this.mapZjdTeAll);