From ec9fa32c81527af295e0e6df3c18c15b61f09343 Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Mon, 21 Apr 2025 11:36:10 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=B7=BB=E5=8A=A0=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6"=E4=BF=9D=E5=AD=98"=E6=97=B6=E7=9A=84loading?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/AddModelDialog.vue | 25 +++++++-- .../src/components/ModelEditDialog.vue | 25 +++++++-- .../src/components/ParamDialog.vue | 21 +++++++- main/manager-web/src/views/ModelConfig.vue | 4 +- .../src/views/ParamsManagement.vue | 51 ++++++++++--------- 5 files changed, 92 insertions(+), 34 deletions(-) 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 @@