Browse Source

优化

shibei_master
zhaoyongnian 3 years ago
parent
commit
c62dc81c8f
  1. 50
      src/views/modules/visual/plugin/power/components/screen-org-map.vue
  2. 3
      src/views/modules/visual/plugin/power/organization.vue

50
src/views/modules/visual/plugin/power/components/screen-org-map.vue

@ -35,16 +35,14 @@ let markerLayer
let parentLayer;// let parentLayer;//
let parentSource;// 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 polygonSource;//
let iconSource; // icon let iconSource; // icon
let polygonLayer;// let polygonLayer;//
let select;// let select;//
let iconLayer; // icon let iconLayer; // icon
let iconCoordinators = [] var centerPointGlobal = [120.38945519, 36.0722275]
const iconArray = [ const iconArray = [
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/a219130b6bc74b0b80b5ddb0fce0892a.png', 'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/a219130b6bc74b0b80b5ddb0fce0892a.png',
@ -126,9 +124,13 @@ export default {
name: "screen-org-map", name: "screen-org-map",
data() { data() {
return { return {
centerPoint: [120.38945519, 36.0722275], // centerPoint: [], //
zoom: 15, // 14 zoom: 14, // 14
minZoom: 1, // minZoom: 1, //
orgData: {},//
iconCoordinators: [],
parentPolygon: [],
subAgencyArray: []
} }
}, },
async mounted() { async mounted() {
@ -149,6 +151,8 @@ export default {
}, },
methods: { methods: {
initMap () { initMap () {
this.firstCenterMap()
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
title: "地图", title: "地图",
source: new XYZ({ source: new XYZ({
@ -175,6 +179,16 @@ export default {
// console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); // 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) { addMarker (list, icon=iconArray[0], scale=1) {
markerSource = new VectorSource({ markerSource = new VectorSource({
// features: new GeoJSON().readFeatures(geojsonObject) // features: new GeoJSON().readFeatures(geojsonObject)
@ -244,15 +258,15 @@ export default {
if (code === 0) { if (code === 0) {
// this.orgData = data this.orgData = data
// this.orgId = this.orgData.id // this.orgId = this.orgData.id
// this.orgLevel = this.orgData.level // this.orgLevel = this.orgData.level
parentPolygon = [] this.parentPolygon = []
parentPolygon.push(data) this.parentPolygon.push(data)
if (data.children && data.children.length > 0) { if (data.children && data.children.length > 0) {
subAgencyArray = data.children this.subAgencyArray = data.children
} else { } else {
subAgencyArray = [] this.subAgencyArray = []
} }
} else { } else {
@ -265,10 +279,10 @@ export default {
parentSource.clear()// parentSource.clear()//
let featureData = []// let featureData = []//
if (parentPolygon && parentPolygon.length > 0) {// if (this.parentPolygon && this.parentPolygon.length > 0) {//
let oneData = {} let oneData = {}
parentPolygon.forEach(agencyItem => { this.parentPolygon.forEach(agencyItem => {
if (agencyItem.coordinates && agencyItem.coordinates !== '') {// if (agencyItem.coordinates && agencyItem.coordinates !== '') {//
oneData = { oneData = {
@ -320,12 +334,12 @@ export default {
loadPolygon () { loadPolygon () {
let featureData = []// let featureData = []//
if (subAgencyArray && subAgencyArray.length > 0) {// if (this.subAgencyArray && this.subAgencyArray.length > 0) {//
let oneData = {} let oneData = {}
let count = 0 let count = 0
for (let i = 0; i < subAgencyArray.length; i++) { for (let i = 0; i < this.subAgencyArray.length; i++) {
const agencyItem = subAgencyArray[i] const agencyItem = this.subAgencyArray[i]
if (agencyItem.coordinates && agencyItem.coordinates !== '') {// if (agencyItem.coordinates && agencyItem.coordinates !== '') {//
@ -384,7 +398,7 @@ export default {
let y = (parseFloat(extent[1]) + parseFloat(extent[3])) / 2 let y = (parseFloat(extent[1]) + parseFloat(extent[3])) / 2
let oneArray = [x, y] let oneArray = [x, y]
iconCoordinators.push(oneArray) this.iconCoordinators.push(oneArray)
// debugger // debugger
//icon //icon
let oneCctv = new Feature({ let oneCctv = new Feature({

3
src/views/modules/visual/plugin/power/organization.vue

@ -170,7 +170,7 @@ export default {
// this.agencyId = user.agencyId // this.agencyId = user.agencyId
// console.log('agencyId-------', this.agencyId) // console.log('agencyId-------', this.agencyId)
// this.agencyId = '50140d770c578100328792121aa7b3c5' // this.agencyId = '50140d770c578100328792121aa7b3c5'
this.axisStructId = '1518062548749725697' // this.axisStructId = '1518062548749725697'
await nextTick(100) await nextTick(100)
await this.getAgencylist()// await this.getAgencylist()//
await this.getStructTree() await this.getStructTree()
@ -179,6 +179,7 @@ export default {
}, },
methods: { methods: {
onClickNode (e) { onClickNode (e) {
this.pageNo = 1
this.axisStructId = e.id this.axisStructId = e.id
this.getList() this.getList()
}, },

Loading…
Cancel
Save