From 989f8de19ad823d8f1c73736b3651c35f052aaa7 Mon Sep 17 00:00:00 2001 From: wkc <978997012@qq.com> Date: Fri, 6 Feb 2026 12:33:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E8=BF=9B=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=E7=9A=84=E5=81=A5=E5=A3=AE?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加response验证,防止taskId缺失 - 添加轮询超时机制,防止无限轮询(5分钟) - 完善状态处理逻辑,成功时清除失败按钮 Co-Authored-By: Claude Sonnet 4.5 --- ruoyi-ui/src/views/ccdiEmployee/index.vue | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ruoyi-ui/src/views/ccdiEmployee/index.vue b/ruoyi-ui/src/views/ccdiEmployee/index.vue index 27310bb..2a01d9a 100644 --- a/ruoyi-ui/src/views/ccdiEmployee/index.vue +++ b/ruoyi-ui/src/views/ccdiEmployee/index.vue @@ -685,6 +685,14 @@ export default { this.upload.open = false; if (response.code === 200) { + // 验证响应数据完整性 + if (!response.data || !response.data.taskId) { + this.$modal.msgError('导入任务创建失败:缺少任务ID'); + this.upload.isUploading = false; + this.upload.open = true; + return; + } + const taskId = response.data.taskId; // 清除旧的导入记录(防止并发) @@ -728,8 +736,20 @@ export default { }, /** 开始轮询导入状态 */ startImportStatusPolling(taskId) { + let pollCount = 0; + const maxPolls = 150; // 最多轮询150次(5分钟) + this.pollingTimer = setInterval(async () => { try { + pollCount++; + + // 超时检查 + if (pollCount > maxPolls) { + clearInterval(this.pollingTimer); + this.$modal.msgWarning('导入任务处理超时,请联系管理员'); + return; + } + const response = await getImportStatus(taskId); if (response.data && response.data.status !== 'PROCESSING') { @@ -761,6 +781,7 @@ export default { type: 'success', duration: 5000 }); + this.showFailureButton = false; // 成功时清除失败按钮显示 this.getList(); } else if (statusResult.failureCount > 0) { this.$notify({