|
@ -1,49 +1,112 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div style="position: relative"> |
|
|
<div> |
|
|
|
|
|
<div style="position: relative"> |
|
|
<div class="div_search"> |
|
|
|
|
|
|
|
|
<div class="div_search"> |
|
|
<el-select v-model="selAgencyId" |
|
|
|
|
|
placeholder="请选择或点击区域选择"> |
|
|
<el-select v-model="selAgencyId" |
|
|
<el-option @click.native="orgChange(index)" |
|
|
placeholder="请选择或点击区域选择"> |
|
|
v-for="(item,index) in subAgencyArray" |
|
|
<el-option @click.native="orgChange(index)" |
|
|
:key="item.id" |
|
|
v-for="(item,index) in subAgencyArray" |
|
|
:label="item.name" |
|
|
:key="item.id" |
|
|
:value="item.id"> |
|
|
:label="item.name" |
|
|
</el-option> |
|
|
:value="item.id"> |
|
|
</el-select> |
|
|
</el-option> |
|
|
<div v-if="selAgencyId && subAgencyArray.length>0"> |
|
|
</el-select> |
|
|
<el-button v-if="showBtn&&!hasPolygon" |
|
|
<div v-if="selAgencyId && subAgencyArray.length>0"> |
|
|
style="margin-left:10px" |
|
|
<el-button v-if="showBtn&&!hasPolygon" |
|
|
type="primary" |
|
|
style="margin-left:10px" |
|
|
icon="el-icon-plus" |
|
|
type="primary" |
|
|
@click="handleAddPolygon">{{method==='mAddPolygon'?'取消绘制':'绘制区域'}}</el-button> |
|
|
icon="el-icon-plus" |
|
|
<el-button v-if="showBtn&&hasPolygon" |
|
|
@click="handleAddPolygon">{{method==='mAddPolygon'?'取消绘制':'绘制区域'}}</el-button> |
|
|
|
|
|
<el-button v-if="showBtn&&hasPolygon" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-edit" |
|
|
|
|
|
@click="handleEditPolygon">{{method==='mEditPolygon'?'取消绘制':'重新绘制'}}</el-button> |
|
|
|
|
|
<el-button v-if="showBtn&&hasPolygon" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
@click="handleDelPolygon">删除区域</el-button> |
|
|
|
|
|
<el-button v-if="showBtn" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-upload2" |
|
|
|
|
|
@click="handleManually">手动录入</el-button> |
|
|
|
|
|
<!-- <el-button v-if="showBtn" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
@click="handleSetOffset">设置偏差</el-button> --> |
|
|
|
|
|
<span v-if="showBtn&&hasPolygon"> 经度偏差:</span> |
|
|
|
|
|
<el-input v-if="showBtn&&hasPolygon" |
|
|
|
|
|
resize="none" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
style="width:100px" |
|
|
|
|
|
placeholder='请输入经度偏差' |
|
|
|
|
|
v-model="xOffset"> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
<span v-if="showBtn&&hasPolygon"> 纬度偏差:</span> |
|
|
|
|
|
<el-input v-if="showBtn&&hasPolygon" |
|
|
|
|
|
resize="none" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
style="width:100px" |
|
|
|
|
|
placeholder='请输入维度偏差' |
|
|
|
|
|
v-model="yOffset"> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
|
|
|
|
|
|
<el-button v-if="showBtn&&hasPolygon" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
icon="el-icon-folder-add" |
|
|
|
|
|
@click="handleOffsetOk">保存</el-button> |
|
|
|
|
|
<!-- <el-button v-if="showBtn" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
@click="handleOffsetCancel">预览</el-button> --> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="div_back"> |
|
|
|
|
|
<el-button v-if="runNum>0" |
|
|
style="margin-left:10px" |
|
|
style="margin-left:10px" |
|
|
type="primary" |
|
|
type="primary" |
|
|
icon="el-icon-edit" |
|
|
icon="el-icon-back" |
|
|
@click="handleEditPolygon">{{method==='mEditPolygon'?'取消绘制':'重新绘制'}}</el-button> |
|
|
@click="handleBack">返回上一级</el-button> |
|
|
<!-- <el-button v-if="showBtn&&hasPolygon" |
|
|
|
|
|
style="margin-left:10px" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
@click="handleDelPolygon">删除区域</el-button> --> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="div_tip"> |
|
|
<div class="div_back"> |
|
|
<span>按住alt键单击标注,可以进入下一级地图</span> |
|
|
<el-button v-if="runNum>0" |
|
|
</div> |
|
|
style="margin-left:10px" |
|
|
<div id="map" |
|
|
type="primary" |
|
|
class="div_map" |
|
|
icon="el-icon-back" |
|
|
:style="{height:mapHeight+'px'}"></div> |
|
|
@click="handleBack">返回上一级</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="div_tip"> |
|
|
|
|
|
<span>按住alt键单击标注,可以进入下一级地图</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div id="map" |
|
|
|
|
|
class="div_map" |
|
|
|
|
|
:style="{height:mapHeight+'px'}"></div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<el-dialog title="手动录入" |
|
|
|
|
|
:visible.sync="dialogVisible" |
|
|
|
|
|
width="50%" |
|
|
|
|
|
:before-close="handleClose"> |
|
|
|
|
|
<div> |
|
|
|
|
|
<el-input type="textarea" |
|
|
|
|
|
:autosize="{ minRows: 4, maxRows: 7}" |
|
|
|
|
|
:rows="5" |
|
|
|
|
|
resize="none" |
|
|
|
|
|
style="width:600px" |
|
|
|
|
|
placeholder='请复制坐标数据' |
|
|
|
|
|
v-model="polygonManullyString"> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
</div> |
|
|
|
|
|
<span slot="footer" |
|
|
|
|
|
class="dialog-footer"> |
|
|
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
|
|
|
<el-button type="primary" |
|
|
|
|
|
@click="handleManuallyOk">确 定</el-button> |
|
|
|
|
|
</span> |
|
|
|
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
@ -67,7 +130,7 @@ import { Loading } from 'element-ui'; //引入Loading服务 |
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
import { altKeyOnly, click, pointerMove } from 'ol/events/condition'; |
|
|
import { altKeyOnly, click, pointerMove } from 'ol/events/condition'; |
|
|
|
|
|
|
|
|
var centerPointGlobal = [120.38945519, 36.0722275] |
|
|
var centerPointGlobal = [120.664619, 36.504963] |
|
|
let loading;//加载动画 |
|
|
let loading;//加载动画 |
|
|
|
|
|
|
|
|
let x = 1500 |
|
|
let x = 1500 |
|
@ -85,15 +148,15 @@ let mapView; |
|
|
let gaodeMapLayer;//背景地图图层 |
|
|
let gaodeMapLayer;//背景地图图层 |
|
|
let parentLayer;//上级组织图层 |
|
|
let parentLayer;//上级组织图层 |
|
|
let parentSource;//上级组织多边形 |
|
|
let parentSource;//上级组织多边形 |
|
|
let polygonLayer;//变电站标注图层 |
|
|
let polygonLayer;//标注图层 |
|
|
let polygonSource;//变电站标注多边形 |
|
|
let polygonSource;//标注多边形 |
|
|
|
|
|
|
|
|
let draw;//绘制handle |
|
|
let draw;//绘制handle |
|
|
let select;//选中标注 |
|
|
let select;//选中标注 |
|
|
let selectAltClick; |
|
|
let selectAltClick; |
|
|
let selectedFeatures; |
|
|
let selectedFeatures; |
|
|
|
|
|
|
|
|
//变电站标注的文字样式 |
|
|
//标注的文字样式 |
|
|
var createTextStyle = function (feature) { |
|
|
var createTextStyle = function (feature) { |
|
|
return new Text({ |
|
|
return new Text({ |
|
|
textAlign: undefined, |
|
|
textAlign: undefined, |
|
@ -101,7 +164,7 @@ var createTextStyle = function (feature) { |
|
|
//fontFamily: "Courier New, monospace", |
|
|
//fontFamily: "Courier New, monospace", |
|
|
fontWeight: "bold", |
|
|
fontWeight: "bold", |
|
|
text: feature.values_.name, |
|
|
text: feature.values_.name, |
|
|
//text: "变电站名称", |
|
|
//text: "名称", |
|
|
fill: new Fill({ color: "#007ab9" }), |
|
|
fill: new Fill({ color: "#007ab9" }), |
|
|
stroke: new Stroke({ color: "#ffffff", width: 3 }), |
|
|
stroke: new Stroke({ color: "#ffffff", width: 3 }), |
|
|
offsetY: 0, |
|
|
offsetY: 0, |
|
@ -172,6 +235,14 @@ const vueGis = { |
|
|
zoom: null, |
|
|
zoom: null, |
|
|
parentPolygon: [], |
|
|
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 () { |
|
|
async mounted () { |
|
@ -292,7 +363,7 @@ const vueGis = { |
|
|
|
|
|
|
|
|
//加载父级组织多边形 |
|
|
//加载父级组织多边形 |
|
|
loadParentPolygon () { |
|
|
loadParentPolygon () { |
|
|
parentSource.clear()//清空变电站标注 |
|
|
parentSource.clear()//清空标注 |
|
|
|
|
|
|
|
|
let featureData = []//标注数据 |
|
|
let featureData = []//标注数据 |
|
|
if (this.parentPolygon && this.parentPolygon.length > 0) {//判断是否存在下级标注 |
|
|
if (this.parentPolygon && this.parentPolygon.length > 0) {//判断是否存在下级标注 |
|
@ -348,7 +419,7 @@ const vueGis = { |
|
|
}, |
|
|
}, |
|
|
//加载当前园区的标注 |
|
|
//加载当前园区的标注 |
|
|
loadPolygon (subAgencyArray) { |
|
|
loadPolygon (subAgencyArray) { |
|
|
polygonSource.clear()//清空变电站标注 |
|
|
polygonSource.clear()//清空标注 |
|
|
|
|
|
|
|
|
let featureData = []//标注数据 |
|
|
let featureData = []//标注数据 |
|
|
if (subAgencyArray && subAgencyArray.length > 0) {//判断是否存在下级标注 |
|
|
if (subAgencyArray && subAgencyArray.length > 0) {//判断是否存在下级标注 |
|
@ -548,7 +619,7 @@ const vueGis = { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//添加变电站标注图层 |
|
|
//添加标注图层 |
|
|
addParentLayer () { |
|
|
addParentLayer () { |
|
|
parentSource = new VectorSource({ |
|
|
parentSource = new VectorSource({ |
|
|
//features: (new GeoJSON()).readFeatures(geojsonObject) |
|
|
//features: (new GeoJSON()).readFeatures(geojsonObject) |
|
@ -565,7 +636,7 @@ const vueGis = { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
//添加变电站标注图层 |
|
|
//添加标注图层 |
|
|
addPolygonLayer () { |
|
|
addPolygonLayer () { |
|
|
polygonSource = new VectorSource({ |
|
|
polygonSource = new VectorSource({ |
|
|
//features: (new GeoJSON()).readFeatures(geojsonObject) |
|
|
//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 () { |
|
|
handleAddPolygon () { |
|
@ -732,6 +883,7 @@ const vueGis = { |
|
|
}) |
|
|
}) |
|
|
.then(() => { |
|
|
.then(() => { |
|
|
this.addPolygon(coorString) |
|
|
this.addPolygon(coorString) |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
this.loadPolygon(this.subAgencyArray) |
|
|
this.loadPolygon(this.subAgencyArray) |
|
@ -751,6 +903,7 @@ const vueGis = { |
|
|
|
|
|
|
|
|
//新增标注 |
|
|
//新增标注 |
|
|
async addPolygon (coorString) { |
|
|
async addPolygon (coorString) { |
|
|
|
|
|
console.log(coorString) |
|
|
const url = "/gov/org/agency/mapaddarea" |
|
|
const url = "/gov/org/agency/mapaddarea" |
|
|
|
|
|
|
|
|
let params = { |
|
|
let params = { |
|
@ -766,7 +919,9 @@ const vueGis = { |
|
|
type: "success", |
|
|
type: "success", |
|
|
message: "绘制成功" |
|
|
message: "绘制成功" |
|
|
}); |
|
|
}); |
|
|
|
|
|
if (this.dialogVisible) { |
|
|
|
|
|
this.dialogVisible = false |
|
|
|
|
|
} |
|
|
this.refreshMap(false) |
|
|
this.refreshMap(false) |
|
|
} else { |
|
|
} else { |
|
|
this.$message({ |
|
|
this.$message({ |
|
@ -846,7 +1001,7 @@ const vueGis = { |
|
|
}, |
|
|
}, |
|
|
mapHeight () { |
|
|
mapHeight () { |
|
|
|
|
|
|
|
|
return this.clientHeight - 120; |
|
|
return this.clientHeight - 170; |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// zoom: { |
|
|
// zoom: { |
|
@ -872,16 +1027,12 @@ export default vueGis; |
|
|
<style scoped> |
|
|
<style scoped> |
|
|
.div_search { |
|
|
.div_search { |
|
|
z-index: 10; |
|
|
z-index: 10; |
|
|
position: absolute; |
|
|
|
|
|
top: 20px; |
|
|
|
|
|
left: 20px; |
|
|
|
|
|
display: flex; |
|
|
display: flex; |
|
|
} |
|
|
} |
|
|
.div_back { |
|
|
.div_back { |
|
|
z-index: 10; |
|
|
z-index: 10; |
|
|
position: absolute; |
|
|
|
|
|
top: 20px; |
|
|
|
|
|
right: 20px; |
|
|
|
|
|
display: flex; |
|
|
display: flex; |
|
|
} |
|
|
} |
|
|
.div_tip { |
|
|
.div_tip { |
|
@ -894,6 +1045,7 @@ export default vueGis; |
|
|
font-size: 15px; |
|
|
font-size: 15px; |
|
|
} |
|
|
} |
|
|
.div_map { |
|
|
.div_map { |
|
|
|
|
|
margin-top: 15px; |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|