<template>
|
<div class="detailsHead">
|
<div class="droneName">小蓝工业园</div>
|
<div class="infoListBox">
|
<div v-for="item in infoList">
|
<div class="infoValue">{{ item.value }}</div>
|
<div class="infoTitle">{{ item.title }}</div>
|
</div>
|
</div>
|
<div class="controlBtn">
|
<el-icon class="refresh">
|
<Refresh />
|
</el-icon>
|
<div class="switchBtn" @click="switchBtn">
|
<div :class="{ open: open }">NO</div>
|
<div :class="{ open: !open }">OFF</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script setup>
|
import { Refresh } from '@element-plus/icons-vue'
|
import { getFlightStatistics } from '@/api/home/machineNest'
|
import { throttle } from 'lodash'
|
import { getLnglatAltitude } from '@/utils/cesium/mapUtil'
|
import _ from 'lodash'
|
|
const taskDetailsViewer = inject('taskDetailsViewer')
|
const deviceOsdInfo = inject('deviceOsdInfo')
|
const dockSn = inject('dockSn')
|
const open = ref(true)
|
const singleTotal = ref({})
|
const host = computed(() => deviceOsdInfo?.value?.data?.host || {})
|
|
const infoList = computed(() => {
|
const { longitude, latitude, height, payloads } = host?.value || {}
|
return [
|
{ title: '实时真高', value: '0' },
|
{ title: '绝对高度', value: _.round(height || 0, 1) + 'm' },
|
{ title: '水平速度', value: '0' },
|
{ title: '垂直速度', value: '0' },
|
{ title: '经度', value: _.round(longitude || 0, 2) },
|
{ title: '纬度', value: _.round(latitude || 0, 2) },
|
{ title: '4G信号', value: '0' },
|
{ title: 'SDR信号', value: '0' },
|
{ title: 'GPS搜星数', value: '0' },
|
{ title: 'RTK搜星数', value: '0' },
|
{ title: '距离机场', value: '0' },
|
{ title: '飞行时长', value: (singleTotal.value?.hour_count || 0) + '小时' },
|
{ title: '电池电量', value: (host?.value?.battery?.capacity_percent || 0) + '%' },
|
]
|
})
|
|
const switchBtn = () => {
|
open.value = !open.value
|
}
|
|
function getFlightStatisticsFun() {
|
if (!dockSn.value) return
|
getFlightStatistics(dockSn.value).then(res => {
|
singleTotal.value = res.data.data
|
})
|
}
|
|
function getRealTimeReallyHigh() {
|
if (!taskDetailsViewer?.value) return
|
const { latitude, longitude, height } = host?.value || {}
|
if (!latitude) return
|
getLnglatAltitude(longitude, latitude, taskDetailsViewer.value).then(res => {
|
const findIndex = infoList.value.findIndex(item => item.title === '实时真高')
|
infoList.value[findIndex].value = _.round(height - res?.height, 1) + 'm'
|
})
|
}
|
|
const getRealTimeReallyHighThrottle = throttle(getRealTimeReallyHigh, 500, { leading: true, trailing: true })
|
watch(
|
deviceOsdInfo,
|
() => {
|
getRealTimeReallyHighThrottle()
|
},
|
{ immediate: true }
|
)
|
|
watch(
|
dockSn,
|
() => {
|
getFlightStatisticsFun()
|
},
|
{ immediate: true }
|
)
|
</script>
|
|
<style scoped lang="scss">
|
.detailsHead {
|
position: absolute;
|
top: 0;
|
z-index: 5;
|
width: 100%;
|
height: 68px;
|
background: rgb(0, 0, 0, 0.4); /* 半透明背景 */
|
backdrop-filter: blur(5px);
|
padding: 0 31px;
|
display: flex;
|
align-items: center;
|
|
.droneName {
|
width: 132px;
|
height: 42px;
|
background: rgba(74, 72, 72, 0.54);
|
box-shadow: 0px 4px 72px 0px rgba(0, 0, 0, 0.25);
|
border-radius: 8px 8px 8px 8px;
|
border: 1px solid rgba(255, 255, 255, 0.99);
|
font-family: Segoe UI, Segoe UI;
|
font-weight: normal;
|
font-size: 18px;
|
color: #ededed;
|
text-align: center;
|
line-height: 42px;
|
}
|
|
.infoListBox {
|
width: 0;
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: space-around;
|
font-family: Segoe UI, Segoe UI;
|
font-weight: 400;
|
|
.infoValue {
|
font-size: 20px;
|
color: #ffffff;
|
line-height: 15px;
|
margin-bottom: 10px;
|
}
|
|
.infoTitle {
|
font-size: 12px;
|
color: #d2e8fa;
|
line-height: 15px;
|
}
|
}
|
|
.controlBtn {
|
width: 130px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
|
.refresh {
|
color: white;
|
font-size: 30px;
|
cursor: pointer;
|
}
|
|
.switchBtn {
|
width: 70px;
|
height: 30px;
|
box-shadow: 2px 4px 20px 0px rgba(0, 13, 26, 0.23);
|
border-radius: 4px 4px 4px 4px;
|
border: 1px solid #ffffff;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-family: Segoe UI, Segoe UI;
|
font-weight: bold;
|
font-size: 14px;
|
line-height: 30px;
|
text-align: center;
|
color: #ffffff;
|
cursor: pointer;
|
|
> div {
|
width: 50%;
|
}
|
|
.open {
|
background: #ffffff;
|
color: #242424;
|
}
|
}
|
}
|
}
|
</style>
|