From 211733bf4e94915c4d4efed87ef1a15b705bef39 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 18 Jun 2024 18:53:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/application-workflow/index.vue | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ui/src/views/application-workflow/index.vue b/ui/src/views/application-workflow/index.vue index 0462b8965..b32b2128b 100644 --- a/ui/src/views/application-workflow/index.vue +++ b/ui/src/views/application-workflow/index.vue @@ -48,6 +48,8 @@ const route = useRoute() const { params: { id } } = route as any + +let interval: any const workflowRef = ref() const loading = ref(false) @@ -84,11 +86,37 @@ function getDetail() { }) } +/** + * 定时保存 + */ +const initInterval = () => { + interval = setInterval(() => { + const obj = { + work_flow: getGraphData() + } + application.asyncPutApplication(id, obj) + }, 60000) +} + +/** + * 关闭定时 + */ +const closeInterval = () => { + if (interval) { + clearInterval(interval) + } +} + onMounted(() => { getDetail() + // // 初始化定时任务 + // initInterval() }) -onBeforeUnmount(() => {}) +onBeforeUnmount(() => { + // 清除定时任务 + closeInterval() +})