diff --git a/main/manager-web/src/components/AddModelDialog.vue b/main/manager-web/src/components/AddModelDialog.vue index 9a4a6022..5add8a77 100644 --- a/main/manager-web/src/components/AddModelDialog.vue +++ b/main/manager-web/src/components/AddModelDialog.vue @@ -77,7 +77,12 @@
- + 保存
@@ -94,6 +99,7 @@ export default { }, data() { return { + saving: false, providers: [], dialogVisible: false, providersLoaded: false, @@ -175,6 +181,7 @@ export default { }, handleClose() { + this.saving = false; this.$emit('update:visible', false); }, initDynamicConfig() { @@ -185,8 +192,11 @@ export default { this.formData.configJson = newConfig; }, confirm() { + this.saving = true; + if (!this.formData.supplier) { this.$message.error('请选择供应器'); + this.saving = false; return; } @@ -206,11 +216,18 @@ export default { } }; - this.$emit('confirm', submitData); - this.$emit('update:visible', false); - this.resetForm(); + try { + this.$emit('confirm', submitData); + this.$emit('update:visible', false); + this.resetForm(); + } catch (e) { + console.error(e); + } finally { + this.saving = false; + } }, resetForm() { + this.saving = false; this.formData = { modelName: '', modelCode: '', diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue index 9a534116..f4d582c6 100644 --- a/main/manager-web/src/components/ModelEditDialog.vue +++ b/main/manager-web/src/components/ModelEditDialog.vue @@ -76,7 +76,12 @@
- + 保存
@@ -102,6 +107,7 @@ export default { dialogVisible: this.visible, providers: [], providersLoaded: false, + saving: false, allProvidersData: null, pendingProviderType: null, pendingModelData: null, @@ -195,6 +201,8 @@ export default { } }, handleSave() { + this.saving = true; // 开始保存加载 + const provideCode = this.form.configJson.type; const formData = { id: this.modelData.id, @@ -209,8 +217,19 @@ export default { ...this.form.configJson, } }; - this.$emit("save", { provideCode, formData }); - this.dialogVisible = false; + + this.$emit("save", { + provideCode, + formData, + done: () => { + this.saving = false; // 保存完成后回调 + } + }); + + // 如果父组件不处理done回调,3秒后自动关闭加载状态 + setTimeout(() => { + this.saving = false; + }, 3000); }, loadProviders() { if (this.providersLoaded) return; diff --git a/main/manager-web/src/components/ParamDialog.vue b/main/manager-web/src/components/ParamDialog.vue index 6fd5d872..7c126aa5 100644 --- a/main/manager-web/src/components/ParamDialog.vue +++ b/main/manager-web/src/components/ParamDialog.vue @@ -40,7 +40,12 @@