feat(purchase-transaction): 添加getFailureList方法
- 调用API获取失败记录列表 - 支持分页查询 - 完善错误处理机制: - 404: 记录过期,清除本地状态 - 500: 服务器错误提示 - 网络错误: 检查网络连接 - 其他错误: 显示详细错误信息 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -983,6 +983,44 @@ export default {
|
|||||||
}
|
}
|
||||||
}, 2000); // 每2秒轮询一次
|
}, 2000); // 每2秒轮询一次
|
||||||
},
|
},
|
||||||
|
/** 查询失败记录列表 */
|
||||||
|
getFailureList() {
|
||||||
|
this.failureLoading = true;
|
||||||
|
getImportFailures(
|
||||||
|
this.currentTaskId,
|
||||||
|
this.failureQueryParams.pageNum,
|
||||||
|
this.failureQueryParams.pageSize
|
||||||
|
).then(response => {
|
||||||
|
this.failureList = response.rows;
|
||||||
|
this.failureTotal = response.total;
|
||||||
|
this.failureLoading = false;
|
||||||
|
}).catch(error => {
|
||||||
|
this.failureLoading = false;
|
||||||
|
|
||||||
|
// 处理不同类型的错误
|
||||||
|
if (error.response) {
|
||||||
|
const status = error.response.status;
|
||||||
|
|
||||||
|
if (status === 404) {
|
||||||
|
// 记录不存在或已过期
|
||||||
|
this.$modal.msgWarning('导入记录已过期,无法查看失败记录');
|
||||||
|
this.clearImportTaskFromStorage();
|
||||||
|
this.showFailureButton = false;
|
||||||
|
this.currentTaskId = null;
|
||||||
|
this.failureDialogVisible = false;
|
||||||
|
} else if (status === 500) {
|
||||||
|
this.$modal.msgError('服务器错误,请稍后重试');
|
||||||
|
} else {
|
||||||
|
this.$modal.msgError(`查询失败: ${error.response.data.msg || '未知错误'}`);
|
||||||
|
}
|
||||||
|
} else if (error.request) {
|
||||||
|
// 请求发送了但没有收到响应
|
||||||
|
this.$modal.msgError('网络连接失败,请检查网络');
|
||||||
|
} else {
|
||||||
|
this.$modal.msgError('查询失败记录失败: ' + error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 查看导入失败记录 */
|
/** 查看导入失败记录 */
|
||||||
viewImportFailures() {
|
viewImportFailures() {
|
||||||
this.failureDialogVisible = true;
|
this.failureDialogVisible = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user