diff --git a/ui/src/views/tool/ToolFormDrawer.vue b/ui/src/views/tool/ToolFormDrawer.vue index 63b11c055..e2cd6ecab 100644 --- a/ui/src/views/tool/ToolFormDrawer.vue +++ b/ui/src/views/tool/ToolFormDrawer.vue @@ -415,9 +415,10 @@ const submit = async (formEl: FormInstance | undefined) => { if (!formEl) return await formEl.validate((valid: any) => { if (valid) { + loading.value = true if (isEdit.value) { loadSharedApi({ type: 'tool', systemType: apiType.value }) - .putTool(form.value?.id as string, form.value, loading) + .putTool(form.value?.id as string, form.value) .then((res: any) => { MsgSuccess(t('common.editSuccess')) emit('refresh', res.data) @@ -426,13 +427,16 @@ const submit = async (formEl: FormInstance | undefined) => { .then(() => { visible.value = false }) + .finally(() => { + loading.value = false + }) } else { const obj = { folder_id: folder.currentFolder?.id, ...form.value, } loadSharedApi({ type: 'tool', systemType: apiType.value }) - .postTool(obj, loading) + .postTool(obj) .then((res: any) => { MsgSuccess(t('common.createSuccess')) emit('refresh') @@ -441,6 +445,9 @@ const submit = async (formEl: FormInstance | undefined) => { .then(() => { visible.value = false }) + .finally(() => { + loading.value = false + }) } } })