From e7649b69f724820ad817b502732d663ecb43f1a4 Mon Sep 17 00:00:00 2001 From: xlsea Date: Thu, 25 Apr 2024 22:14:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=8A=A0=E8=BD=BD=E6=9C=AA=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/status-switch.vue | 8 +++++--- src/views/job/task/index.vue | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/common/status-switch.vue b/src/components/common/status-switch.vue index e4ba711..206aaf9 100644 --- a/src/components/common/status-switch.vue +++ b/src/components/common/status-switch.vue @@ -14,7 +14,7 @@ const props = withDefaults(defineProps(), { }); interface Emits { - (e: 'fetch', value: Api.Common.EnableStatusNumber): void; + (e: 'fetch', value: Api.Common.EnableStatusNumber, callback: () => void): void; } const emit = defineEmits(); @@ -31,8 +31,9 @@ watch( const handleUpdateValue = (value: Api.Common.EnableStatusNumber) => { loading.value = true; - emit('fetch', value); - loading.value = false; + emit('fetch', value, () => { + loading.value = false; + }); }; @@ -40,6 +41,7 @@ const handleUpdateValue = (value: Api.Common.EnableStatusNumber) => { { - const fetchFn = async (jobStatus: Api.Common.EnableStatusNumber) => { + const fetchFn = async (jobStatus: Api.Common.EnableStatusNumber, callback: () => void) => { const { error } = await fetchUpdateJobStatus({ id: row.id!, jobStatus }); if (!error) { row.jobStatus = jobStatus; window.$message?.success($t('common.updateSuccess')); } + callback(); }; return (