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