diff --git a/src/components/Map/MapGisDrawing.vue b/src/components/Map/MapGisDrawing.vue index fa1030ad..659906ca 100644 --- a/src/components/Map/MapGisDrawing.vue +++ b/src/components/Map/MapGisDrawing.vue @@ -72,6 +72,8 @@ export default { //var hc_land; var draw; // global so we can remove it later var vector_drawing; + console.log(that.message); + console.log(that.$cookies.get("item")); getGeoServerConfigKey().then(response => { that.mapGeoServerUrl = response.msg; if (that.message != null && that.message != "" @@ -127,7 +129,6 @@ export default { map.removeLayer(fsssTc); //宅基地图层查询开始 ------------------start var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'" + "and zjddm='" + that.$cookies.get("item").zjddm + "'"; - console.log(that.$cookies.get("item")); zjdTc= new ol.layer.Tile({ source: new ol.source.TileWMS({ url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms", diff --git a/src/views/homesteadSurvey/add.vue b/src/views/homesteadSurvey/add.vue index 401d5a18..9478f988 100644 --- a/src/views/homesteadSurvey/add.vue +++ b/src/views/homesteadSurvey/add.vue @@ -3185,6 +3185,7 @@ this.backMap.deptId = this.cookiesInfo.mapZjdAData.deptId; this.backMap.zjddm = this.cookiesInfo.mapZjdAData.zjddm; this.$cookies.set("item",this.backMap); + this.form.theGeom = this.cookiesInfo.mapZjdAData.theGeom; //this.enterMapZjddm = this.cookiesInfo.mapZjdAData.zjddm; //返回地图值记录----end this.active = this.cookiesInfo.active; @@ -3200,6 +3201,7 @@ this.getZjd(); if(this.cookiesInfo.active=="3"){ this.showzrz= true + this.form3.theGeom = this.cookiesInfo.mapZrzAData.theGeom; this.getZrzList() setTimeout(() => { this.showPopupzrz(zrz) @@ -3207,6 +3209,7 @@ }else if(this.cookiesInfo.active=="4"){ this.showfsss= true + this.form4.theGeom = this.cookiesInfo.mapFsssAData.theGeom; this.getFsssList() setTimeout(() => { this.showPopupfsss(fsss) @@ -3337,12 +3340,16 @@ this.getDicts("Industry").then(response => { this.industryOptions = response.data; }); + if(this.active ==1){ + this.form.theGeom = this.item.theGeom; + this.mapClickLoading(); + } }, mounted(){ - if(this.active ==1){ - this.form.theGeom = this.item.theGeom; - this.mapClickLoading(); - } + // if(this.active ==1){ + // this.form.theGeom = this.item.theGeom; + // this.mapClickLoading(); + // } }, methods: { validatorIdcard(val){ diff --git a/src/views/homesteadSurvey/list.vue b/src/views/homesteadSurvey/list.vue index cde2d4fe..55971479 100644 --- a/src/views/homesteadSurvey/list.vue +++ b/src/views/homesteadSurvey/list.vue @@ -1189,9 +1189,9 @@

请选择绘制类型

-

宅基地

-

自然幢

-

附属设施

+

宅基地

+

自然幢

+

附属设施

@@ -1328,9 +1328,9 @@ mapZjdDataTure:"", mapZjdTeAll:{ active:"", - mapZjdAData:"", - mapZrzAData:"", - mapFsssAData:"", + mapZjdAData:{}, + mapZrzAData:{}, + mapFsssAData:{}, }, mapHaDataValue:false, mapHasDateStatus: 0, //0附属设施 1自然幢 2宅基地 @@ -2957,7 +2957,7 @@ return geojsonmap; }) .then((data) => { - if(that.backTheGeom !="" && that.backTheGeom !=undefined){ + if(that.backTheGeom !="" && that.backTheGeom !=undefined && that.backTheGeom.substring(0,1) =="{"){ hc_land_on = new ol.layer.Vector({ title: "add Layer", source: new ol.source.Vector({ @@ -2986,6 +2986,45 @@ rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 }); + } else if(that.backTheGeom !="" && that.backTheGeom !=undefined && that.backTheGeom.substring(0,1) =="[") { + //that.newHt ="1"; + var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [that.backTheGeom.replaceAll("\"","")]}); + var leftJoin = zbNew.replace("\"[","["); + var rightJoin = leftJoin.replace("\"]","]"); + hc_land_on = new ol.layer.Vector({ + title: "add Layer", + source: new ol.source.Vector({ + projection: projection, + features: new ol.format.GeoJSON().readFeatures("{\n" + + " \"type\": \"Feature\",\n" + + " \"geometry\":" + rightJoin + "}"), + }), + style: new ol.style.Style({ + fill: new ol.style.Fill({ + //矢量图层填充颜色,以及透明度 + color: "rgba(204, 255, 204,0.3)", + }), + stroke: new ol.style.Stroke({ + //边界样式 + color: "#47c68f", + width: 3, + }), + }), + }); + map.addLayer(hc_land_on); + var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; + var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; + var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX; + var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY; + //定位查询位置 + var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 + map.getView().animate({ + // 只设置需要的属性即可 + center: center, // 中心点 + zoom: 16.9, // 缩放级别 + rotation: undefined, // 缩放完成view视图旋转弧度 + duration: 1000, // 缩放持续时间,默认不需要设置 + }); }else { let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize()); map.getView().fit(data.bbox); @@ -3484,7 +3523,8 @@ //提示当前坐标是否绘制完成 if (that.coordinate != "" && that.coordinate != null) { that.showhzht = true; - that.htZjdZrzFsss = that.coordinate; + that.htZjdZrzFsss = JSON.stringify(that.coordinate); + console.log(that.mapZjdData); // htMapAllFu(); } else { $("#htMapAll").trigger("click"); @@ -4401,236 +4441,141 @@ var zb = evt.coordinate; var url; var url_bbox; - //点击空白删除之前图层 - map.removeLayer(hc_land_on); - if(that.fsssSx && that.zjdSx && that.zrzSx){ - url = wmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "text/html" } - ); - url_bbox = wmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "application/json" } - ); - }else { - if(that.zjdSx){ - url = ZjdwmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "text/html" } - ); - url_bbox = ZjdwmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "application/json" } - ); - } else if (that.fsssSx){ - url = FssswmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "text/html" } - ); - url_bbox = FssswmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "application/json" } - ); - } else if (that.zrzSx){ - url = ZrzwmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "text/html" } - ); - url_bbox = ZrzwmsSource.getFeatureInfoUrl( - evt.coordinate, - viewResolution, - "EPSG:3857", - { INFO_FORMAT: "application/json" } - ); - } else { + if(that.drawingClick) { + //点击空白删除之前图层 + map.removeLayer(hc_land_on); + if (that.fsssSx && that.zjdSx && that.zrzSx) { url = wmsSource.getFeatureInfoUrl( evt.coordinate, viewResolution, "EPSG:3857", - { INFO_FORMAT: "text/html" } + {INFO_FORMAT: "text/html"} ); url_bbox = wmsSource.getFeatureInfoUrl( evt.coordinate, viewResolution, "EPSG:3857", - { INFO_FORMAT: "application/json" } + {INFO_FORMAT: "application/json"} ); + } else { + if (that.zjdSx) { + url = ZjdwmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "text/html"} + ); + url_bbox = ZjdwmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "application/json"} + ); + } else if (that.fsssSx) { + url = FssswmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "text/html"} + ); + url_bbox = FssswmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "application/json"} + ); + } else if (that.zrzSx) { + url = ZrzwmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "text/html"} + ); + url_bbox = ZrzwmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "application/json"} + ); + } else { + url = wmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "text/html"} + ); + url_bbox = wmsSource.getFeatureInfoUrl( + evt.coordinate, + viewResolution, + "EPSG:3857", + {INFO_FORMAT: "application/json"} + ); + } } - } - if (url_bbox) { - fetch(url_bbox).then((res) => { - var geojsonmap = res.json(); - return geojsonmap; - }) - .then((data) => { - var center = ol.extent.getCenter(data.bbox); //获取边界区域的中心位置 - center = [center[0],center[1]-16]; - that.clickBbox = center; + if (url_bbox) { + fetch(url_bbox).then((res) => { + var geojsonmap = res.json(); + return geojsonmap; }) - .catch((error) => { - console.log("【异常】", error); - }); - } - if (url) { - fetch(url) - .then(function (response) { - return response.text(); - }) - .then(function (html) { - document.getElementById("info").innerHTML = html; - if (html.indexOf(" { - if ($("#info .featureInfo .featureInfo").text() == "t_house_survey_zjdzd") { - map.removeLayer(hc_land_on); - that.mapHasDateStatus = 2; - let obj = {}; - let trs = $("#info .featureInfo").find("tr:eq(1)"); - let zjdXq = trs.find("td").eq(0).text(); - let zjdIdNum = zjdXq.replace("t_house_survey_zjdzd.", ""); - obj.id = zjdIdNum; // 主键id - obj.deptName = trs.find("td").eq(3).text();//行政区划名称 + .then((data) => { + var center = ol.extent.getCenter(data.bbox); //获取边界区域的中心位置 + center = [center[0], center[1] - 16]; + that.clickBbox = center; + }) + .catch((error) => { + console.log("【异常】", error); + }); + } + if (url) { + fetch(url) + .then(function (response) { + return response.text(); + }) + .then(function (html) { + document.getElementById("info").innerHTML = html; + if (html.indexOf(" { + if ($("#info .featureInfo .featureInfo").text() == "t_house_survey_zjdzd") { + map.removeLayer(hc_land_on); + that.mapHasDateStatus = 2; + let obj = {}; + let trs = $("#info .featureInfo").find("tr:eq(1)"); + let zjdXq = trs.find("td").eq(0).text(); + let zjdIdNum = zjdXq.replace("t_house_survey_zjdzd.", ""); + obj.id = zjdIdNum; // 主键id + obj.deptName = trs.find("td").eq(3).text();//行政区划名称 - obj.zjddm = trs.find("td").eq(6).text();//宅基地代码 + obj.zjddm = trs.find("td").eq(6).text();//宅基地代码 - obj.zdmj = trs.find("td").eq(11).text();//宗地面积 + obj.zdmj = trs.find("td").eq(11).text();//宗地面积 - obj.active = 1; + obj.active = 1; - var vector_drawing_map; - let params = { - "deptId" : that.$cookies.get("item").deptId, - "zjddm" : obj.zjddm, - } - that.$cookies.set("search","") - console.log(document.cookie.split(';').length) - listZjdzd(params).then((response) => { - if(response.rows[0].zdmj != ""){ - that.textMjAll = response.rows[0].zdmj; - } else { - that.textMjAllNum = "1"; - } - that.mapZjdData = response.rows[0]; - that.mapZjdData.active = 1; - that.mapZjdTeAll.mapZjdAData =that.mapZjdData; - that.mapZjdDataTure = 1; - that.zjdHcDy = obj.zjddm; - var styleZjd = new ol.style.Style({ - stroke: new ol.style.Stroke({ - //边界样式 - color: "#CCFF66", - width: 6, - }), - }); - hc_land_on = new ol.layer.Vector({ - title: "add Layer", - source: new ol.source.Vector({ - projection: projection, - features: new ol.format.GeoJSON().readFeatures("{\n" + - " \"type\": \"Feature\",\n" + - " \"geometry\":" + that.mapZjdData.theGeom + ", \"properties\":" + JSON.stringify(that.mapZjdData) + "}"), - }), - style: styleZjd - }); - map.addLayer(hc_land_on); - var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; - var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; - var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX; - var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY; - //定位查询位置 - var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ - // 只设置需要的属性即可 - center: center, // 中心点 - zoom: 17.8, // 缩放级别 - rotation: undefined, // 缩放完成view视图旋转弧度 - duration: 1000, // 缩放持续时间,默认不需要设置 - }); - function createLabelStyleMap() { - return new ol.style.Style({ - text: new ol.style.Text({ - text: that.mapZjdData.syqr, - textAlign: "center", //位置 - textBaseline: "middle", //基准线 - font: "normal 16px 微软雅黑", //文字样式 - //text: "标注点", //文本内容 - fill: new ol.style.Fill({ - //文本填充样式(即文字颜色) - color: "#0099FF", - width: 10, - }), - overflow: false //超出面的部分不显示 - }), - zIndex: 9999, - }); + var vector_drawing_map; + let params = { + "deptId": that.$cookies.get("item").deptId, + "zjddm": obj.zjddm, } - var newcenterFeatureMap = new ol.Feature({ - geometry: new ol.geom.Point(center), //几何信息 - //name: "标注点", - }); - var sourceMapLookMap = new ol.source.Vector({wrapX: false}); - vector_drawing_map = new ol.layer.Vector({ - source: sourceMapLookMap, - }); - map.addLayer(vector_drawing_map); - newcenterFeatureMap.setStyle(createLabelStyleMap()); //设置要素样式 - sourceMapLookMap.addFeature(newcenterFeatureMap); - }); - //let cloneObj = JSON.parse(JSON.stringify(obj)); - //that.mapZjdData = cloneObj; - } else if($("#info .featureInfo .featureInfo").text() == "t_house_survey_zrz"){ - //that.mapZjdTeAll.mapZjdAData ={}; - that.mapZjdDataTure=""; - that.mapZjdTeAll.mapFsssAData =""; - map.removeLayer(hc_land_on); - let obj = {}; - that.mapHasDateStatus = 1; - let trs = $("#info .featureInfo").find("tr:eq(1)"); - let zrzXq = trs.find("td").eq(0).text(); - let zrzIdNum = zrzXq.replace("t_house_survey_zrz.", ""); - obj.id = zrzIdNum; // 主键id - obj.deptName = trs.find("td").eq(3).text();//行政区划名称 - obj.zjddm = trs.find("td").eq(4).text();//宅基地代码 - obj.scjzmj = trs.find("td").eq(12).text();//实测建筑面积 - let params = { - "deptId" : that.$cookies.get("item").deptId, - "zjddm" : obj.zjddm, - } - that.$cookies.set("search","") - listZjdzd(params).then((response) => { - that.mapZjdData = response.rows[0]; - //that.mapZjdAData.active = 1; - that.mapZjdTeAll.mapZjdAData = that.mapZjdData; - getZrz(obj.id).then((response) => { - if(response.data.scjzmj != ""){ - that.textMjAll = response.data.scjzmj; + that.$cookies.set("search", "") + console.log(document.cookie.split(';').length) + listZjdzd(params).then((response) => { + if (response.rows[0].zdmj != "") { + that.textMjAll = response.rows[0].zdmj; } else { that.textMjAllNum = "1"; } - that.mapZrzData = response.data; - that.mapZrzData.active = 3; - that.mapZjdTeAll.mapZrzAData =that.mapZrzData; + that.mapZjdData = response.rows[0]; + that.mapZjdData.active = 1; + that.mapZjdTeAll.mapZjdAData = that.mapZjdData; + that.mapZjdDataTure = 1; that.zjdHcDy = obj.zjddm; var styleZjd = new ol.style.Style({ stroke: new ol.style.Stroke({ @@ -4645,7 +4590,7 @@ projection: projection, features: new ol.format.GeoJSON().readFeatures("{\n" + " \"type\": \"Feature\",\n" + - " \"geometry\":" + that.mapZrzData.theGeom + ", \"properties\":" + JSON.stringify(that.mapZrzData) + "}"), + " \"geometry\":" + that.mapZjdData.theGeom + ", \"properties\":" + JSON.stringify(that.mapZjdData) + "}"), }), style: styleZjd }); @@ -4663,91 +4608,190 @@ rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 }); - }); - }); - } else if($("#info .featureInfo .featureInfo").text() == "t_house_survey_fsss"){ - that.mapZjdTeAll.mapZrzAData =""; - that.mapZjdDataTure=""; - //that.mapZjdTeAll.mapZjdAData ={}; - map.removeLayer(hc_land_on); - let obj = {}; - that.mapHasDateStatus = 0; - let trs = $("#info .featureInfo").find("tr:eq(1)"); - let fsssXq = trs.find("td").eq(0).text(); - let fsssIdNum = fsssXq.replace("t_house_survey_fsss.", ""); - obj.id = fsssIdNum; // 主键id - obj.deptName = trs.find("td").eq(4).text();//行政区划名称 - obj.zjddm = trs.find("td").eq(1).text();//宅基地代码 - // obj.houseDataConfirmStatus = trs.find("td").eq(6).text(); //状态 - // obj.fssslx = trs.find("td").eq(7).text(); //附属设施类型 - obj.jzmj = trs.find("td").eq(8).text(); //建筑面积 - let params = { - "deptId" : that.$cookies.get("item").deptId, - "zjddm" : obj.zjddm, - "pageSize":20, - } - that.$cookies.remove("search") - listZjdzd(params).then((response) => { - that.mapZjdData = response.rows[0]; - that.mapZjdData.active = 1; - that.mapZjdTeAll.mapZjdAData = that.mapZjdData; - getFsss(obj.id).then((response) => { - if(response.data.jzmj != ""){ - that.textMjAll = response.data.jzmj; - } else { - that.textMjAllNum = "1"; + function createLabelStyleMap() { + return new ol.style.Style({ + text: new ol.style.Text({ + text: that.mapZjdData.syqr, + textAlign: "center", //位置 + textBaseline: "middle", //基准线 + font: "normal 16px 微软雅黑", //文字样式 + //text: "标注点", //文本内容 + fill: new ol.style.Fill({ + //文本填充样式(即文字颜色) + color: "#0099FF", + width: 10, + }), + overflow: false //超出面的部分不显示 + }), + zIndex: 9999, + }); } - //that.mapfsssData.active = 4; - that.mapfsssData = response.data; - that.mapZjdTeAll.mapFsssAData = that.mapfsssData; - that.zjdHcDy = obj.zjddm; - var styleZjd = new ol.style.Style({ - stroke: new ol.style.Stroke({ - //边界样式 - color: "#CCFF66", - width: 6, - }), + + var newcenterFeatureMap = new ol.Feature({ + geometry: new ol.geom.Point(center), //几何信息 + //name: "标注点", }); - hc_land_on = new ol.layer.Vector({ - title: "add Layer", - source: new ol.source.Vector({ - projection: projection, - features: new ol.format.GeoJSON().readFeatures("{\n" + - " \"type\": \"Feature\",\n" + - " \"geometry\":" + that.mapfsssData.theGeom + ", \"properties\":" + JSON.stringify(that.mapfsssData) + "}"), - }), - style: styleZjd + var sourceMapLookMap = new ol.source.Vector({wrapX: false}); + vector_drawing_map = new ol.layer.Vector({ + source: sourceMapLookMap, }); - map.addLayer(hc_land_on); - var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; - var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; - var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX; - var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY; - //定位查询位置 - var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - map.getView().animate({ - // 只设置需要的属性即可 - center: center, // 中心点 - zoom: 17.8, // 缩放级别 - rotation: undefined, // 缩放完成view视图旋转弧度 - duration: 1000, // 缩放持续时间,默认不需要设置 + map.addLayer(vector_drawing_map); + newcenterFeatureMap.setStyle(createLabelStyleMap()); //设置要素样式 + sourceMapLookMap.addFeature(newcenterFeatureMap); + }); + //let cloneObj = JSON.parse(JSON.stringify(obj)); + //that.mapZjdData = cloneObj; + } else if ($("#info .featureInfo .featureInfo").text() == "t_house_survey_zrz") { + //that.mapZjdTeAll.mapZjdAData ={}; + that.mapZjdDataTure = ""; + that.mapZjdTeAll.mapFsssAData = {}; + map.removeLayer(hc_land_on); + let obj = {}; + that.mapHasDateStatus = 1; + let trs = $("#info .featureInfo").find("tr:eq(1)"); + let zrzXq = trs.find("td").eq(0).text(); + let zrzIdNum = zrzXq.replace("t_house_survey_zrz.", ""); + obj.id = zrzIdNum; // 主键id + obj.deptName = trs.find("td").eq(3).text();//行政区划名称 + obj.zjddm = trs.find("td").eq(4).text();//宅基地代码 + obj.scjzmj = trs.find("td").eq(12).text();//实测建筑面积 + let params = { + "deptId": that.$cookies.get("item").deptId, + "zjddm": obj.zjddm, + } + that.$cookies.set("search", "") + listZjdzd(params).then((response) => { + that.mapZjdData = response.rows[0]; + //that.mapZjdAData.active = 1; + that.mapZjdTeAll.mapZjdAData = that.mapZjdData; + getZrz(obj.id).then((response) => { + if (response.data.scjzmj != "") { + that.textMjAll = response.data.scjzmj; + } else { + that.textMjAllNum = "1"; + } + that.mapZrzData = response.data; + that.mapZrzData.active = 3; + that.mapZjdTeAll.mapZrzAData = that.mapZrzData; + that.zjdHcDy = obj.zjddm; + var styleZjd = new ol.style.Style({ + stroke: new ol.style.Stroke({ + //边界样式 + color: "#CCFF66", + width: 6, + }), + }); + hc_land_on = new ol.layer.Vector({ + title: "add Layer", + source: new ol.source.Vector({ + projection: projection, + features: new ol.format.GeoJSON().readFeatures("{\n" + + " \"type\": \"Feature\",\n" + + " \"geometry\":" + that.mapZrzData.theGeom + ", \"properties\":" + JSON.stringify(that.mapZrzData) + "}"), + }), + style: styleZjd + }); + map.addLayer(hc_land_on); + var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; + var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; + var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX; + var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY; + //定位查询位置 + var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 + map.getView().animate({ + // 只设置需要的属性即可 + center: center, // 中心点 + zoom: 17.8, // 缩放级别 + rotation: undefined, // 缩放完成view视图旋转弧度 + duration: 1000, // 缩放持续时间,默认不需要设置 + }); }); }); - }); - // if(obj.jzmj != ""){ - // that.textMjAll = obj.jzmj; - // } else { - // that.textMjAllNum = "1"; - // } - } else { + } else if ($("#info .featureInfo .featureInfo").text() == "t_house_survey_fsss") { + that.mapZjdTeAll.mapZrzAData = {}; + that.mapZjdDataTure = ""; + //that.mapZjdTeAll.mapZjdAData ={}; + map.removeLayer(hc_land_on); + let obj = {}; + that.mapHasDateStatus = 0; + let trs = $("#info .featureInfo").find("tr:eq(1)"); + let fsssXq = trs.find("td").eq(0).text(); + let fsssIdNum = fsssXq.replace("t_house_survey_fsss.", ""); + obj.id = fsssIdNum; // 主键id + obj.deptName = trs.find("td").eq(4).text();//行政区划名称 + obj.zjddm = trs.find("td").eq(1).text();//宅基地代码 + // obj.houseDataConfirmStatus = trs.find("td").eq(6).text(); //状态 + // obj.fssslx = trs.find("td").eq(7).text(); //附属设施类型 + obj.jzmj = trs.find("td").eq(8).text(); //建筑面积 - } - }, 300); - } else { + let params = { + "deptId": that.$cookies.get("item").deptId, + "zjddm": obj.zjddm, + "pageSize": 20, + } + that.$cookies.remove("search") + listZjdzd(params).then((response) => { + that.mapZjdData = response.rows[0]; + that.mapZjdData.active = 1; + that.mapZjdTeAll.mapZjdAData = that.mapZjdData; + getFsss(obj.id).then((response) => { + if (response.data.jzmj != "") { + that.textMjAll = response.data.jzmj; + } else { + that.textMjAllNum = "1"; + } + //that.mapfsssData.active = 4; + that.mapfsssData = response.data; + that.mapZjdTeAll.mapFsssAData = that.mapfsssData; + that.zjdHcDy = obj.zjddm; + var styleZjd = new ol.style.Style({ + stroke: new ol.style.Stroke({ + //边界样式 + color: "#CCFF66", + width: 6, + }), + }); + hc_land_on = new ol.layer.Vector({ + title: "add Layer", + source: new ol.source.Vector({ + projection: projection, + features: new ol.format.GeoJSON().readFeatures("{\n" + + " \"type\": \"Feature\",\n" + + " \"geometry\":" + that.mapfsssData.theGeom + ", \"properties\":" + JSON.stringify(that.mapfsssData) + "}"), + }), + style: styleZjd + }); + map.addLayer(hc_land_on); + var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; + var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; + var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX; + var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY; + //定位查询位置 + var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 + map.getView().animate({ + // 只设置需要的属性即可 + center: center, // 中心点 + zoom: 17.8, // 缩放级别 + rotation: undefined, // 缩放完成view视图旋转弧度 + duration: 1000, // 缩放持续时间,默认不需要设置 + }); + }); + }); + // if(obj.jzmj != ""){ + // that.textMjAll = obj.jzmj; + // } else { + // that.textMjAllNum = "1"; + // } + } else { - } - }); + } + }, 300); + } else { + + } + }); + } } //数据库查询详情时使用----------------------------------------start // if(feature) { @@ -5305,16 +5349,21 @@ $('.searchBar_wrap').css({'animation':'test2 0.5s ease-in-out 0s 1 alternate forwards','-webkit-animation':'test2 0.5s ease-in-out 0s 1 alternate forwards'}); }, zjdTz(){ - this.mapZjdTeAll.active =1; - this.mapZjdTeAll.mapZjdAData.theGeom =JSON.stringify(this.htZjdZrzFsss); - this.mapZjdTeAll.mapZjdAData.deptId = this.$cookies.get("item").deptId; - this.$cookies.set("search",this.mapZjdTeAll); - this.$router.push({path:'/homesteadSurvey/add'}); + if(this.mapZjdData =="" && this.mapZjdDataTure =="" && this.mapZjdData !=undefined){ + this.mapZjdTeAll.active =1; + console.log(this.htZjdZrzFsss); + this.mapZjdTeAll.mapZjdAData.theGeom =this.htZjdZrzFsss; + this.mapZjdTeAll.mapZjdAData.deptId = this.$cookies.get("item").deptId; + this.$cookies.set("search",this.mapZjdTeAll); + this.$router.push({path:'/homesteadSurvey/add'}); + }else { + this.$toast("已选择宅基地,请选择自然幢或附属设施按钮"); + } }, zrzTz(){ - if(this.mapZjdTeAll.mapZjdAData !=undefined && this.mapZjdTeAll.mapZjdAData !="" && this.mapZjdDataTure !=""){ + if(this.mapZjdData !=undefined && this.mapZjdData !="" && this.mapZjdDataTure !=""){ this.mapZjdTeAll.active =3; - this.mapZjdTeAll.mapZrzAData.theGeom =JSON.stringify(this.htZjdZrzFsss); + this.mapZjdTeAll.mapZrzAData.theGeom =this.htZjdZrzFsss; this.mapZjdTeAll.mapZrzAData.deptId = this.$cookies.get("item").deptId; this.$cookies.set("search",this.mapZjdTeAll); this.$router.push({path:'/homesteadSurvey/add'}); @@ -5323,9 +5372,9 @@ } }, fsssTz(){ - if(this.mapZjdTeAll.mapZjdAData !=undefined && this.mapZjdTeAll.mapZjdAData !="" && this.mapZjdDataTure !=""){ + if(this.mapZjdData !=undefined && this.mapZjdData !="" && this.mapZjdDataTure !=""){ this.mapZjdTeAll.active =4; - this.mapZjdTeAll.mapFsssAData.theGeom =JSON.stringify(this.htZjdZrzFsss); + this.mapZjdTeAll.mapFsssAData.theGeom =this.htZjdZrzFsss; this.mapZjdTeAll.mapFsssAData.deptId = this.$cookies.get("item").deptId; this.$cookies.set("search",this.mapZjdTeAll); this.$router.push({path:'/homesteadSurvey/add'});