diff --git a/src/views/modules/ecss/codelnotify.vue b/src/views/modules/ecss/codelnotify.vue index 8e02cd0..6e652ff 100644 --- a/src/views/modules/ecss/codelnotify.vue +++ b/src/views/modules/ecss/codelnotify.vue @@ -390,8 +390,10 @@ - 保存 - 关闭 + + {{ updateDetailLoading ? '保存中...' : '保存' }} + + 关闭 @@ -786,6 +788,7 @@ dataList2:[], dataListLoading: false, xiadaLoading: false, // 下达按钮加载状态 + updateDetailLoading: false, // 明细保存/取消按钮加载状态 searchData: { page: 1, limit: 100, @@ -2277,9 +2280,24 @@ }) return false } + + // 开始加载 + this.updateDetailLoading = true + updateEcssDelDetail(this.updateDetailModel).then(({data}) => { if (data && data.code === 0) { + // 保存当前选中行的标识,以便刷新后恢复 + const currentSelectedKey = this.currentRow ? this.currentRow.delNo : null + if (currentSelectedKey) { + this.selectedRowKey = currentSelectedKey + this.saveSelectedRowToStorage() + } + + // 刷新明细表格 this.refreshCurrentTabTable() + // 刷新表头列表 + this.searchTable() + this.updateDetailModelFlag=false this.$message({ message: '操作成功', @@ -2292,6 +2310,14 @@ confirmButtonText: '确定' }) } + }).catch((error) => { + // 处理错误情况 + this.$alert('操作失败,请重试', '错误', { + confirmButtonText: '确定' + }) + }).finally(() => { + // 无论成功还是失败都要恢复加载状态 + this.updateDetailLoading = false }) }, @@ -2352,9 +2378,23 @@ }, deleteDelDetail(row){ this.$confirm('确认取消此明细?', '提示').then(() => { + // 开始加载 + this.updateDetailLoading = true + deleteEcssDelDetail(row).then(({data}) => { if (data && data.code === 0) { + // 保存当前选中行的标识,以便刷新后恢复 + const currentSelectedKey = this.currentRow ? this.currentRow.delNo : null + if (currentSelectedKey) { + this.selectedRowKey = currentSelectedKey + this.saveSelectedRowToStorage() + } + + // 刷新明细表格 this.refreshCurrentTabTable() + // 刷新表头列表 + this.searchTable() + this.$message({ message: '操作成功', type: 'success', @@ -2366,7 +2406,17 @@ confirmButtonText: '确定' }) } + }).catch((error) => { + // 处理错误情况 + this.$alert('操作失败,请重试', '错误', { + confirmButtonText: '确定' + }) + }).finally(() => { + // 无论成功还是失败都要恢复加载状态 + this.updateDetailLoading = false }) + }).catch(() => { + // 用户取消确认时不需要loading状态 }) }, getBu () {