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;