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({