|
|
@ -35,16 +35,14 @@ let markerLayer |
|
|
|
|
|
|
|
let parentLayer;//上级组织图层 |
|
|
|
let parentSource;//上级组织多边形 |
|
|
|
let parentPolygon = [] |
|
|
|
let subAgencyArray = [] |
|
|
|
// let coordinates = "120.37330480288234,36.09522923236327,120.37414203308269,36.08471360544846,120.37538113592544,36.08156561138691,120.37856261681883,36.08273773673343,120.380806397435,36.082838206810294,120.38244737292013,36.082804716145915,120.3844902172151,36.082804716145915,120.38552838373664,36.08277122739781,120.38991547489212,36.08166608146377,120.39209227801209,36.08099629692024,120.3958095865403,36.080192555468,120.39912502242612,36.080192555468,120.40110089305742,36.08025953296422,120.40197160817334,36.082369356671684,120.4011678667211,36.08457964662348,120.40006272270334,36.08665598158284,120.3979863858277,36.08889976219901,120.39751753952164,36.09037329011105,120.39785243083527,36.09161239295379,120.3990245561818,36.09419106584173,120.39775196842349,36.09573157124999,120.3975845208504,36.09646833520601,120.37330480288234,36.09522923236327" |
|
|
|
|
|
|
|
|
|
|
|
let polygonSource;//变电站标注多边形 |
|
|
|
let iconSource; // icon |
|
|
|
let polygonLayer;//变电站标注图层 |
|
|
|
let select;//选中标注 |
|
|
|
let iconLayer; // icon标注图层 |
|
|
|
let iconCoordinators = [] |
|
|
|
|
|
|
|
var centerPointGlobal = [120.38945519, 36.0722275] |
|
|
|
|
|
|
|
const iconArray = [ |
|
|
|
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/a219130b6bc74b0b80b5ddb0fce0892a.png', |
|
|
@ -126,9 +124,13 @@ export default { |
|
|
|
name: "screen-org-map", |
|
|
|
data() { |
|
|
|
return { |
|
|
|
centerPoint: [120.38945519, 36.0722275], // 中心点位置 |
|
|
|
zoom: 15, // 缩放范围:区14 |
|
|
|
centerPoint: [], // 中心点位置 |
|
|
|
zoom: 14, // 缩放范围:区14 |
|
|
|
minZoom: 1, // 最小缩放 |
|
|
|
orgData: {},//当前组织对象 |
|
|
|
iconCoordinators: [], |
|
|
|
parentPolygon: [], |
|
|
|
subAgencyArray: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
async mounted() { |
|
|
@ -149,6 +151,8 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initMap () { |
|
|
|
this.firstCenterMap() |
|
|
|
|
|
|
|
gaodeMapLayer = new TileLayer({ |
|
|
|
title: "地图", |
|
|
|
source: new XYZ({ |
|
|
@ -175,6 +179,16 @@ export default { |
|
|
|
// console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); |
|
|
|
}) |
|
|
|
}, |
|
|
|
firstCenterMap () { |
|
|
|
this.centerPoint = [] |
|
|
|
if (this.orgData.longitude && this.orgData.latitude) { |
|
|
|
this.centerPoint.push(this.orgData.longitude) |
|
|
|
this.centerPoint.push(this.orgData.latitude) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.centerPoint = centerPointGlobal |
|
|
|
} |
|
|
|
}, |
|
|
|
addMarker (list, icon=iconArray[0], scale=1) { |
|
|
|
markerSource = new VectorSource({ |
|
|
|
// features: new GeoJSON().readFeatures(geojsonObject) |
|
|
@ -244,15 +258,15 @@ export default { |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
|
|
|
|
// this.orgData = data |
|
|
|
this.orgData = data |
|
|
|
// this.orgId = this.orgData.id |
|
|
|
// this.orgLevel = this.orgData.level |
|
|
|
parentPolygon = [] |
|
|
|
parentPolygon.push(data) |
|
|
|
this.parentPolygon = [] |
|
|
|
this.parentPolygon.push(data) |
|
|
|
if (data.children && data.children.length > 0) { |
|
|
|
subAgencyArray = data.children |
|
|
|
this.subAgencyArray = data.children |
|
|
|
} else { |
|
|
|
subAgencyArray = [] |
|
|
|
this.subAgencyArray = [] |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
@ -265,10 +279,10 @@ export default { |
|
|
|
parentSource.clear()//清空变电站标注 |
|
|
|
|
|
|
|
let featureData = []//标注数据 |
|
|
|
if (parentPolygon && parentPolygon.length > 0) {//判断是否存在下级标注 |
|
|
|
if (this.parentPolygon && this.parentPolygon.length > 0) {//判断是否存在下级标注 |
|
|
|
let oneData = {} |
|
|
|
|
|
|
|
parentPolygon.forEach(agencyItem => { |
|
|
|
this.parentPolygon.forEach(agencyItem => { |
|
|
|
|
|
|
|
if (agencyItem.coordinates && agencyItem.coordinates !== '') {//如果有坐标 |
|
|
|
oneData = { |
|
|
@ -320,12 +334,12 @@ export default { |
|
|
|
loadPolygon () { |
|
|
|
let featureData = []//标注数据 |
|
|
|
|
|
|
|
if (subAgencyArray && subAgencyArray.length > 0) {//判断是否存在下级标注 |
|
|
|
if (this.subAgencyArray && this.subAgencyArray.length > 0) {//判断是否存在下级标注 |
|
|
|
let oneData = {} |
|
|
|
|
|
|
|
let count = 0 |
|
|
|
for (let i = 0; i < subAgencyArray.length; i++) { |
|
|
|
const agencyItem = subAgencyArray[i] |
|
|
|
for (let i = 0; i < this.subAgencyArray.length; i++) { |
|
|
|
const agencyItem = this.subAgencyArray[i] |
|
|
|
|
|
|
|
|
|
|
|
if (agencyItem.coordinates && agencyItem.coordinates !== '') {//如果有坐标 |
|
|
@ -384,7 +398,7 @@ export default { |
|
|
|
let y = (parseFloat(extent[1]) + parseFloat(extent[3])) / 2 |
|
|
|
|
|
|
|
let oneArray = [x, y] |
|
|
|
iconCoordinators.push(oneArray) |
|
|
|
this.iconCoordinators.push(oneArray) |
|
|
|
// debugger |
|
|
|
//地图icon样式 |
|
|
|
let oneCctv = new Feature({ |
|
|
|