diff --git a/src/components/Map/MapGisDrawing.vue b/src/components/Map/MapGisDrawing.vue index 7dc04724..0ea3b368 100644 --- a/src/components/Map/MapGisDrawing.vue +++ b/src/components/Map/MapGisDrawing.vue @@ -35,6 +35,7 @@ export default { newZb: null, newGeom: null, mapData: null, + map:this.guidProduct(), //地图服务地址 mapGeoServerUrl:"", }; @@ -68,7 +69,7 @@ export default { /* console.log(this.message);*/ //加载地图编辑 var that = this; - var map; + //var map; //var hc_land; var draw; // global so we can remove it later var vector_drawing; @@ -102,6 +103,7 @@ export default { }), isGroup: true, name: "卫星影像图", + resolution:Math.random() * 0.00000001 }); var yingxzi = new ol.layer.Tile({ @@ -110,9 +112,10 @@ export default { }), isGroup: true, name: "天地图文字标注--卫星影像图", + resolution:Math.random() * 0.00000001 }); //加载地图 - map = new ol.Map({ + that.map = new ol.Map({ controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]), //隐藏放大缩小按钮 layers: [aerial, yingxzi], projection: projection, @@ -122,7 +125,10 @@ export default { zoom: 15, minZoom: 5, //地图缩小限制 maxZoom: 18.3, //地图放大限制 - resolution:Math.random() * 0.00000001 + resolution:Math.random() * 0.00000001, + }), + interactions: ol.interaction.defaults({ + pinchRotate: false // 移动端禁止地图旋转 }), //view: new ol.View({ol.view.getResolution() + Math.random() * 0.00000001)});//随机数缩放实现刷新 }); @@ -130,22 +136,14 @@ export default { var zjdTc; var zrzTc; var fsssTc; - map.removeLayer(zrzTc); - map.removeLayer(zjdTc); - map.removeLayer(fsssTc); + that.map.removeLayer(zrzTc); + that.map.removeLayer(zjdTc); + that.map.removeLayer(fsssTc); //宅基地图层查询开始 ------------------start - // var zjddmNew; - // if(that.$cookies.get("search").zjddm !=undefined && that.$cookies.get("search").zjddm !=""){ - // zjddmNew = that.$cookies.get("search").zjddm; - // }else { - // if(that.$cookies.get("item").zjddm !=undefined && that.$cookies.get("item").zjddm !=""){ - // zjddmNew = that.$cookies.get("item").zjddm; - // } - // } - var cql_filter_all = "dept_id='" + that.$cookies.get("search").deptId + "'" + "and zjddm='" + that.$cookies.get("search").zjddm + "'"; + + //村边界查询开始 ------------------------------end + var cql_filter_all = "dept_id='" + that.$cookies.get("item").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.Image({ source: new ol.source.ImageWMS({ url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms", @@ -158,7 +156,7 @@ export default { resolution:Math.random() * 0.00000001, }), }); - map.addLayer(zjdTc); + that.map.addLayer(zjdTc); //宅基地图层查询开始 ------------------start //自然幢图层查询开始 ------------------start zrzTc= new ol.layer.Image({ @@ -173,7 +171,7 @@ export default { resolution:Math.random() * 0.00000001, }), }); - map.addLayer(zrzTc); + that.map.addLayer(zrzTc); //自然幢图层查询结束 ------------------end //附属设施图层查询开始 ------------------start @@ -189,7 +187,7 @@ export default { resolution:Math.random() * 0.00000001, }), }); - map.addLayer(fsssTc); + that.map.addLayer(fsssTc); //附属设施图层查询结束 ------------------end //图层查询定位开始 ---------start if(this.message.substring(0,1) =="{"){ @@ -218,14 +216,14 @@ export default { }), }), }); - map.addLayer(hc_land); + that.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; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 16.9, // 缩放级别 @@ -262,14 +260,14 @@ export default { }), }), }); - map.addLayer(hc_land); + that.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; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 16.9, // 缩放级别 @@ -287,15 +285,15 @@ export default { //开始绘制地图 $("#"+this.drawingPolygonMap).click(function () { that.newGeom = 1; - map.removeLayer(hc_land); - map.removeLayer(vector_drawing); + that.map.removeLayer(hc_land); + that.map.removeLayer(vector_drawing); //that.closeMoule = null; - map.removeInteraction(draw); + that.map.removeInteraction(draw); //var source = new ol.source.Vector({wrapX: false}); vector_drawing = new ol.layer.Vector({ source: new ol.source.Vector(), }); - map.addLayer(vector_drawing); + that.map.addLayer(vector_drawing); function addInteraction() { draw = new ol.interaction.Draw({ @@ -308,12 +306,12 @@ export default { var coordinate = geometry.getCoordinates(); if(coordinate !="" && coordinate !=null){ //map.addLayer(vector_drawing); - map.removeInteraction(draw); + that.map.removeInteraction(draw); } that.closeMoule = coordinate; that.formSubmit(); }); - map.addInteraction(draw); + that.map.addInteraction(draw); } addInteraction(); @@ -328,9 +326,9 @@ export default { $("#"+this.drawingResetMap).click(function () { that.newGeom = 2; if(that.closeMoule !=null) { - map.addLayer(hc_land); - map.removeInteraction(draw); - map.removeLayer(vector_drawing); + that.map.addLayer(hc_land); + that.map.removeInteraction(draw); + that.map.removeLayer(vector_drawing); that.formSubmit(); } }); @@ -381,7 +379,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 17.9, // 缩放级别 @@ -423,7 +421,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 16.9, // 缩放级别 @@ -465,7 +463,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 17.9, // 缩放级别 @@ -508,7 +506,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 16.9, // 缩放级别 @@ -548,7 +546,7 @@ export default { }); //加载地图 - map = new ol.Map({ + that.map = new ol.Map({ controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]), //隐藏放大缩小按钮 layers: [aerial, yingxzi], projection: projection, @@ -610,8 +608,8 @@ export default { 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); + that.map.getView().fit(data.bbox); + that.map.getView().setResolution(resolution); // var datamap = data.bbox; // var center = ol.extent.getCenter(datamap); // map.getView().animate({ @@ -623,7 +621,7 @@ export default { .catch((error) => { console.log("【异常】", error); }); - map.addLayer(cunTc); + that.map.addLayer(cunTc); //村边界查询开始 ------------------------------end //宅基地图层查询开始 ------------------start //var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'"; @@ -638,7 +636,7 @@ export default { }, }), }); - map.addLayer(zjdTc); + that.map.addLayer(zjdTc); //宅基地图层查询开始 ------------------start // getQueryLand().then((response) => { // if (response.code == 200) { @@ -674,12 +672,12 @@ export default { //开始绘制地图 $("#"+this.drawingPolygonMap).click(function () { //that.closeMoule = null; - map.removeInteraction(draw); + that.map.removeInteraction(draw); //var source = new ol.source.Vector({wrapX: false}); vector_drawing = new ol.layer.Vector({ source: new ol.source.Vector(), }); - map.addLayer(vector_drawing); + that.map.addLayer(vector_drawing); function addInteraction() { draw = new ol.interaction.Draw({ @@ -698,7 +696,7 @@ export default { that.closeMoule = coordinate; that.formSubmit(); }); - map.addInteraction(draw); + that.map.addInteraction(draw); } addInteraction(); @@ -712,8 +710,8 @@ export default { // }); //还原之前图层 $("#"+this.drawingResetMap).click(function () { - map.removeInteraction(draw); - map.removeLayer(vector_drawing); + that.map.removeInteraction(draw); + that.map.removeLayer(vector_drawing); //that.closeMoule = null; that.formSubmit(); }); @@ -755,7 +753,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 17.9, // 缩放级别 @@ -798,7 +796,7 @@ export default { var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ + that.map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 zoom: 16.9, // 缩放级别 diff --git a/src/views/homesteadSurvey/add.vue b/src/views/homesteadSurvey/add.vue index f8c3ece8..8f67385c 100644 --- a/src/views/homesteadSurvey/add.vue +++ b/src/views/homesteadSurvey/add.vue @@ -20,7 +20,7 @@
宅基地
@@ -446,7 +446,7 @@ placeholder="备注" maxlength="200" /> -