From 75b766eeba29961e07439246249783b9729ba936 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Mon, 16 Dec 2024 14:52:05 +0800 Subject: [PATCH] chore: loading --- .../workflow/components/approval-panel.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/web-antd/src/views/workflow/components/approval-panel.vue b/apps/web-antd/src/views/workflow/components/approval-panel.vue index 985cca35..16c22855 100644 --- a/apps/web-antd/src/views/workflow/components/approval-panel.vue +++ b/apps/web-antd/src/views/workflow/components/approval-panel.vue @@ -22,11 +22,22 @@ defineOptions({ const props = defineProps<{ task?: TaskInfo }>(); const currentFlowInfo = ref(); +/** + * card的loading状态 + */ +const loading = ref(false); async function handleLoadInfo(task: TaskInfo | undefined) { - if (!task) return null; - const resp = await flowInfo(task.businessId); - currentFlowInfo.value = resp; + try { + if (!task) return null; + loading.value = true; + const resp = await flowInfo(task.businessId); + currentFlowInfo.value = resp; + } catch (error) { + console.error(error); + } finally { + loading.value = false; + } } watch(() => props.task, handleLoadInfo); @@ -38,6 +49,7 @@ onUnmounted(() => (currentFlowInfo.value = undefined));