mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
chore: improve loading state management in ToolFormDrawer
--bug=1062445 --user=刘瑞斌 【工具】创建工具完成后,在抽屉收起前可以再次点击创建,导致可重复创建工具 https://www.tapd.cn/62980211/s/1781953
This commit is contained in:
parent
9406a2c1da
commit
36636f2707
|
|
@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue