<!--
|
* @Author: shuishen 1109946754@qq.com
|
* @Date: 2023-03-10 15:27:59
|
* @LastEditors: shuishen 1109946754@qq.com
|
* @LastEditTime: 2024-11-28 19:29:15
|
* @FilePath: \bigScreen\src\views\companyInfo\components\box\unitContent.vue
|
* @Description:
|
*
|
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
|
-->
|
<script setup>
|
import EventBus from 'utils/bus'
|
import { nextTick } from 'vue'
|
|
import { getDictionary } from "@/api/dict/dict"
|
import { onUnmounted, reactive } from 'vue'
|
import { getList } from "@/api/space/space"
|
const { VITE_APP_BASE } = import.meta.env
|
let image = ref(
|
[{ label: '阀', value: VITE_APP_BASE + 'img/mapicon/ysf.png' }
|
, { label: '池', value: VITE_APP_BASE + 'img/mapicon/yjc.png' }
|
, { label: '泵', value: VITE_APP_BASE + 'img/mapicon/yjb.png' }]
|
)
|
|
const resData = reactive({
|
data: []
|
})
|
const curSelect = ref('')
|
|
let addTileLayers = {}
|
let addPupoLayers = {}
|
onMounted(() => {
|
handleCheckChange()
|
})
|
const handleCheckChange = () => {
|
let companyInfo = JSON.parse(localStorage.getItem('companyInfo'))
|
// resData.data.forEach(item => {
|
// if (row.value == item.value) {
|
if (!addTileLayers[companyInfo.name]) {
|
addTileLayers[companyInfo.name] = new DC.HtmlLayer(companyInfo.name)
|
window.$viewer.addLayer(addTileLayers[companyInfo.name])
|
getList({
|
firmId: companyInfo.id,
|
size: 1000,
|
// type: item.type,
|
}).then(res => {
|
let data = res.data.data.records
|
data.filter(i => i.lng && i.lng != '' && i.lat && i.lat != '').forEach(i => {
|
let img = image.value.filter(l => i.name.includes(l.label))
|
img = img.length > 0 ? img : image.value
|
let iconEl = `<div class="map-name">${i.name}</div>
|
<div class="map-icon"> <img src="${img[0].value}"> </div>`
|
let divIcon = new DC.DivIcon(
|
new DC.Position(i.lng, i.lat, i.ele || 64),
|
`<div class="public-map-popup ${'yjc-box'}"> ${iconEl} </div>`
|
)
|
divIcon.attrParams = i
|
let incident = (e) => {
|
const { attrParams } = e.overlay
|
// 删除
|
destroy()
|
if (!attrParams.imageUrl) {
|
return
|
}
|
addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
|
window.$viewer.addLayer(addPupoLayers[attrParams.name])
|
let iconEl = `<div class="marsBlueGradientPnl">
|
<img src="${attrParams.imageUrl}" />
|
</div>`
|
let divIcon = new DC.DivIcon(
|
new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
|
`<div class="public-map-popup-qy">
|
${iconEl}
|
</div>`
|
)
|
let incident = () => {
|
destroy()
|
}
|
divIcon.on(DC.MouseEventType.CLICK, incident)
|
addPupoLayers[attrParams.name].addOverlay(divIcon)
|
}
|
|
// if (item.incident) incident = item.incident
|
|
divIcon.on(DC.MouseEventType.CLICK, incident)
|
|
addTileLayers[companyInfo.name] && addTileLayers[companyInfo.name].addOverlay(divIcon)
|
})
|
})
|
} else {
|
addTileLayers[companyInfo.name].show = true
|
}
|
// } else {
|
// if (addTileLayers[item.label]) {
|
// addTileLayers[item.label].show = false
|
// }
|
// }
|
// })
|
}
|
// 销毁
|
function destroy () {
|
let arr = Object.keys(addPupoLayers)
|
arr.filter(i => i != 'hgyq').forEach(i => {
|
addPupoLayers[i] && window.$viewer && window.$viewer.removeLayer(addPupoLayers[i])
|
addPupoLayers[i] = null
|
delete addPupoLayers[i]
|
})
|
addPupoLayers = {}
|
}
|
nextTick(() => {
|
EventBus.emit('restHandleCheckChange', `3-3-2`)
|
EventBus.emit('restHandleCheckChange', `3-3-4`)
|
})
|
onUnmounted(() => {
|
let arr = Object.keys(addTileLayers)
|
arr.forEach(i => {
|
addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
|
addTileLayers[i] = null
|
delete addTileLayers[i]
|
})
|
destroy()
|
addTileLayers = null
|
addPupoLayers = null
|
EventBus.emit('restHandleDelChange', `3-3-2`)
|
EventBus.emit('restHandleDelChange', `3-3-4`)
|
})
|
</script>
|
|
<template>
|
<div class="left-container cur-container">
|
<!-- <div class="tablist h100">
|
<div class="cursor-p" :class="{ on: showOn(item) }" v-for="item, index in resData.data" :key="index"
|
@click="tabClick(item)">
|
<div class="nowrap-ellipsis-hidden">
|
{{ item.label }}
|
</div>
|
</div>
|
</div> -->
|
</div>
|
</template>
|
|
<style lang="scss" scoped>
|
.cur-container {
|
background: transparent;
|
pointer-events: none;
|
|
.tablist {
|
pointer-events: all;
|
|
&>div {
|
margin-top: 16px;
|
padding: 10px;
|
width: 64px;
|
height: 64px;
|
line-height: 64px;
|
text-align: center;
|
border-radius: 50%;
|
box-shadow: inset 0 0 40px #409eff;
|
color: #fff;
|
box-sizing: content-box;
|
|
&.on {
|
position: relative;
|
color: #75b1ff;
|
}
|
}
|
}
|
}
|
</style>
|