【类 型】:fix 默认不显示电量值的bug
【原 因】:showTooltip 返回值 表达式里面 对比值不明确 【过 程】:明确 值是否为0 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
067a99282d
commit
a308ab67c4
@ -73,7 +73,7 @@ export default {
|
||||
},
|
||||
// 控制 Tooltip 显示的条件
|
||||
showTooltip () {
|
||||
return this.batteryRemainingPower || this.endurance
|
||||
return Number(this.batteryRemainingPower) !== 0 || Number(this.endurance) !== 0
|
||||
},
|
||||
// 剩余电量 (百分比)
|
||||
batteryRemaining () {
|
||||
|
@ -90,7 +90,8 @@
|
||||
<el-input v-model="paramValue" placeholder="值" class="m-t-20"></el-input>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button size="medium" type="primary" @click="publishFun(`{'setParam':{'item':'${paramItem}','value':'${paramValue}'}}`)">写入</el-button>
|
||||
<el-button size="medium" type="primary"
|
||||
@click="publishFun(`{'setParam':{'item':'${paramItem}','value':'${paramValue}'}}`)">写入</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -138,20 +139,21 @@
|
||||
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||
<font class="m-l-5">上传航点</font>
|
||||
</el-button> -->
|
||||
<el-button size="mini" class="f-s-14" v-if="Number(plane.planeState.questState) === 1 || Number(plane.planeState.questState) === 4" type="warning"
|
||||
icon="f-s-14 iconfont icon-jiesuo" @click="prepareQuest">
|
||||
<el-button size="mini" class="f-s-14"
|
||||
v-if="Number(plane.planeState.questState) === 1 || Number(plane.planeState.questState) === 4"
|
||||
type="warning" icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||
<font class="m-l-5">准备任务</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 2" key="wirteBut"
|
||||
type="info" :loading="true" disabled>
|
||||
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 2"
|
||||
key="wirteBut" type="info" :loading="true" disabled>
|
||||
<font class="m-l-5">航点写入中···</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 12" type="info"
|
||||
:loading="true" disabled>
|
||||
<font class="m-l-5">解锁中...</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 20" type="success"
|
||||
icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
||||
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 20"
|
||||
type="success" icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
||||
@click="publishFun('{setQuestState:{bit:5,state:1}}'); speakText('执行送餐任务')">
|
||||
<font class="m-l-5">执行任务</font>
|
||||
</el-button>
|
||||
@ -642,16 +644,15 @@ export default {
|
||||
console.log(error.message) // 处理检查失败的情况
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @description: 准备任务 先检查合法性,再从飞机反馈中 看有无写入航点 ,最后解锁飞机
|
||||
*/
|
||||
prepareQuest () {
|
||||
if (Number(this.plane.planeState.questState) === 1) {
|
||||
this.checkQuest()// 检查合法性
|
||||
}
|
||||
if (Number(this.plane.planeState.questState) === 4) {
|
||||
this.publishFun('{unlock:1}')// 解锁飞机
|
||||
}
|
||||
/** 等待上传完航点之后 解锁飞机 */
|
||||
watchUnlock () {
|
||||
// 使用 Vue 的 $watch 方法监听 planeState.questState 的变化
|
||||
const unwatch = this.$watch(() => this.plane.planeState.questState, (newVal) => {
|
||||
if (Number(newVal) === 4) { // 如果 questState 变为 4
|
||||
this.publishFun('{unlock:1}') // 解锁飞机
|
||||
unwatch() // 解除监听,防止多次触发
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @description: 正在执行的任务 重新上传航线
|
||||
@ -677,8 +678,8 @@ export default {
|
||||
}
|
||||
})
|
||||
routeData = JSON.stringify(routeData)// 重新序列化
|
||||
// 发送航点信息主题
|
||||
this.publishFun(routeData)
|
||||
this.publishFun(routeData) // 发送航点信息主题
|
||||
this.watchUnlock()// 等待飞机写完航点 解锁飞机
|
||||
} catch (error) {
|
||||
this.$message.error('操作失败,航线异常')
|
||||
}
|
||||
@ -743,6 +744,7 @@ export default {
|
||||
})
|
||||
if (res.data.status === 1) {
|
||||
this.publishFun(routeData)// 发送航点信息主题
|
||||
this.watchUnlock()// 等待飞机写完航点 解锁飞机
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user