From 8bf2792fd7b625501785d86a3b5dd5fcdd8007de Mon Sep 17 00:00:00 2001 From: wkc <978997012@qq.com> Date: Fri, 6 Feb 2026 12:19:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=81=A2=E5=A4=8D=E5=92=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - restoreImportState: 从localStorage恢复导入状态 - getLastImportTooltip: 获取导入时间提示信息 - clearImportHistory: 用户手动清除历史记录 - created(): 添加状态恢复调用 Co-Authored-By: Claude Sonnet 4.5 --- ruoyi-ui/src/views/ccdiEmployee/index.vue | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/ruoyi-ui/src/views/ccdiEmployee/index.vue b/ruoyi-ui/src/views/ccdiEmployee/index.vue index ae2faab..d4f8f3c 100644 --- a/ruoyi-ui/src/views/ccdiEmployee/index.vue +++ b/ruoyi-ui/src/views/ccdiEmployee/index.vue @@ -416,6 +416,7 @@ export default { created() { this.getList(); this.getDeptTree(); + this.restoreImportState(); // 新增:恢复导入状态 }, beforeDestroy() { // 组件销毁时清除定时器 @@ -487,6 +488,55 @@ export default { console.error('清除导入任务状态失败:', error); } }, + /** + * 恢复导入状态 + * 在created()钩子中调用 + */ + async 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; + } + }, + /** + * 获取上次导入的提示信息 + * @returns {String} 提示文本 + */ + getLastImportTooltip() { + const savedTask = this.getImportTaskFromStorage(); + if (savedTask && savedTask.timestamp) { + const date = new Date(savedTask.timestamp); + const timeStr = this.parseTime(date, '{y}-{m}-{d} {h}:{i}'); + return `上次导入: ${timeStr}`; + } + return ''; + }, + /** + * 清除导入历史记录 + * 用户手动触发 + */ + clearImportHistory() { + this.$confirm('确认清除上次导入记录?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.clearImportTaskFromStorage(); + this.showFailureButton = false; + this.currentTaskId = null; + this.failureDialogVisible = false; + this.$message.success('已清除'); + }).catch(() => {}); + }, /** 查询员工列表 */ getList() { this.loading = true;