feat: 添加restoreImportState方法恢复导入状态

在methods中添加restoreImportState方法,用于在页面加载时恢复之前的导入状态:
- 从localStorage读取保存的导入任务
- 如果有失败记录,恢复显示失败记录按钮
- 恢复当前任务ID

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
wkc
2026-02-08 13:59:09 +08:00
parent cb5a896fcd
commit 619b9cca7a

View File

@@ -730,6 +730,25 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/**
* 恢复导入状态
* 在created()钩子中调用
*/
restoreImportState() {
const savedTask = this.getImportTaskFromStorage();
if (!savedTask) {
this.showFailureButton = false;
this.currentTaskId = null;
return;
}
// 如果有失败记录,恢复按钮显示
if (savedTask.hasFailures && savedTask.taskId) {
this.currentTaskId = savedTask.taskId;
this.showFailureButton = true;
}
},
// 格式化金额 // 格式化金额
formatAmount(amount) { formatAmount(amount) {
if (amount === null || amount === undefined || amount === '') return '-'; if (amount === null || amount === undefined || amount === '') return '-';