diff --git a/src/views/modules/ecss/createDeclaration.vue b/src/views/modules/ecss/createDeclaration.vue index 4c50108..6e82daf 100644 --- a/src/views/modules/ecss/createDeclaration.vue +++ b/src/views/modules/ecss/createDeclaration.vue @@ -458,7 +458,7 @@ - 保存 + 保存 关闭 @@ -496,6 +496,7 @@ dataList2:[], detailList:[], dataListLoading: false, + saveLoading: false, searchData: { page: 1, limit: 100, @@ -1440,6 +1441,11 @@ this.declarationData.salesArea=this.customerMap.get(this.declarationData.overseasShipper) }, */ saveDeclaration(){ + // 防止重复点击 + if(this.saveLoading) { + return false + } + if(this.detailList==null|| this.detailList.length<1){ this.$alert('不存在明细记录!', '错误', { confirmButtonText: '确定' @@ -1454,7 +1460,11 @@ return false } } + + // 开始loading + this.saveLoading = true this.declarationData.detailList=this.detailList + saveDeclaration(this.declarationData).then(({data}) => { //区分请求成功和失败的状况 if (data && data.code === 0) { @@ -1465,6 +1475,15 @@ confirmButtonText: '确定' }) } + }).catch(error => { + // 处理请求异常 + this.$alert('保存失败,请重试!', '错误', { + confirmButtonText: '确定' + }) + console.error('保存报关单失败:', error) + }).finally(() => { + // 无论成功失败都要关闭loading + this.saveLoading = false }); }, //导出excel