From 5465b854acf5bb655598bdd5cc5df81c9c647a16 Mon Sep 17 00:00:00 2001 From: Rui_Li <877258667@qq.com> Date: Wed, 16 Apr 2025 17:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=20=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/com_tool_info_add_update.vue | 14 +++++++++++++- .../components/com_tool_instance_add_update.vue | 14 ++++++++++++-- .../com_tool_instance_date_add_update.vue | 13 ++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/views/modules/tooling/components/com_tool_info_add_update.vue b/src/views/modules/tooling/components/com_tool_info_add_update.vue index 962d6fc..8fa67d8 100644 --- a/src/views/modules/tooling/components/com_tool_info_add_update.vue +++ b/src/views/modules/tooling/components/com_tool_info_add_update.vue @@ -113,7 +113,7 @@ - {{ buttons.confirmButton }} + {{ buttons.confirmButton }} {{buttons.closeButton}} @@ -169,6 +169,7 @@ export default { addFlag: true, }, dataListLoading: false, + saveLoading: false, labels: { site: '域', toolId: '工具标识号', @@ -431,7 +432,10 @@ export default { this.$message.error('校准间隔时间不能为空!'); return false; } + //判断是否是新增 + //打开前端loading的显示 + this.saveLoading = true; if (this.addFlag){ insertToolInfo(this.pageData).then(({data}) =>{ if(data.code === 200){ @@ -441,6 +445,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); }else{ modifyToolInfo(this.pageData).then(({data}) =>{ @@ -450,6 +458,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); } }, diff --git a/src/views/modules/tooling/components/com_tool_instance_add_update.vue b/src/views/modules/tooling/components/com_tool_instance_add_update.vue index 30917d5..c29eb91 100644 --- a/src/views/modules/tooling/components/com_tool_instance_add_update.vue +++ b/src/views/modules/tooling/components/com_tool_instance_add_update.vue @@ -145,7 +145,7 @@ - {{ buttons.confirmButton }} + {{ buttons.confirmButton }} {{buttons.closeButton}} @@ -176,6 +176,7 @@ export default { showDefault: false, visible: false, addFlag: false, + saveLoading: false, pageData: { site: this.$store.state.user.site, username: this.$store.state.user.name, @@ -421,7 +422,8 @@ export default { this.$message.error('工具实例描述不能为空!'); return false; } - + //打开前端loading的显示 + this.saveLoading = true; //判断是否是新增 if (this.addFlag){ insertToolInstance(this.pageData).then(({data}) =>{ @@ -431,6 +433,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); }else{ modifyToolInstance(this.pageData).then(({data}) =>{ @@ -440,6 +446,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); } }, diff --git a/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue b/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue index 2e32c9a..1ac255c 100644 --- a/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue +++ b/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue @@ -45,7 +45,7 @@ - 保存 + 保存 关闭 @@ -66,6 +66,7 @@ export default { showDefault: false, visible: false, addFlag: true, + saveLoading: false, currentRow: {}, columnArray: [], pageData: { @@ -186,6 +187,8 @@ export default { this.$message.error('结束日期不能小于开始日期!'); } } + //打开前端loading的显示 + this.saveLoading = true; //区分新增还是修改 if(this.addFlag){ insertToolInstanceDate(this.pageData).then(({data}) =>{ @@ -196,6 +199,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); }else { modifyToolInstanceDate(this.pageData).then(({data}) =>{ @@ -206,6 +213,10 @@ export default { }else{ this.$message.error(data.msg); } + }).catch((error) => { + this.$message.error('提交失败,请重试'); + }).finally(() => { + this.saveLoading = false; }); } },