From 09215bad572358672c04f9e1258c878e6b48006c Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Thu, 12 Feb 2026 22:47:17 +0800 Subject: [PATCH] fix: add config tabs and routing for normal and system configurations --- .../i18n/locales/en-US/core/navigation.json | 4 ++ .../i18n/locales/zh-CN/core/navigation.json | 4 ++ .../full/vertical-sidebar/sidebarItem.ts | 14 ++++- dashboard/src/router/MainRoutes.ts | 8 +++ dashboard/src/views/ConfigPage.vue | 60 ++++++++++--------- 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/dashboard/src/i18n/locales/en-US/core/navigation.json b/dashboard/src/i18n/locales/en-US/core/navigation.json index 3c70afd80..9526729db 100644 --- a/dashboard/src/i18n/locales/en-US/core/navigation.json +++ b/dashboard/src/i18n/locales/en-US/core/navigation.json @@ -40,5 +40,9 @@ "notFound": "Changelog for this version not found", "selectVersion": "Select Version", "current": "Current" + }, + "configTabs": { + "normal": "Normal Config", + "system": "System Config" } } diff --git a/dashboard/src/i18n/locales/zh-CN/core/navigation.json b/dashboard/src/i18n/locales/zh-CN/core/navigation.json index 9481cc259..4713265de 100644 --- a/dashboard/src/i18n/locales/zh-CN/core/navigation.json +++ b/dashboard/src/i18n/locales/zh-CN/core/navigation.json @@ -40,5 +40,9 @@ "notFound": "未找到该版本的更新日志", "selectVersion": "选择版本", "current": "当前" + }, + "configTabs": { + "normal": "普通配置", + "system": "系统配置" } } diff --git a/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts b/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts index 69a3791fa..1f358aa0f 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts +++ b/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts @@ -36,7 +36,19 @@ const sidebarItem: menu[] = [ { title: 'core.navigation.config', icon: 'mdi-cog', - to: '/config', + to: '/config#normal', + children: [ + { + title: 'core.navigation.configTabs.normal', + icon: 'mdi-cog', + to: '/config#normal' + }, + { + title: 'core.navigation.configTabs.system', + icon: 'mdi-cog-outline', + to: '/config#system' + } + ] }, { title: 'core.navigation.extension', diff --git a/dashboard/src/router/MainRoutes.ts b/dashboard/src/router/MainRoutes.ts index ce0706498..024f591cc 100644 --- a/dashboard/src/router/MainRoutes.ts +++ b/dashboard/src/router/MainRoutes.ts @@ -41,6 +41,14 @@ const MainRoutes = { path: '/config', component: () => import('@/views/ConfigPage.vue') }, + { + path: '/normal', + redirect: '/config#normal' + }, + { + path: '/system', + redirect: '/config#system' + }, { name: 'Default', path: '/dashboard/default', diff --git a/dashboard/src/views/ConfigPage.vue b/dashboard/src/views/ConfigPage.vue index dd4bbd715..617c6716c 100644 --- a/dashboard/src/views/ConfigPage.vue +++ b/dashboard/src/views/ConfigPage.vue @@ -4,29 +4,17 @@
-
+ style="margin-bottom: 16px; align-items: center; gap: 12px; width: 100%; justify-content: space-between;">
- +
- - - - {{ tm('configSelection.normalConfig') }} - - - {{ tm('configSelection.systemConfig') }} - -
- @@ -252,6 +240,9 @@ export default { config_data_str(val) { this.config_data_has_changed = true; }, + '$route.fullPath'(newVal) { + this.syncConfigTypeFromHash(newVal); + }, initialConfigId(newVal) { if (!newVal) { return; @@ -299,6 +290,12 @@ export default { } }, mounted() { + const hashConfigType = this.extractConfigTypeFromHash( + this.$route?.fullPath || '' + ); + this.configType = hashConfigType || 'normal'; + this.isSystemConfig = this.configType === 'system'; + const targetConfigId = this.initialConfigId || 'default'; this.getConfigInfoList(targetConfigId); // 初始化配置类型状态 @@ -323,6 +320,27 @@ export default { } }, + }, + methods: { + extractConfigTypeFromHash(hash) { + const rawHash = String(hash || ''); + const lastHashIndex = rawHash.lastIndexOf('#'); + if (lastHashIndex === -1) { + return null; + } + const cleanHash = rawHash.slice(lastHashIndex + 1); + return cleanHash === 'system' || cleanHash === 'normal' ? cleanHash : null; + }, + syncConfigTypeFromHash(hash) { + const configType = this.extractConfigTypeFromHash(hash); + if (!configType || configType === this.configType) { + return false; + } + + this.configType = configType; + this.onConfigTypeToggle(); + return true; + }, getConfigInfoList(abconf_id) { // 获取配置列表 axios.get('/api/config/abconfs').then((res) => { @@ -568,19 +586,7 @@ export default { // 保持向后兼容性,更新 configType this.configType = this.isSystemConfig ? 'system' : 'normal'; - this.fetched = false; // 重置加载状态 - - if (this.isSystemConfig) { - // 切换到系统配置 - this.getConfig(); - } else { - // 切换回普通配置,如果有选中的配置文件则加载,否则加载default - if (this.selectedConfigID) { - this.getConfig(this.selectedConfigID); - } else { - this.getConfigInfoList("default"); - } - } + this.onConfigTypeToggle(); }, openTestChat() { if (!this.selectedConfigID) {