diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index be33dc4..0827659 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -57,7 +57,8 @@ - + {{ item.id }} @@ -409,8 +410,7 @@ export default { */ publishFun (jsonData) { if (this.plane) { - const val = jsonData - mqtt.publishFun(`cmd/${this.plane.macadd}`, val) + mqtt.publishFun(`cmd/${this.plane.macadd}`, jsonData) } else { this.$message.warning('与飞机通信未接通,请稍后') } @@ -742,12 +742,14 @@ export default { return isOverWaight || isQuestIng } }, - created () { + mounted () { // 初始化 if (this.executeOrder) { // 有正在执行单点 this.makeRouteForMap()// 绘制地图 } else { // 没有执行订单 - this.publishFun('{"resetState":1}')// 发送设置飞机状态主题 状态设为闲置 + if (this.plane) { + this.publishFun('{"resetState":1}')// 发送设置飞机状态主题 状态设为闲置 + } } }, watch: {