feat: 自动提交 - 周一 2025/09/22 14:48:02.54
This commit is contained in:
@@ -21,6 +21,14 @@ const translations = {
|
||||
'sidebar-feishu-sync': '飞书同步',
|
||||
'sidebar-system': '系统设置',
|
||||
|
||||
// 预警管理页面
|
||||
'alerts-critical': '严重预警',
|
||||
'alerts-warning': '警告预警',
|
||||
'alerts-info': '信息预警',
|
||||
'alerts-total': '总预警数',
|
||||
'alerts-active': '活跃预警',
|
||||
'alerts-resolve': '解决',
|
||||
|
||||
// 设置页面
|
||||
'settings-title': '系统设置',
|
||||
'settings-basic': '基础设置',
|
||||
@@ -54,6 +62,14 @@ const translations = {
|
||||
'sidebar-feishu-sync': 'Feishu Sync',
|
||||
'sidebar-system': 'System Settings',
|
||||
|
||||
// Alert Management page
|
||||
'alerts-critical': 'Critical Alerts',
|
||||
'alerts-warning': 'Warning Alerts',
|
||||
'alerts-info': 'Info Alerts',
|
||||
'alerts-total': 'Total Alerts',
|
||||
'alerts-active': 'Active Alerts',
|
||||
'alerts-resolve': 'Resolve',
|
||||
|
||||
// Settings page
|
||||
'settings-title': 'System Settings',
|
||||
'settings-basic': 'Basic Settings',
|
||||
@@ -88,48 +104,35 @@ function updatePageLanguage(lang) {
|
||||
const t = translations[lang];
|
||||
if (!t) return;
|
||||
|
||||
// 更新导航栏
|
||||
document.querySelector('.navbar-brand').innerHTML = `<i class="fas fa-robot me-2"></i>${t['nav-title']}`;
|
||||
|
||||
// 更新侧边栏
|
||||
const sidebarItems = [
|
||||
{ selector: '[data-i18n="sidebar-dashboard"]', key: 'sidebar-dashboard' },
|
||||
{ selector: '[data-i18n="sidebar-conversations"]', key: 'sidebar-conversations' },
|
||||
{ selector: '[data-i18n="sidebar-agent"]', key: 'sidebar-agent' },
|
||||
{ selector: '[data-i18n="sidebar-alerts"]', key: 'sidebar-alerts' },
|
||||
{ selector: '[data-i18n="sidebar-knowledge"]', key: 'sidebar-knowledge' },
|
||||
{ selector: '[data-i18n="sidebar-workorders"]', key: 'sidebar-workorders' },
|
||||
{ selector: '[data-i18n="sidebar-feishu-sync"]', key: 'sidebar-feishu-sync' },
|
||||
{ selector: '[data-i18n="sidebar-system"]', key: 'sidebar-system' }
|
||||
];
|
||||
|
||||
sidebarItems.forEach(item => {
|
||||
const element = document.querySelector(item.selector);
|
||||
if (element) {
|
||||
element.textContent = t[item.key];
|
||||
// 更新所有带有 data-i18n 属性的元素
|
||||
const elements = document.querySelectorAll('[data-i18n]');
|
||||
elements.forEach(element => {
|
||||
const key = element.getAttribute('data-i18n');
|
||||
if (t[key]) {
|
||||
element.textContent = t[key];
|
||||
}
|
||||
});
|
||||
|
||||
// 更新设置页面
|
||||
const settingsElements = [
|
||||
{ selector: '[data-i18n="settings-title"]', key: 'settings-title' },
|
||||
{ selector: '[data-i18n="settings-basic"]', key: 'settings-basic' },
|
||||
{ selector: '[data-i18n="settings-system-info"]', key: 'settings-system-info' },
|
||||
{ selector: '[data-i18n="settings-log-config"]', key: 'settings-log-config' },
|
||||
{ selector: '[data-i18n="settings-current-port"]', key: 'settings-current-port' },
|
||||
{ selector: '[data-i18n="settings-websocket-port"]', key: 'settings-websocket-port' },
|
||||
{ selector: '[data-i18n="settings-log-level"]', key: 'settings-log-level' },
|
||||
{ selector: '[data-i18n="settings-save"]', key: 'settings-save' },
|
||||
{ selector: '[data-i18n="settings-port-note"]', key: 'settings-port-note' },
|
||||
{ selector: '[data-i18n="settings-log-note"]', key: 'settings-log-note' }
|
||||
];
|
||||
|
||||
settingsElements.forEach(item => {
|
||||
const element = document.querySelector(item.selector);
|
||||
if (element) {
|
||||
element.textContent = t[item.key];
|
||||
// 更新导航栏标题(特殊处理,因为包含图标)
|
||||
const navBrand = document.querySelector('.navbar-brand');
|
||||
if (navBrand) {
|
||||
const icon = navBrand.querySelector('i');
|
||||
if (icon) {
|
||||
navBrand.innerHTML = `<i class="fas fa-robot me-2"></i>${t['nav-title']}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 更新当前标签页标题
|
||||
const currentTabTitle = document.getElementById('current-tab-title');
|
||||
if (currentTabTitle) {
|
||||
const currentTab = document.querySelector('.nav-link.active');
|
||||
if (currentTab) {
|
||||
const tabKey = currentTab.getAttribute('data-i18n');
|
||||
if (tabKey && t[tabKey]) {
|
||||
currentTabTitle.textContent = t[tabKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TSPDashboard {
|
||||
|
||||
Reference in New Issue
Block a user