From 1c8881d7a4239f3df253b6c1d32aabd294618b0d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 2 Mar 2025 12:27:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/WorkflowTaskCard.vue | 32 +++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/components/cards/WorkflowTaskCard.vue b/src/components/cards/WorkflowTaskCard.vue index fdd0433e..bba5f626 100644 --- a/src/components/cards/WorkflowTaskCard.vue +++ b/src/components/cards/WorkflowTaskCard.vue @@ -133,6 +133,28 @@ async function handleRun(item: Workflow, from_begin: boolean) { loading.value = false } +// 重置任务 +async function handleReset(item: Workflow) { + const isConfirmed = await createConfirm({ + title: '确认', + content: `是否确认重置任务 ${item.name} ?`, + }) + + if (!isConfirmed) return + + try { + const result: { [key: string]: string } = await api.post(`workflow/${item.id}/reset`) + if (result.success) { + $toast.success('重置任务成功!') + emit('refresh') + } else { + $toast.error(`重置任务失败:${result.message}`) + } + } catch (error) { + console.error(error) + } +} + // 计算状态颜色 const resolveStatusVariant = (status: string | undefined) => { if (status === 'S') return { color: 'success', text: '成功' } @@ -196,13 +218,13 @@ const resolveProgress = (item: Workflow) => { - 重新开始 + 重新执行 立即执行 + + + 重置任务 +