<template>
|
<public-box class="public-org-nav-bar">
|
<template slot="public-box-header">
|
<div class="title">
|
<img class="icon deblurring" src="/zhjg/img/icon/xyjz.png" alt />
|
<span>{{ arcNavBarTitle }}</span>
|
</div>
|
<img class="close deblurring" src="/zhjg/img/navicon/close.png" alt @click="closeModel" />
|
</template>
|
<template slot="public-box-content">
|
<div class="tab" v-show="false">
|
<ul>
|
<li
|
:class="{ on: item.flag }"
|
v-for="(item, index) in titleList"
|
:key="index"
|
@click="topNavClick(item, index)"
|
>{{ item.title }}</li>
|
</ul>
|
</div>
|
<ul>
|
<li v-for="(item, index) in itemNavList" :key="index" @click="mapPopup(item)">
|
<img :src="item.icon" alt />
|
<span>{{ item.mechanismName }}</span>
|
</li>
|
</ul>
|
</template>
|
</public-box>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import {
|
getList,
|
getChildNavList,
|
getChildNavDetail
|
} from '@/api/pc/public/arc'
|
|
let currentOrgLayer = null
|
|
export default {
|
name: 'ArcNavBar',
|
data () {
|
return {
|
itemNavList: [],
|
titleList: []
|
}
|
},
|
props: {},
|
computed: {
|
...mapGetters([
|
'popupBgUrl',
|
'pupupQRUrl',
|
// 点信息
|
'pointPosition',
|
// 点名称
|
'stateName',
|
// 地址
|
'siteName',
|
// 介绍
|
'introduceText',
|
// 全景地址
|
'panoramaUrl',
|
'arcNavBarTitle',
|
'arcNavBarCode',
|
'twoOrThree'
|
])
|
},
|
created () {
|
},
|
mounted () {
|
this.$nextTick(() => {
|
currentOrgLayer = new global.DC.HtmlLayer('currentOrgLayer')
|
global.viewer.addLayer(currentOrgLayer)
|
})
|
},
|
watch: {
|
arcNavBarCode: {
|
immediate: true,
|
handler (newCode, oldCode) {
|
this.titleList = []
|
getList().then((res) => {
|
res.data.data.forEach((item) => {
|
this.titleList.push({
|
title: item.dictValue,
|
flag: false,
|
key: item.dictKey
|
})
|
})
|
|
this.titleList[0].flag = true
|
|
this.getChilsNavs(this.titleList[0].key)
|
})
|
}
|
}
|
},
|
methods: {
|
|
coordinate (item) {
|
const arr = item.split(',')
|
|
return {
|
lng: arr[0],
|
lat: arr[1]
|
}
|
},
|
|
topNavClick (item, index) {
|
this.titleList.forEach((item) => {
|
item.flag = false
|
})
|
|
this.titleList[index].flag = true
|
|
this.getChilsNavs(item.key)
|
},
|
|
getChilsNavs (campus) {
|
const that = this
|
|
this.itemNavList = []
|
|
currentOrgLayer.clear()
|
|
getChildNavList({ campus: campus, type: this.arcNavBarCode }).then(
|
(res) => {
|
this.$EventBus.$emit('closeTagLayer')
|
|
res.data.data.forEach((item) => {
|
item.icon = '/zhjg/img/navicon/tag.png'
|
|
let obj = {}
|
if (item.x && item.x != '') {
|
const position = that.coordinate(item.x)
|
obj = {
|
lng: position.lng, lat: position.lat
|
}
|
} else {
|
obj = {
|
lng: item.jd, lat: item.wd
|
}
|
}
|
|
let divIcon = null
|
let siteJd = null
|
let siteWd = null
|
|
if (this.twoOrThree == '三 维') {
|
siteJd = obj.lng
|
siteWd = obj.lat
|
} else {
|
siteJd = item.jd
|
siteWd = item.wd
|
}
|
|
divIcon = new global.DC.DivIcon(
|
new global.DC.Position(Number(siteJd), Number(siteWd), 0),
|
`
|
<div class="arc-list-entitys-box">
|
<div>${item.mechanismName}</div>
|
<img src="/zhjg/img/icon/bubble.png" alt="">
|
</div>
|
`
|
)
|
|
divIcon.attr.params = item
|
|
divIcon.attrParams = item
|
|
divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
|
that.mapPopup(e.overlay.attrParams)
|
})
|
|
currentOrgLayer.addOverlay(divIcon)
|
})
|
|
this.itemNavList = res.data.data
|
}
|
)
|
},
|
|
mapPopup (param) {
|
getChildNavDetail({ id: param.id }).then((res) => {
|
var result = res.data.data[0].list
|
this.$store.commit('CLEAR_ALL', null)
|
|
var imgArr = result.tpurl.split(',')
|
|
const position = this.coordinate(result.x)
|
|
console.log(position)
|
|
this.$store.commit('SET_POPUPBGURL', imgArr[0])
|
this.$store.commit('SET_POPUPQRURL', result.codeurl)
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(position.lng),
|
Number(position.lat),
|
Number(result.gd),
|
Number(result.heading),
|
Number(result.pitch),
|
Number(result.roll)
|
])
|
this.$store.commit('SET_STATENAME', result.mechanismname)
|
this.$store.commit('SET_SITENAME', result.address)
|
this.$store.commit('SET_TELEPHONE', result.telephone)
|
this.$store.commit('SET_INTRODUCETEXT', result.introduce)
|
this.$store.commit('SET_PANORAMAURL', result.panoramaurl)
|
this.$store.commit('SET_POPUPIMGATLAS', imgArr)
|
if (result.videourl && result.videourl != '') {
|
this.$store.commit('SET_MONITORURL', result.videourl)
|
}
|
if (res.data.data[0].jx != undefined && res.data.data[0].jx != '') {
|
var tabOne = res.data.data[0].jx.split(',')
|
this.$store.commit('SET_TEACHLIST', tabOne)
|
} else {
|
this.$store.commit('SET_TEACHLIST', [])
|
}
|
|
if (res.data.data[0].sh != undefined && res.data.data[0].sh != '') {
|
var tabTwo = res.data.data[0].sh.split(',')
|
this.$store.commit('SET_LIVELIST', tabTwo)
|
} else {
|
this.$store.commit('SET_LIVELIST', [])
|
}
|
|
this.newPopup(result, position)
|
|
if (this.twoOrThree == '三 维') {
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(position.lng),
|
Number(position.lat),
|
Number(result.gd),
|
Number(result.heading),
|
Number(result.pitch),
|
Number(result.roll)
|
])
|
|
global.viewer.flyToPosition(
|
new global.DC.Position(
|
Number(position.lng),
|
Number(position.lat),
|
300,
|
Number(result.heading),
|
Number(result.pitch),
|
Number(result.roll)
|
),
|
function () { },
|
3
|
)
|
} else {
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(result.jd),
|
Number(result.wd),
|
Number(result.gd),
|
Number(result.heading),
|
Number(result.pitch),
|
Number(result.roll)
|
])
|
|
global.viewer.flyToPosition(
|
new global.DC.Position(
|
Number(result.jd),
|
Number(result.wd),
|
300,
|
Number(result.heading),
|
Number(result.pitch),
|
Number(result.roll)
|
),
|
function () { },
|
3
|
)
|
}
|
})
|
},
|
|
newPopup (item, positionArr) {
|
let position
|
if (this.twoOrThree == '三 维') {
|
position = global.DC.Transform.transformWGS84ToCartesian(
|
new global.DC.Position(
|
Number(positionArr.lng),
|
Number(positionArr.lat),
|
Number(item.alt)
|
)
|
)
|
} else {
|
position = global.DC.Transform.transformWGS84ToCartesian(
|
new global.DC.Position(
|
Number(item.jd),
|
Number(item.wd),
|
Number(50)
|
)
|
)
|
}
|
|
// eslint-disable-next-line no-unused-vars
|
var popup = new global.DC.DivForms(global.viewer, {
|
domId: 'divFormsDomBox',
|
position: [position]
|
})
|
|
this.$store.commit('SET_PANORAMAPOPUP', false)
|
this.$store.commit('SET_MONITORPOPUP', false)
|
this.$store.commit('SET_DETAILSPOPUP', true)
|
},
|
|
closeModel () {
|
var path = this.$route.path
|
if (path.indexOf('/arc') != -1) {
|
this.$store.dispatch('delVisitedViews', this.$route)
|
this.$router.push('/pcLayout/default')
|
}
|
|
this.$store.commit('SET_ARCNAVBARTITLE', '')
|
this.$store.commit('SET_ARCNAVBARCODE', '')
|
this.$store.commit('SET_ARCNAVBARFLAG', false)
|
|
this.$store.commit('SET_DETAILSPOPUP', false)
|
this.$store.commit('SET_PANORAMAPOPUP', false)
|
this.$store.commit('SET_MONITORPOPUP', false)
|
|
if (currentOrgLayer != null) {
|
global.viewer.removeLayer(currentOrgLayer)
|
currentOrgLayer = null
|
}
|
}
|
},
|
|
destroyed () {
|
this.closeModel()
|
}
|
}
|
</script>
|
|
<style scoped lang="scss"></style>
|