功能概述:
- 使用localStorage存储最近一次导入任务信息
- 支持切换菜单后查看上一次的导入失败记录
- 自动过期处理(7天)
- 完整的错误处理和用户友好的提示信息
- 新增清除历史记录功能
核心实现:
- saveImportTaskToStorage: 保存导入状态到localStorage
- getImportTaskFromStorage: 读取并验证导入状态
- clearImportTaskFromStorage: 清除localStorage数据
- restoreImportState: 页面加载时恢复导入状态
- getLastImportTooltip: 获取导入时间提示
- clearImportHistory: 用户手动清除历史记录
导入流程增强:
- handleFileSuccess: 保存初始状态,清除旧数据
- handleImportComplete: 保存完整状态,更新UI
- startImportStatusPolling: 添加5分钟超时机制
错误处理增强:
- getFailureList: 分类处理404/500/网络错误
- 404错误时自动清除localStorage并隐藏按钮
- 友好的用户提示信息
UI优化:
- lastImportInfo计算属性显示导入统计
- 失败记录按钮tooltip显示导入时间
- 失败记录对话框显示完整统计信息
- 对话框添加清除历史记录按钮
测试场景:
- 导入成功无失败后刷新页面
- 导入有失败后刷新页面
- 导入有失败后切换菜单
- 新导入覆盖旧记录
- 手动清除历史记录
- localStorage过期处理
相关提交:
- b932a7d docs: 添加员工导入结果跨页面持久化设计文档
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
45 lines
2.6 KiB
JSON
45 lines
2.6 KiB
JSON
{
|
|
"timestamp": "2026-02-06T04:18:44.937Z",
|
|
"tests": [
|
|
{
|
|
"test": "设置测试数据",
|
|
"passed": true,
|
|
"details": "测试数据已生成: {\"taskId\":\"test-restore-123\",\"status\":\"PARTIAL_SUCCESS\",\"timestamp\":1770351524941,\"saveTime\":1770351524941,\"hasFailures\":true,\"totalCount\":100,\"successCount\":95,\"failureCount\":5}",
|
|
"error": null,
|
|
"stack": null
|
|
},
|
|
{
|
|
"test": "生成浏览器测试脚本",
|
|
"passed": true,
|
|
"details": "测试脚本已生成: D:\\ccdi\\ccdi\\test-results\\task2-browser-test.js",
|
|
"error": null,
|
|
"stack": null
|
|
},
|
|
{
|
|
"test": "验证方法存在性",
|
|
"passed": false,
|
|
"details": "读取Vue文件失败",
|
|
"error": "ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'",
|
|
"stack": "Error: ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'\n at Object.readFileSync (node:fs:434:20)\n at testMethodExistence (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:163:27)\n at main (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:311:9)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)"
|
|
},
|
|
{
|
|
"test": "验证方法签名",
|
|
"passed": false,
|
|
"details": "读取Vue文件失败",
|
|
"error": "ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'",
|
|
"stack": "Error: ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'\n at Object.readFileSync (node:fs:434:20)\n at testMethodSignatures (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:201:27)\n at main (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:312:9)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)"
|
|
},
|
|
{
|
|
"test": "代码质量检查",
|
|
"passed": false,
|
|
"details": "读取Vue文件失败",
|
|
"error": "ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'",
|
|
"stack": "Error: ENOENT: no such file or directory, open 'D:\\ccdi\\ruoyi-ui\\src\\views\\ccdiEmployee\\index.vue'\n at Object.readFileSync (node:fs:434:20)\n at testCodeQuality (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:266:27)\n at main (D:\\ccdi\\ccdi\\test\\task2-test-state-restoration.js:313:9)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)"
|
|
}
|
|
],
|
|
"summary": {
|
|
"total": 5,
|
|
"passed": 2,
|
|
"failed": 3
|
|
}
|
|
} |