diff --git a/data/tsp_assistant.db b/data/tsp_assistant.db index 5bd3663..5d476b1 100644 Binary files a/data/tsp_assistant.db and b/data/tsp_assistant.db differ diff --git a/models/ml_analysis/processor.pkl b/models/ml_analysis/processor.pkl deleted file mode 100644 index ff7985a..0000000 Binary files a/models/ml_analysis/processor.pkl and /dev/null differ diff --git a/models/ml_analysis/trained_model.pkl b/models/ml_analysis/trained_model.pkl deleted file mode 100644 index 36ba3a2..0000000 Binary files a/models/ml_analysis/trained_model.pkl and /dev/null differ diff --git a/src/web/static/js/modules/alerts.js b/src/web/static/js/modules/alerts.js index 760ed7c..cdbff9f 100644 --- a/src/web/static/js/modules/alerts.js +++ b/src/web/static/js/modules/alerts.js @@ -196,17 +196,13 @@ Object.assign(TSPDashboard.prototype, { if (data.success) { this.showNotification(data.message, 'success'); - // 清除所有相关缓存 - this.cache.delete('alerts'); - this.cache.delete('alerts_stats'); + // 清除所有预警相关缓存 + for (const key of this.cache.keys()) { + if (key.startsWith('alerts')) this.cache.delete(key); + } - // 立即更新统计数字,避免跳动 - await this.updateStatsAfterDelete(selectedIds.length); - - // 重新加载预警列表 - await this.loadAlerts(); - - // 重置批量删除按钮状态 + // 强制刷新预警列表和统计 + await this.loadAlerts(1, true); this.updateBatchDeleteAlertsButton(); } else { this.showNotification(data.error || '批量删除失败', 'error'); @@ -327,16 +323,10 @@ Object.assign(TSPDashboard.prototype, { if (data.success) { this.showNotification('预警已解决', 'success'); - - // 清除缓存 - this.cache.delete('alerts'); - this.cache.delete('alerts_stats'); - - // 立即更新统计数字 - await this.updateStatsAfterResolve(alertId); - - // 重新加载预警列表 - this.loadAlerts(); + for (const key of this.cache.keys()) { + if (key.startsWith('alerts')) this.cache.delete(key); + } + await this.loadAlerts(1, true); } else { this.showNotification('解决预警失败', 'error'); } diff --git a/src/web/static/js/modules/knowledge.js b/src/web/static/js/modules/knowledge.js index 21ddd45..363533c 100644 --- a/src/web/static/js/modules/knowledge.js +++ b/src/web/static/js/modules/knowledge.js @@ -632,7 +632,7 @@ Object.assign(TSPDashboard.prototype, { this.showNotification(data.message, 'success'); // 清除缓存并强制刷新 - this.cache.delete('knowledge'); + for (const key of this.cache.keys()) { if (key.startsWith('knowledge')) this.cache.delete(key); } // Task 7.3: 删除后检查是否所有条目已删除,若是则返回租户列表 if (this.knowledgeCurrentTenantId) { diff --git a/src/web/static/js/modules/workorders.js b/src/web/static/js/modules/workorders.js index 0b813e8..0bf26b2 100644 --- a/src/web/static/js/modules/workorders.js +++ b/src/web/static/js/modules/workorders.js @@ -211,8 +211,10 @@ Object.assign(TSPDashboard.prototype, { const data = await response.json(); if (data.success) { this.showNotification(data.message, 'success'); - this.cache.delete('workorders'); - await this.loadWorkOrders(true); + for (const key of this.cache.keys()) { + if (key.startsWith('workorders')) this.cache.delete(key); + } + await this.loadWorkOrders(1, true); await this.loadAnalytics(); this.updateBatchDeleteButton(); } else { this.showNotification(data.error || '批量删除失败', 'error'); } @@ -233,7 +235,8 @@ Object.assign(TSPDashboard.prototype, { this.showNotification('工单创建成功', 'success'); bootstrap.Modal.getInstance(document.getElementById('createWorkOrderModal')).hide(); document.getElementById('work-order-form').reset(); - await this.loadWorkOrders(); + for (const key of this.cache.keys()) { if (key.startsWith('workorders')) this.cache.delete(key); } + await this.loadWorkOrders(1, true); await this.loadAnalytics(); } else { this.showNotification('创建工单失败: ' + (data.error || '未知错误'), 'error'); } } catch (error) { console.error('创建工单失败:', error); this.showNotification('创建工单失败', 'error'); } @@ -340,6 +343,7 @@ Object.assign(TSPDashboard.prototype, { const data = await response.json(); if (data.success) { this.showNotification('工单删除成功', 'success'); + for (const key of this.cache.keys()) { if (key.startsWith('workorders')) this.cache.delete(key); } await this.loadWorkOrders(this.paginationConfig.currentWorkOrderPage, true); await this.loadAnalytics(); } else { this.showNotification('删除工单失败: ' + (data.error || '未知错误'), 'error'); } @@ -403,7 +407,8 @@ Object.assign(TSPDashboard.prototype, { if (result.success) { this.showNotification('工单更新成功', 'success'); bootstrap.Modal.getInstance(document.getElementById('editWorkOrderModal')).hide(); - await this.loadWorkOrders(); + for (const key of this.cache.keys()) { if (key.startsWith('workorders')) this.cache.delete(key); } + await this.loadWorkOrders(1, true); await this.loadAnalytics(); } else { throw new Error(result.error || '更新工单失败'); } } catch (error) { console.error('更新工单失败:', error); this.showNotification('更新工单失败: ' + error.message, 'error'); } @@ -447,7 +452,8 @@ Object.assign(TSPDashboard.prototype, { document.getElementById('import-result').classList.remove('d-none'); document.getElementById('import-success-message').textContent = `成功导入 ${result.imported_count} 个工单`; this.showNotification(result.message, 'success'); - this.loadWorkOrders(); + for (const key of this.cache.keys()) { if (key.startsWith('workorders')) this.cache.delete(key); } + this.loadWorkOrders(1, true); setTimeout(() => { bootstrap.Modal.getInstance(document.getElementById('importWorkOrderModal')).hide(); }, 3000); } else { throw new Error(result.error || '导入工单失败'); } } catch (error) {