|
|
@ -139,7 +139,6 @@ |
|
|
<!-- 表格操作按钮 --> |
|
|
<!-- 表格操作按钮 --> |
|
|
<div class="table-actions"> |
|
|
<div class="table-actions"> |
|
|
<el-button |
|
|
<el-button |
|
|
v-if="dataListSelections.length > 0" |
|
|
|
|
|
type="danger" |
|
|
type="danger" |
|
|
@click="deleteHandle()" |
|
|
@click="deleteHandle()" |
|
|
icon="el-icon-delete" |
|
|
icon="el-icon-delete" |
|
|
@ -147,12 +146,11 @@ |
|
|
批量删除 |
|
|
批量删除 |
|
|
</el-button> |
|
|
</el-button> |
|
|
<el-button |
|
|
<el-button |
|
|
v-if="dataListSelections.length > 0" |
|
|
|
|
|
type="success" |
|
|
|
|
|
@click="retryHandle()" |
|
|
|
|
|
icon="el-icon-refresh" |
|
|
|
|
|
|
|
|
type="warning" |
|
|
|
|
|
@click="batchRetryInterfaceHandle()" |
|
|
|
|
|
icon="el-icon-refresh-right" |
|
|
size="small"> |
|
|
size="small"> |
|
|
批量重试 |
|
|
|
|
|
|
|
|
手动重试 |
|
|
</el-button> |
|
|
</el-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
@ -297,7 +295,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { searchApiLogs, getApiLogParams, deleteApiLogs, retryApiLogs } from '@/api/sys/interface-log' |
|
|
|
|
|
|
|
|
import { searchApiLogs, getApiLogParams, deleteApiLogs, retryApiLogs, retryInterface } from '@/api/sys/interface-log' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
@ -457,22 +455,108 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 重试 |
|
|
|
|
|
retryHandle() { |
|
|
|
|
|
const ids = this.dataListSelections.map(item => item.id) |
|
|
|
|
|
this.$confirm('确定要重试选中的接口吗?', '提示', { |
|
|
|
|
|
|
|
|
// 批量手动重试接口 |
|
|
|
|
|
batchRetryInterfaceHandle() { |
|
|
|
|
|
if (this.dataListSelections.length === 0) { |
|
|
|
|
|
this.$message.warning('请选择要重试的记录!') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const count = this.dataListSelections.length |
|
|
|
|
|
this.$confirm(`确定要手动重试选中的 ${count} 个接口吗?`, '提示', { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
|
cancelButtonText: '取消', |
|
|
cancelButtonText: '取消', |
|
|
type: 'warning' |
|
|
type: 'warning' |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
retryApiLogs({ ids }).then(({ data }) => { |
|
|
|
|
|
|
|
|
const loading = this.$loading({ |
|
|
|
|
|
lock: true, |
|
|
|
|
|
text: `正在重试 ${count} 个接口,请稍候...`, |
|
|
|
|
|
spinner: 'el-icon-loading', |
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 构造批量重试参数 |
|
|
|
|
|
const retryList = this.dataListSelections.map(item => ({ |
|
|
|
|
|
site: item.site, |
|
|
|
|
|
buNo: item.buNo, |
|
|
|
|
|
requestId: item.requestId, |
|
|
|
|
|
requestGroupId: item.requestGroupId, |
|
|
|
|
|
interfaceName: item.interfaceName |
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
// 调用批量重试接口 |
|
|
|
|
|
retryInterface({ retryList }).then(({ data }) => { |
|
|
|
|
|
loading.close() |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.$message.success('重试成功') |
|
|
|
|
|
|
|
|
const result = data.result |
|
|
|
|
|
const successCount = result.successCount || 0 |
|
|
|
|
|
const failureCount = result.failureCount || 0 |
|
|
|
|
|
const errorCount = result.errorCount || 0 |
|
|
|
|
|
|
|
|
|
|
|
// 显示详细结果 |
|
|
|
|
|
let message = `重试完成!成功:${successCount},失败:${failureCount},异常:${errorCount}` |
|
|
|
|
|
|
|
|
|
|
|
if (successCount === count) { |
|
|
|
|
|
this.$message.success(message) |
|
|
|
|
|
} else if (successCount > 0) { |
|
|
|
|
|
this.$message.warning(message) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(message) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 显示详细结果对话框 |
|
|
|
|
|
if (result.details && result.details.length > 0) { |
|
|
|
|
|
this.showRetryResultDialog(result.details) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
} else { |
|
|
} else { |
|
|
this.$message.error(data.msg || '重试失败') |
|
|
|
|
|
|
|
|
this.$message.error(data.msg || '批量重试失败') |
|
|
} |
|
|
} |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
loading.close() |
|
|
|
|
|
this.$message.error('批量重试异常:' + (err.message || '请求失败')) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 显示重试结果详情对话框 |
|
|
|
|
|
showRetryResultDialog(details) { |
|
|
|
|
|
const successList = details.filter(d => d.status === 'success') |
|
|
|
|
|
const failureList = details.filter(d => d.status === 'failure') |
|
|
|
|
|
const errorList = details.filter(d => d.status === 'error') |
|
|
|
|
|
|
|
|
|
|
|
let messageHtml = '<div style="max-height: 400px; overflow-y: auto;">' |
|
|
|
|
|
|
|
|
|
|
|
if (successList.length > 0) { |
|
|
|
|
|
messageHtml += '<div style="margin-bottom: 15px;"><strong style="color: #67C23A;">成功 (' + successList.length + '):</strong><ul style="margin: 5px 0; padding-left: 20px;">' |
|
|
|
|
|
successList.forEach(item => { |
|
|
|
|
|
messageHtml += '<li>' + item.interfaceName + (item.u8CCode ? ' - U8单号:' + item.u8CCode : '') + '</li>' |
|
|
}) |
|
|
}) |
|
|
|
|
|
messageHtml += '</ul></div>' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (failureList.length > 0) { |
|
|
|
|
|
messageHtml += '<div style="margin-bottom: 15px;"><strong style="color: #E6A23C;">失败 (' + failureList.length + '):</strong><ul style="margin: 5px 0; padding-left: 20px;">' |
|
|
|
|
|
failureList.forEach(item => { |
|
|
|
|
|
messageHtml += '<li>' + item.interfaceName + ':' + (item.message || '未知错误') + '</li>' |
|
|
|
|
|
}) |
|
|
|
|
|
messageHtml += '</ul></div>' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (errorList.length > 0) { |
|
|
|
|
|
messageHtml += '<div><strong style="color: #F56C6C;">异常 (' + errorList.length + '):</strong><ul style="margin: 5px 0; padding-left: 20px;">' |
|
|
|
|
|
errorList.forEach(item => { |
|
|
|
|
|
messageHtml += '<li>' + item.interfaceName + ':' + (item.message || '未知异常') + '</li>' |
|
|
|
|
|
}) |
|
|
|
|
|
messageHtml += '</ul></div>' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
messageHtml += '</div>' |
|
|
|
|
|
|
|
|
|
|
|
this.$alert(messageHtml, '批量重试结果详情', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
dangerouslyUseHTMLString: true |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|