2023-09-20 21:33:11 +08:00
|
|
|
<template>
|
2024-08-07 20:04:57 +08:00
|
|
|
<div class="mainBox flex column no-select">
|
2024-07-24 20:50:34 +08:00
|
|
|
<!-- 心跳 -->
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="flex">
|
|
|
|
<div class="tag flex mac mc iconfont"
|
|
|
|
:class="online ? heartAnimation ? 'icon-heart online' : 'icon-heart1 online' : 'icon-xinsui offline'">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 锁定状态 -->
|
|
|
|
<div class="flex">
|
|
|
|
<div class="tag flex mac mc iconfont" :class="isLockState ? 'icon-suoding' : 'icon-jiesuo'">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 飞机模式 -->
|
|
|
|
<div class="flex">
|
2024-08-08 14:40:30 +08:00
|
|
|
<div v-if="getPlaneMode" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{ getPlaneMode }}</font>
|
2024-08-07 20:04:57 +08:00
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-moshixuanze">
|
|
|
|
</div>
|
2024-07-24 20:50:34 +08:00
|
|
|
</div>
|
|
|
|
<!-- 卫星 -->
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="flex">
|
2024-08-07 20:04:57 +08:00
|
|
|
<div v-if="satCount" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{ fixType }} {{ satCount }}颗</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-weixing">
|
2024-07-26 23:33:46 +08:00
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
</div>
|
|
|
|
<!-- 电池电压 -->
|
|
|
|
<div class="flex">
|
2024-08-07 20:04:57 +08:00
|
|
|
<div v-if="voltagBattery" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{ voltagBattery }}V</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-dianya1">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 电池电流 -->
|
|
|
|
<div class="flex">
|
2024-08-08 14:40:30 +08:00
|
|
|
<div v-if="currentBattery" class="plane-mode p-l-5 p-r-5 mc mac">
|
2024-08-07 20:04:57 +08:00
|
|
|
<font class="plane-mode-text">{{ currentBattery }}A</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-dianliu">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 飞机高度 -->
|
|
|
|
<div class="flex">
|
2024-08-08 14:40:30 +08:00
|
|
|
<div v-if="positionAlt" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{ positionAlt }}米</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-gaodu">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 飞机对地速度 -->
|
|
|
|
<div class="flex">
|
2024-08-08 14:40:30 +08:00
|
|
|
<div v-if="groundSpeed" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{ groundSpeed }}米/秒</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-sudu">
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-08-08 14:40:30 +08:00
|
|
|
<!-- 飞机载重 钩子状态 -->
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="flex">
|
2024-08-08 14:40:30 +08:00
|
|
|
<div v-if="loadweight" class="plane-mode p-l-5 p-r-5 mc mac">
|
|
|
|
<font class="plane-mode-text">{{hookstatus}} {{ loadweight }}克</font>
|
|
|
|
</div>
|
2024-07-25 00:32:23 +08:00
|
|
|
<div class="tag flex mac mc iconfont icon-mianxingdiaogou">
|
|
|
|
</div>
|
2024-07-24 20:50:34 +08:00
|
|
|
</div>
|
2024-07-19 20:48:06 +08:00
|
|
|
</div>
|
|
|
|
|
2023-09-20 21:33:11 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PlaneStatus',
|
|
|
|
data () {
|
|
|
|
return {
|
2024-07-24 20:50:34 +08:00
|
|
|
/* 心跳 */
|
|
|
|
heartAnimation: false, // 控制心跳动画图标
|
|
|
|
online: false,
|
|
|
|
isOnlineSetTimeout: null
|
2023-09-20 21:33:11 +08:00
|
|
|
}
|
|
|
|
},
|
2024-07-10 19:36:33 +08:00
|
|
|
props: {
|
|
|
|
plane: {
|
2024-08-20 20:53:35 +08:00
|
|
|
type: Object,
|
2024-07-10 19:36:33 +08:00
|
|
|
deep: true
|
|
|
|
}
|
|
|
|
},
|
2023-09-20 21:33:11 +08:00
|
|
|
components: {
|
|
|
|
},
|
|
|
|
computed: {
|
2024-07-24 20:50:34 +08:00
|
|
|
// 心跳随机数
|
|
|
|
heartRandom () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.heartRandom
|
|
|
|
}
|
2024-07-25 00:32:23 +08:00
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 锁定状态
|
|
|
|
isLockState () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
if (Number(this.plane.planeState.heartBeat) & 128) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
2024-07-24 20:50:34 +08:00
|
|
|
},
|
2024-08-07 20:04:57 +08:00
|
|
|
// 飞机模式
|
2024-08-08 14:40:30 +08:00
|
|
|
getPlaneMode () {
|
2024-08-07 20:04:57 +08:00
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.getPlaneMode
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
2024-07-24 20:50:34 +08:00
|
|
|
// 卫星数
|
|
|
|
satCount () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.satCount
|
|
|
|
}
|
2024-08-07 20:04:57 +08:00
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 定位状态
|
|
|
|
fixType () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.fixType
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 电池电压
|
|
|
|
voltagBattery () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.voltagBattery
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 电池电流
|
|
|
|
currentBattery () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
if (Number(this.plane.planeState.currentBattery) > 0) {
|
|
|
|
return this.plane.planeState.currentBattery
|
|
|
|
} else {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null
|
2024-08-08 14:40:30 +08:00
|
|
|
},
|
|
|
|
// 飞机高度
|
|
|
|
positionAlt () {
|
2024-08-20 20:53:35 +08:00
|
|
|
if (this.plane && this.plane.planeState && this.plane.planeState.position.length > 0) {
|
2024-08-20 11:45:49 +08:00
|
|
|
return this.plane.planeState.position[0][2]
|
2024-08-08 14:40:30 +08:00
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 飞机对地速度
|
|
|
|
groundSpeed () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.groundSpeed
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 钩子状态
|
|
|
|
hookstatus () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.hookstatus
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
// 飞机载重
|
|
|
|
loadweight () {
|
|
|
|
if (this.plane && this.plane.planeState) {
|
|
|
|
return this.plane.planeState.loadweight
|
|
|
|
}
|
|
|
|
return null
|
2024-07-24 20:50:34 +08:00
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
},
|
|
|
|
watch: {
|
2024-07-24 20:50:34 +08:00
|
|
|
heartRandom: {
|
2024-08-20 20:53:35 +08:00
|
|
|
handler () {
|
2024-07-24 20:50:34 +08:00
|
|
|
// 心跳动画
|
|
|
|
this.heartAnimation = true
|
|
|
|
setTimeout(() => {
|
|
|
|
this.heartAnimation = false
|
|
|
|
}, 500)
|
|
|
|
// 在线状态
|
|
|
|
if (this.isOnlineSetTimeout) { // 进入本次心跳 删除掉线计时 既以下会重新计时
|
|
|
|
clearInterval(this.isOnlineSetTimeout)
|
|
|
|
}
|
|
|
|
this.online = true
|
|
|
|
this.isOnlineSetTimeout = setTimeout(() => { // 计时10秒后 掉线
|
|
|
|
this.online = false
|
|
|
|
}, 10000)
|
|
|
|
}
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
},
|
2024-08-07 18:39:11 +08:00
|
|
|
methods: {
|
2024-07-24 19:50:25 +08:00
|
|
|
|
2024-08-07 18:39:11 +08:00
|
|
|
},
|
|
|
|
created () {
|
2024-08-20 11:45:49 +08:00
|
|
|
},
|
|
|
|
destroyed () {
|
2024-08-20 20:53:35 +08:00
|
|
|
if (this.isOnlineSetTimeout) {
|
|
|
|
clearInterval(this.isOnlineSetTimeout)
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
}
|
2024-08-20 20:53:35 +08:00
|
|
|
|
2023-09-20 21:33:11 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "@/styles/theme.scss";
|
2024-07-24 20:50:34 +08:00
|
|
|
|
|
|
|
.mainBox {
|
|
|
|
position: absolute;
|
2024-08-07 20:04:57 +08:00
|
|
|
width: 29px;
|
2024-07-25 17:21:18 +08:00
|
|
|
top: 40px;
|
|
|
|
left: 10px;
|
2024-07-24 20:50:34 +08:00
|
|
|
z-index: 90;
|
2024-07-25 00:32:23 +08:00
|
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
|
2024-08-07 20:04:57 +08:00
|
|
|
background-color: white;
|
2024-07-24 20:50:34 +08:00
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
2024-07-25 00:32:23 +08:00
|
|
|
.mainBox .flex:not(:first-child) {
|
|
|
|
border-top: 1px solid #ddd;
|
|
|
|
}
|
|
|
|
|
2024-07-24 20:50:34 +08:00
|
|
|
.tag {
|
|
|
|
height: 29px;
|
|
|
|
min-width: 29px;
|
|
|
|
cursor: pointer;
|
|
|
|
border: 0;
|
2024-07-25 00:32:23 +08:00
|
|
|
font-size: 22px;
|
2024-07-24 20:50:34 +08:00
|
|
|
}
|
2024-08-07 20:04:57 +08:00
|
|
|
|
|
|
|
.plane-mode {
|
|
|
|
position: absolute;
|
|
|
|
left: 29px;
|
|
|
|
height: 29px;
|
|
|
|
display: flex;
|
|
|
|
border-top-right-radius: 4px;
|
|
|
|
border-bottom-right-radius: 4px;
|
|
|
|
background-color: rgba(255, 255, 255, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
.plane-mode-text {
|
|
|
|
display: inline-block;
|
|
|
|
white-space: nowrap; /* 防止内容换行 */
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
</style>
|