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; }); } },