refactor: dashboard.js 模块化拆分 从7766行拆为13个独立模块
核心 dashboard.js 缩减至266行,只保留:
- TSPDashboard class 定义(constructor、init、bindEvents、switchTab)
- 分页组件、缓存、状态管理、自动刷新、WebSocket、i18n
功能模块拆分到 modules/ 目录:
- chat.js (207行) 智能对话
- agent.js (424行) Agent管理
- alerts.js (348行) 预警管理
- knowledge.js (699行) 知识库管理
- workorders.js (约500行) 工单管理
- conversations.js (671行) 对话历史
- monitoring.js (455行) Token/AI监控
- system.js (1388行) 系统优化+设置+数据分析图表
- tenants.js (165行) 租户管理
- utils.js (573行) 工具函数
- dashboard-home.js (286行) 仪表板首页
- feishu-sync.js (698行) 飞书同步管理器
拆分方式:Object.assign(TSPDashboard.prototype, {...})
this 引用完全不会断,所有模块方法互相调用正常
This commit is contained in:
@@ -2629,6 +2629,19 @@
|
||||
<script src="{{ url_for('static', filename='js/app-new.js') }}"></script>
|
||||
|
||||
<!-- 原有dashboard.js保持兼容 -->
|
||||
<script src="{{ url_for('static', filename='js/dashboard.js') }}?v=1.0.9"></script>
|
||||
<script src="{{ url_for('static', filename='js/dashboard.js') }}?v=2.0.0"></script>
|
||||
<!-- 功能模块 -->
|
||||
<script src="{{ url_for('static', filename='js/modules/utils.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/dashboard-home.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/chat.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/agent.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/alerts.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/knowledge.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/workorders.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/conversations.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/monitoring.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/system.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/tenants.js') }}?v=2.0.0"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/feishu-sync.js') }}?v=2.0.0"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user