提交 d00ec496 作者: 翁进城

fix: 周期与定时飞行增加定时器刷新列表

上级 c11e07b6
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
return { return {
showTaskAdd: false, showTaskAdd: false,
taskListAll: [], taskListAll: [],
lastMsg: null timeHandle: null,
}; };
}, },
computed: { computed: {
...@@ -81,37 +81,19 @@ export default { ...@@ -81,37 +81,19 @@ export default {
]), ]),
}, },
watch: { watch: {
"hangarRealTimeData.msgList": {
immediate: false,
handler(msgList) {
// 起飞后执行刷新任务列表, 获取最新状态
if (msgList.length > 0) {
let msg = msgList[msgList.length - 1];
let keyword = "开始上传航线到无人机";
if (msg) {
if (
!this?.lastMsg?.text?.includes(keyword) &&
msg.text.includes(keyword)
) {
this.getTaskList();
}
this.lastMsg = msg;
}
}
},
},
}, },
created() { created() {
this.rootNode.$emit("hangarTaskTabChange", { this.rootNode.$emit("hangarTaskTabChange", {
type: 3, type: 3,
}); });
this.getTaskList(); this.getTaskList();
this.timeHandle = setInterval(() => {
this.getTaskList();
}, 5000);
}, },
beforeDestroy() { beforeDestroy() {
this.clearAirwayEntities(); this.clearAirwayEntities();
clearInterval(this.timeHandle);
}, },
methods: { methods: {
...mapActions("MMCFlightControlCenter", [ ...mapActions("MMCFlightControlCenter", [
......
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
<span>{{item.taskStartTime}}</span> <span>{{item.taskStartTime}}</span>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="row__column" style="color: rgb(255, 189, 54);">{{item.status}}</div> <div class="row__column" style="color: rgb(255, 189, 54);">
<el-tooltip class="item" effect="dark" :content="item.status" placement="top-start">
<span>{{item.status}}</span>
</el-tooltip>
</div>
<div class="row__column flex2 ctrl"> <div class="row__column flex2 ctrl">
<el-tooltip content="查看" placement="top"> <el-tooltip content="查看" placement="top">
<span <span
...@@ -70,7 +74,7 @@ export default { ...@@ -70,7 +74,7 @@ export default {
return { return {
showTaskAdd: false, showTaskAdd: false,
taskListAll: [], taskListAll: [],
lastMsg: null, timeHandle: null,
}; };
}, },
computed: { computed: {
...@@ -82,37 +86,19 @@ export default { ...@@ -82,37 +86,19 @@ export default {
]), ]),
}, },
watch: { watch: {
"hangarRealTimeData.msgList": {
immediate: false,
handler(msgList) {
// 起飞后执行刷新任务列表, 获取最新状态
if (msgList.length > 0) {
let msg = msgList[msgList.length - 1];
let keyword = "开始上传航线到无人机";
if (msg) {
if (
!this?.lastMsg?.text?.includes(keyword) &&
msg.text.includes(keyword)
) {
this.getTaskList();
}
this.lastMsg = msg;
}
}
},
},
}, },
created() { created() {
this.rootNode.$emit("hangarTaskTabChange", { this.rootNode.$emit("hangarTaskTabChange", {
type: 2, type: 2,
}); });
this.getTaskList(); this.getTaskList();
this.timeHandle = setInterval(() => {
this.getTaskList();
}, 5000);
}, },
beforeDestroy() { beforeDestroy() {
this.clearAirwayEntities(); this.clearAirwayEntities();
clearInterval(this.timeHandle);
}, },
methods: { methods: {
...mapActions("MMCFlightControlCenter", [ ...mapActions("MMCFlightControlCenter", [
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论