diff --git a/src/views/modules/visual/basicinfo/basicInfoMain.vue b/src/views/modules/visual/basicinfo/basicInfoMain.vue index c304c20c..df96c67a 100644 --- a/src/views/modules/visual/basicinfo/basicInfoMain.vue +++ b/src/views/modules/visual/basicinfo/basicInfoMain.vue @@ -157,7 +157,7 @@ import People from "./people"; import cptCard from "@/views/modules/visual/cpts/card"; import ScreenLoading from "@/views/modules/visual/cpts/loading"; -var centerPointGlobal = [120.38945519, 36.0722275] +var centerPointGlobal = [120.664619, 36.504963] let loading;//加载动画 diff --git a/src/views/modules/workSys/mapConfig.vue b/src/views/modules/workSys/mapConfig.vue index 6569f3e5..82b681a5 100644 --- a/src/views/modules/workSys/mapConfig.vue +++ b/src/views/modules/workSys/mapConfig.vue @@ -1,49 +1,112 @@ @@ -67,7 +130,7 @@ import { Loading } from 'element-ui'; //引入Loading服务 import { requestPost } from "@/js/dai/request"; import { altKeyOnly, click, pointerMove } from 'ol/events/condition'; -var centerPointGlobal = [120.38945519, 36.0722275] +var centerPointGlobal = [120.664619, 36.504963] let loading;//加载动画 let x = 1500 @@ -85,15 +148,15 @@ let mapView; let gaodeMapLayer;//背景地图图层 let parentLayer;//上级组织图层 let parentSource;//上级组织多边形 -let polygonLayer;//变电站标注图层 -let polygonSource;//变电站标注多边形 +let polygonLayer;//标注图层 +let polygonSource;//标注多边形 let draw;//绘制handle let select;//选中标注 let selectAltClick; let selectedFeatures; -//变电站标注的文字样式 +//标注的文字样式 var createTextStyle = function (feature) { return new Text({ textAlign: undefined, @@ -101,7 +164,7 @@ var createTextStyle = function (feature) { //fontFamily: "Courier New, monospace", fontWeight: "bold", text: feature.values_.name, - //text: "变电站名称", + //text: "名称", fill: new Fill({ color: "#007ab9" }), stroke: new Stroke({ color: "#ffffff", width: 3 }), offsetY: 0, @@ -172,6 +235,14 @@ const vueGis = { zoom: null, parentPolygon: [], + //手动录入弹出框 + dialogVisible: false, + showOffset: false, + polygonManullyString: "POLYGON (( 120.33902844 36.10290786, 120.33928218 36.10292997, 120.33956336 36.10316381, 120.34016675 36.10367715, 120.34044913 36.10391476, 120.34045707 36.10392145, 120.34068696 36.10411489, 120.34103181 36.10436285, 120.34117309 36.10441824, 120.34134613 36.10447927, 120.34164715 36.10465122, 120.34124679 36.10507284, 120.34088128 36.10538902, 120.34076198 36.10549222, 120.34053890 36.10520966, 120.34044967 36.10507284, 120.34030632 36.10494761, 120.34019091 36.10484679, 120.33976558 36.10448095, 120.33966658 36.10439980, 120.33947147 36.10425822, 120.33932037 36.10417613, 120.33913002 36.10411307, 120.33895751 36.10406073, 120.33879451 36.10403693, 120.33864104 36.10403158, 120.33864031 36.10395235, 120.33863211 36.10305897, 120.33902175 36.10290728, 120.33902844 36.10290786))", + polygonStringResult: '', + + xOffset: 0, + yOffset: 0, } }, async mounted () { @@ -292,7 +363,7 @@ const vueGis = { //加载父级组织多边形 loadParentPolygon () { - parentSource.clear()//清空变电站标注 + parentSource.clear()//清空标注 let featureData = []//标注数据 if (this.parentPolygon && this.parentPolygon.length > 0) {//判断是否存在下级标注 @@ -348,7 +419,7 @@ const vueGis = { }, //加载当前园区的标注 loadPolygon (subAgencyArray) { - polygonSource.clear()//清空变电站标注 + polygonSource.clear()//清空标注 let featureData = []//标注数据 if (subAgencyArray && subAgencyArray.length > 0) {//判断是否存在下级标注 @@ -548,7 +619,7 @@ const vueGis = { }, - //添加变电站标注图层 + //添加标注图层 addParentLayer () { parentSource = new VectorSource({ //features: (new GeoJSON()).readFeatures(geojsonObject) @@ -565,7 +636,7 @@ const vueGis = { }, - //添加变电站标注图层 + //添加标注图层 addPolygonLayer () { polygonSource = new VectorSource({ //features: (new GeoJSON()).readFeatures(geojsonObject) @@ -628,6 +699,86 @@ const vueGis = { }); }, + //点击【手动录入】 + handleManually () { + this.dialogVisible = true + }, + + //点击【手动录入】 + handleClose () { + this.dialogVisible = false + }, + + handleManuallyOk () { + //转化成需要的格式 + //120.54033616308595,36.53603370922851,120.69620469335939,36.5408402277832,120.63166001562502,36.46771248120117,120.52728989843752,36.458786089599606,120.54033616308595,36.53603370922851 + //中国经纬度范围 + // 经度范围:73°33′E至135°05′E 东经 + // 纬度范围:3°51′N至53°33′N 北纬 + + const arrayString = this.polygonManullyString + let array = arrayString.split(/[, ]/) + console.log(array) + this.polygonStringResult = '' + array.forEach(element => { + let num = Number(element) + if (num) { + this.polygonStringResult = this.polygonStringResult + element + ',' + } + + }); + + this.polygonStringResult = this.polygonStringResult.substring(0, this.polygonStringResult.length - 1) + + this.addPolygon(this.polygonStringResult) + }, + + handleSetOffset () { + this.showOffset = true + }, + handleOffsetOk () { + let selPolygonString = "" + let offsetPolygonString = ''//偏移后的坐标字符串 + this.subAgencyArray.forEach(element => { + if (element.id === this.selAgencyId && element.coordinates && element.coordinates.length > 0) { + selPolygonString = element.coordinates + } + }); + + if (selPolygonString) { + let tempArray = selPolygonString.split(',') + + tempArray.forEach((element, index) => { + let aaa = 0 + debugger + if (index % 2 === 0) {//偶数 + aaa = parseFloat(element) + this.xOffset + } else { + aaa = parseFloat(element) + this.yOffset + } + + if (index % 2 !== 0) {//奇数 + + } + offsetPolygonString = offsetPolygonString + aaa + ',' + + }); + + offsetPolygonString = offsetPolygonString.substring(0, offsetPolygonString.length - 1) + } + + + + console.log('selPolygonString', selPolygonString) + console.log('offsetPolygonString', offsetPolygonString) + + this.addPolygon(offsetPolygonString) + + + }, + handleSetOffset () { + this.handleOffsetCancel = false + }, //点击【绘制区域】 handleAddPolygon () { @@ -732,6 +883,7 @@ const vueGis = { }) .then(() => { this.addPolygon(coorString) + }) .catch(err => { this.loadPolygon(this.subAgencyArray) @@ -751,6 +903,7 @@ const vueGis = { //新增标注 async addPolygon (coorString) { + console.log(coorString) const url = "/gov/org/agency/mapaddarea" let params = { @@ -766,7 +919,9 @@ const vueGis = { type: "success", message: "绘制成功" }); - + if (this.dialogVisible) { + this.dialogVisible = false + } this.refreshMap(false) } else { this.$message({ @@ -846,7 +1001,7 @@ const vueGis = { }, mapHeight () { - return this.clientHeight - 120; + return this.clientHeight - 170; }, // zoom: { @@ -872,16 +1027,12 @@ export default vueGis;