diff --git a/src/api/warehouse/ifsCallErrorLog.js b/src/api/warehouse/ifsCallErrorLog.js index 2890add..dcef9b5 100644 --- a/src/api/warehouse/ifsCallErrorLog.js +++ b/src/api/warehouse/ifsCallErrorLog.js @@ -15,3 +15,6 @@ export const getUserAuthorizedSites = data => createAPI('api/ifsCallErrorLog/get // 手工重试IFS接口调用 - rqrq export const retryIfsCall = data => createAPI('api/ifsCallErrorLog/retry', 'POST', data) export const closeIfsCall = data => createAPI('api/ifsCallErrorLog/closeRetry', 'POST', data) + +// 批量重试IFS接口调用 - rqrq +export const batchRetryIfsCall = data => createAPI('api/ifsCallErrorLog/batchRetry', 'POST', data) \ No newline at end of file diff --git a/src/views/modules/warehouse/ifsCallErrorLog.vue b/src/views/modules/warehouse/ifsCallErrorLog.vue index 3be25f1..06cca07 100644 --- a/src/views/modules/warehouse/ifsCallErrorLog.vue +++ b/src/views/modules/warehouse/ifsCallErrorLog.vue @@ -66,6 +66,14 @@ 查询 重置 + + + {{ batchRetrying ? '批量重试中...' : `一键重试(${selectedRows.length})` }} + + + + 查看详情 - 重试中... - 重试 - 重试 @@ -321,7 +337,9 @@ import { markErrorAsProcessed, markErrorAsIgnored, getUserAuthorizedSites, - retryIfsCall,closeIfsCall + retryIfsCall, + closeIfsCall, + batchRetryIfsCall } from '@/api/warehouse/ifsCallErrorLog.js' export default { @@ -509,6 +527,11 @@ export default { markProcessedLoading: false, markIgnoredLoading: false, retryingRowId: null, // 正在重试的行ID,全局唯一 - rqrq + // 批量重试相关 - rqrq + selectedRows: [], // 选中的行 + batchRetrying: false, // 批量重试中 + batchRetryProgress: 0, // 批量重试进度 + batchRetryTotal: 0, // 批量重试总数 // 导出相关 - rqrq exportData: [], exportName: 'IFS错误日志' + this.dayjs().format('YYYYMMDDHHmmss'), @@ -704,13 +727,96 @@ export default { }, // 手工重试IFS接口调用 - rqrq + // 多选变化处理 - rqrq + handleSelectionChange(selection) { + // 只保留PENDING状态的记录 - rqrq + this.selectedRows = selection.filter(row => row.processStatus === 'PENDING') + }, + + // 检查行是否可选(只允许选择PENDING状态)- rqrq + checkSelectable(row) { + return row.processStatus === 'PENDING' + }, + + // 延时函数 - rqrq + sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) + }, + + // 批量重试(调用后端接口,由后端按时间顺序执行)- rqrq + handleBatchRetry() { + if (this.selectedRows.length === 0) { + this.$message.warning('请先选择要重试的记录') + return + } + + // 检查是否有单个重试正在进行 - rqrq + if (this.retryingRowId !== null) { + this.$message.warning('请等待当前重试完成后再操作') + return + } + + this.$confirm(`确定要重试选中的 ${this.selectedRows.length} 条记录吗?将按时间顺序从最早开始逐个重试。`, '批量重试确认', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 获取选中行的ID列表 - rqrq + const ids = this.selectedRows.map(row => row.id) + + // 开始批量重试 - rqrq + this.batchRetrying = true + this.batchRetryTotal = ids.length + this.batchRetryProgress = 0 + + // 调用后端批量重试接口 - rqrq + batchRetryIfsCall({ ids }).then(({data}) => { + if (data && data.code === 0) { + const successCount = data.successCount || 0 + const failCount = data.failCount || 0 + + // 显示结果 - rqrq + this.$alert( + `批量重试完成!
成功:${successCount}
失败:${failCount} 条`, + '重试结果', + { + dangerouslyUseHTMLString: true, + confirmButtonText: '确定' + } + ) + } else { + this.$alert(data.msg || '批量重试失败', '错误', { confirmButtonText: '确定' }) + } + }).catch(error => { + console.error('批量重试失败:', error) + this.$alert('批量重试失败,请稍后再试', '错误', { confirmButtonText: '确定' }) + }).finally(() => { + // 重试完成,重置状态 - rqrq + this.batchRetrying = false + this.batchRetryProgress = 0 + this.batchRetryTotal = 0 + this.selectedRows = [] + // 刷新列表 - rqrq + this.getDataList() + }) + }).catch(() => { + // 用户取消操作 + }) + }, + handleRetry(row) { + // 检查是否有批量重试正在进行 - rqrq + if (this.batchRetrying) { + this.$message.warning('批量重试进行中,请等待完成') + return + } + // 检查是否有其他行正在重试 - rqrq if (this.retryingRowId !== null) { this.$message.warning('请等待当前重试完成后再操作') return } - + this.$confirm('确定要重试此记录的IFS接口调用吗?', '确认重试', { confirmButtonText: '确定', cancelButtonText: '取消',