diff --git a/ruoyi-ui/src/views/ccdiPurchaseTransaction/index.vue b/ruoyi-ui/src/views/ccdiPurchaseTransaction/index.vue index a210a4d..0791e50 100644 --- a/ruoyi-ui/src/views/ccdiPurchaseTransaction/index.vue +++ b/ruoyi-ui/src/views/ccdiPurchaseTransaction/index.vue @@ -905,25 +905,54 @@ export default { handleFileUploadProgress(event, file, fileList) { this.upload.isUploading = true; }, - // 文件上传成功处理 - 使用异步导入 + // 文件上传成功处理 handleFileSuccess(response, file, fileList) { - // 检查是否返回了taskId(异步导入) - if (response.code === 200 && response.data && response.data.taskId) { - const taskId = response.data.taskId; - this.upload.isUploading = false; - this.upload.open = false; - this.$refs.upload.clearFiles(); + this.upload.isUploading = false; + this.upload.open = false; - // 开始轮询导入状态 - this.startImportPolling(taskId); + 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; + + // 清除旧的轮询定时器 + if (this.importPollingTimer) { + clearInterval(this.importPollingTimer); + this.importPollingTimer = null; + } + + this.clearImportTaskFromStorage(); + + // 保存新任务的初始状态 + this.saveImportTaskToStorage({ + taskId: taskId, + status: 'PROCESSING', + timestamp: Date.now(), + hasFailures: false + }); + + // 重置状态 + this.showFailureButton = false; + this.currentTaskId = taskId; + + // 显示后台处理提示(不是弹窗,是通知) + this.$notify({ + title: '导入任务已提交', + message: '正在后台处理中,处理完成后将通知您', + type: 'info', + duration: 3000 + }); + + // 开始轮询检查状态 + this.startImportStatusPolling(taskId); } else { - // 同步导入结果(如果后端改为同步) - this.upload.isUploading = false; - this.upload.open = false; - this.getList(); - this.importResultContent = response.msg || response; - this.importResultVisible = true; - this.$refs.upload.clearFiles(); + this.$modal.msgError(response.msg); } }, // 开始轮询导入状态