【类 型】:feat 校准磁罗盘功能

【原  因】:
【过  程】:1 控制飞机模块增加校准磁罗盘功能 2删除飞状态不需要的经纬度
【影  响】:
This commit is contained in:
tk 2024-08-20 20:53:35 +08:00
parent 0e231a5e91
commit 467c9bc6a0
3 changed files with 51 additions and 9 deletions

View File

@ -36,6 +36,20 @@
<el-button size="medium" @click="dialogVisible = false">关闭</el-button> <el-button size="medium" @click="dialogVisible = false">关闭</el-button>
</span> </span>
</template> </template>
<!-- 校准磁罗盘 -->
<template v-if="dialogItem === 'compassBox'">
<div>
<template v-if="reportCal === null">
<el-progress :percentage="completionPct"></el-progress>
</template>
<template v-else>
{{ reportCal === 'successful' ? '校准成功,重启飞机即可生效!' : '校准失败!' }}
</template>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="handlerCloseCompassBox">关闭</el-button>
</span>
</template>
</el-dialog> </el-dialog>
<!-- 底边 tab控件组 --> <!-- 底边 tab控件组 -->
<div class="flex column mr mac tabContainer p-l-10 p-r-10"> <div class="flex column mr mac tabContainer p-l-10 p-r-10">
@ -239,7 +253,7 @@
</div> </div>
<div class="butIconBox m-b-15 gap10 flex"> <div class="butIconBox m-b-15 gap10 flex">
<el-button size="medium" type="primary" class="flex1 butIcon" <el-button size="medium" type="primary" class="flex1 butIcon"
@click="publishFun('{setPlaneState:{bit:11,state:1}}'); speakText('校准磁罗盘')"> @click="publishFun('{setPlaneState:{bit:11,state:1}}'); dialogVisible = true; dialogTitle = '校准磁罗盘'; dialogItem = 'compassBox'; speakText('校准磁罗盘')">
<i class="iconfont icon-zhinanzhen f-s-24"></i> <i class="iconfont icon-zhinanzhen f-s-24"></i>
<div class="m-t-5">磁罗盘</div> <div class="m-t-5">磁罗盘</div>
</el-button> </el-button>
@ -298,7 +312,7 @@ export default {
}, },
props: { props: {
plane: { plane: {
typeof: 'Object', type: Object,
deep: true deep: true
} }
}, },
@ -363,10 +377,35 @@ export default {
*/ */
siteList () { siteList () {
return this.$store.state.siteList return this.$store.state.siteList
},
/**
* @description: 磁罗盘校准进度
*/
completionPct () {
if (this.plane && this.plane.planeState) {
return Number(this.plane.planeState.completionPct)
}
return null
},
/**
* @description: 磁罗盘校准结果
*/
reportCal () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.reportCal
}
return null
} }
}, },
methods: { methods: {
speakText, speakText,
/**
*关闭磁盘校准弹出窗口
*/
handlerCloseCompassBox () {
this.dialogVisible = false
this.plane.planeState.reportCal = null
},
/** /**
* @description: 摄像头 滑动条松开 * @description: 摄像头 滑动条松开
* @param {string} item 项目 * @param {string} item 项目

View File

@ -85,7 +85,7 @@ export default {
}, },
props: { props: {
plane: { plane: {
typeof: 'Object', type: Object,
deep: true deep: true
} }
}, },
@ -149,7 +149,7 @@ export default {
}, },
// //
positionAlt () { positionAlt () {
if (this.plane && this.plane.planeState) { if (this.plane && this.plane.planeState && this.plane.planeState.position.length > 0) {
return this.plane.planeState.position[0][2] return this.plane.planeState.position[0][2]
} }
return null return null
@ -178,7 +178,7 @@ export default {
}, },
watch: { watch: {
heartRandom: { heartRandom: {
handler (val) { handler () {
// //
this.heartAnimation = true this.heartAnimation = true
setTimeout(() => { setTimeout(() => {
@ -201,8 +201,11 @@ export default {
created () { created () {
}, },
destroyed () { destroyed () {
clearInterval(this.isOnlineSetTimeout) if (this.isOnlineSetTimeout) {
clearInterval(this.isOnlineSetTimeout)
}
} }
} }
</script> </script>

View File

@ -270,16 +270,16 @@ const store = new Vuex.Store({
res.data.airList.forEach(plane => { res.data.airList.forEach(plane => {
plane.planeState = { // 飞机状态初始化字段 plane.planeState = { // 飞机状态初始化字段
heartBeat: null, // 心跳 heartBeat: null, // 心跳
heartRandom: 0, // 每次接收到心跳创建一个随机数 用于watch监听 heartRandom: null, // 每次接收到心跳创建一个随机数 用于watch监听
voltagBattery: null, // 电压信息 voltagBattery: null, // 电压信息
currentBattery: null, // 电流信息 currentBattery: null, // 电流信息
batteryRemaining: null, // 电池电量 batteryRemaining: null, // 电池电量
positionAlt: null, // 海拔高度信息 positionAlt: null, // 海拔高度信息
groundSpeed: null, // 对地速度 groundSpeed: null, // 对地速度
satCount: null, // 卫星数量 satCount: null, // 卫星数量
latitude: null, // 纬度
longitude: null, // 经度
fixType: null, // 定位状态 fixType: null, // 定位状态
completionPct: null, // 磁罗盘校准进度
reportCal: null, // 磁罗盘校准结果
state: 1, // 飞机状态 默认初始状态为1 state: 1, // 飞机状态 默认初始状态为1
pingNet: null, // 网速测试 pingNet: null, // 网速测试
getPlaneMode: null, // 飞机模式 getPlaneMode: null, // 飞机模式