添加正在运行定时器,添加显示上次成功时间
This commit is contained in:
parent
8121c1ce7c
commit
609d97ddbd
|
|
@ -17,6 +17,7 @@ export default {
|
|||
tableLoading: false,
|
||||
ip: "",
|
||||
tableData: [],
|
||||
timer: null, // 定时器
|
||||
tokenData: {
|
||||
server: localStorage.getItem("cid_server") || "gep.ljsea.xyz",
|
||||
token: localStorage.getItem("token"),
|
||||
|
|
@ -59,6 +60,24 @@ export default {
|
|||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
// 监听 runningDialogVisible 的变化
|
||||
runningDialogVisible(newVal) {
|
||||
if (newVal) {
|
||||
// 当对话框显示时启动定时器,每秒执行一次
|
||||
this.timer = setInterval(() => {
|
||||
this.GetCIDRuningList();
|
||||
}, 1000);
|
||||
} else {
|
||||
// 当对话框隐藏时清除定时器
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// methods 是一些用来更改状态与触发更新的函数
|
||||
// 它们可以在模板中作为事件处理器绑定
|
||||
methods: {
|
||||
|
|
@ -269,6 +288,14 @@ export default {
|
|||
this.getIpClient();
|
||||
this.getCIDList();
|
||||
},
|
||||
|
||||
// 组件销毁前清除定时器
|
||||
beforeUnmount() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -468,6 +495,12 @@ export default {
|
|||
show-overflow-tooltip
|
||||
width="100"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="last_success"
|
||||
label="上次成功"
|
||||
show-overflow-tooltip
|
||||
width="100"
|
||||
></el-table-column>
|
||||
<el-table-column label="操作" width="350">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
|
|
|
|||
Loading…
Reference in New Issue