Browse Source

fix(warehouse): 解决IFS调用错误日志重试功能并发问题

- 使用全局重试状态控制按钮,避免多行同时重试
- 添加retryingRowId变量跟踪当前正在重试的行ID
- 重试时检查是否有其他行正在重试并显示警告提示
- 优化重试按钮的加载和禁用状态逻辑
- 完善重试过程中的UI反馈和状态同步
master
常熟吴彦祖 13 hours ago
parent
commit
55fb956c73
  1. 34
      src/views/modules/warehouse/ifsCallErrorLog.vue

34
src/views/modules/warehouse/ifsCallErrorLog.vue

@ -118,15 +118,16 @@
@click="showDetailDialog(scope.row)"> @click="showDetailDialog(scope.row)">
查看详情 查看详情
</el-button> </el-button>
<!-- rqrq - 使用全局重试状态控制按钮 -->
<el-button <el-button
v-if="scope.row.processStatus === 'PENDING'" v-if="scope.row.processStatus === 'PENDING'"
type="text" type="text"
size="small" size="small"
style="color: #E6A23C;" style="color: #E6A23C;"
:loading="scope.row._retrying"
:disabled="scope.row._retrying"
:loading="retryingRowId === scope.row.id"
:disabled="retryingRowId !== null"
@click="handleRetry(scope.row)"> @click="handleRetry(scope.row)">
{{ scope.row._retrying ? '重试中...' : '重试' }}
{{ retryingRowId === scope.row.id ? '重试中...' : '重试' }}
</el-button> </el-button>
<span v-else>-</span> <span v-else>-</span>
</span> </span>
@ -142,7 +143,21 @@
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<a type="text" size="small" @click="showDetailDialog(scope.row)">查看详情</a> <a type="text" size="small" @click="showDetailDialog(scope.row)">查看详情</a>
<a type="text" size="small" v-if="scope.row.processStatus === 'PENDING'" @click="handleRetry(scope.row)">重试</a>
<!-- rqrq - 当前行正在重试时显示"重试中..." -->
<span
v-if="scope.row.processStatus === 'PENDING' && retryingRowId === scope.row.id"
style="color: #E6A23C; margin-left: 10px;">重试中...</span>
<!-- rqrq - 其他行有重试时显示禁用状态的重试按钮 -->
<span
v-else-if="scope.row.processStatus === 'PENDING' && retryingRowId !== null"
style="color: #C0C4CC; margin-left: 10px; cursor: not-allowed;"
@click="handleRetry(scope.row)">重试</span>
<!-- rqrq - 没有重试时显示正常的重试按钮 -->
<a
type="text"
size="small"
v-else-if="scope.row.processStatus === 'PENDING'"
@click="handleRetry(scope.row)">重试</a>
<!-- <a type="text" size="small" v-if="scope.row.processStatus === 'PENDING'" @click="closeRetry(scope.row)">忽略</a>--> <!-- <a type="text" size="small" v-if="scope.row.processStatus === 'PENDING'" @click="closeRetry(scope.row)">忽略</a>-->
</template> </template>
</el-table-column> </el-table-column>
@ -493,6 +508,7 @@ export default {
processRemark: '', processRemark: '',
markProcessedLoading: false, markProcessedLoading: false,
markIgnoredLoading: false, markIgnoredLoading: false,
retryingRowId: null, // ID - rqrq
// - rqrq // - rqrq
exportData: [], exportData: [],
exportName: 'IFS错误日志' + this.dayjs().format('YYYYMMDDHHmmss'), exportName: 'IFS错误日志' + this.dayjs().format('YYYYMMDDHHmmss'),
@ -689,12 +705,19 @@ export default {
// IFS - rqrq // IFS - rqrq
handleRetry(row) { handleRetry(row) {
// - rqrq
if (this.retryingRowId !== null) {
this.$message.warning('请等待当前重试完成后再操作')
return
}
this.$confirm('确定要重试此记录的IFS接口调用吗?', '确认重试', { this.$confirm('确定要重试此记录的IFS接口调用吗?', '确认重试', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// loading - rqrq
// - rqrq
this.retryingRowId = row.id
this.$set(row, '_retrying', true) this.$set(row, '_retrying', true)
const params = { const params = {
@ -719,6 +742,7 @@ export default {
}).finally(() => { }).finally(() => {
// loading - rqrq // loading - rqrq
this.$set(row, '_retrying', false) this.$set(row, '_retrying', false)
this.retryingRowId = null
}) })
}).catch(() => { }).catch(() => {
// //

Loading…
Cancel
Save