diff --git a/app/run.py b/app/run.py index d285e89..d46dd9a 100644 --- a/app/run.py +++ b/app/run.py @@ -3169,6 +3169,12 @@ def reset_folder(): logging.error(f">>> 删除记录时出错: {str(e)}") # 即使删除记录失败,也返回文件删除成功 + # 成功后通过 SSE 通知前端进行热更新 + try: + notify_calendar_changed('reset_folder') + except Exception: + pass + return jsonify({ "success": True, "message": f"重置成功,删除了 {deleted_files} 个文件和 {deleted_records} 条记录", diff --git a/app/templates/index.html b/app/templates/index.html index 3311d25..9f26aa4 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -10488,6 +10488,19 @@ .then(response => { if (response.data.success) { this.showToast(`重置成功:删除了 ${response.data.deleted_files || 0} 个文件,${response.data.deleted_records || 0} 条记录`); + // 重置成功后,主动热更新最近转存文件与任务元数据,避免等待 SSE 或轮询 + (async () => { + try { + const latestRes = await axios.get('/task_latest_info'); + if (latestRes.data && latestRes.data.success) { + const latestFiles = latestRes.data.data.latest_files || {}; + this.taskLatestFiles = latestFiles; + this.taskLatestRecords = latestRes.data.data.latest_records || {}; + } + } catch (e) {} + // 重新加载任务元数据(海报与详细信息) + try { await this.loadTasklistMetadata(); } catch (e) {} + })(); // 如果当前是历史记录页面,刷新记录 if (this.activeTab === 'history') { this.loadHistoryRecords();