feat: add lightweight admin workspace

This commit is contained in:
2026-06-21 17:48:43 +08:00
parent 56c1eec051
commit f9050c95d1
13 changed files with 603 additions and 16 deletions
+4
View File
@@ -179,9 +179,12 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
'../views/_core/fallback/**/*.vue',
'../views/_core/file-preview/index.vue',
'../views/_core/menu/index.vue',
'../views/_core/message/index.vue',
'../views/_core/page-render/index.vue',
'../views/_core/permission/index.vue',
'../views/_core/role/index.vue',
'../views/_core/system-config/index.vue',
'../views/_core/ui-config/index.vue',
'../views/_core/user/index.vue',
'../views/ai-platform/agent/editor/index.vue',
'../views/ai-platform/agent/index.vue',
@@ -191,6 +194,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
'../views/ai-platform/workflow/editor/index.vue',
'../views/ai-platform/workflow/index.vue',
'../views/ai-platform/workflow-runs/index.vue',
'../views/dashboard/workspace/index.vue',
]);
const layoutMap: ComponentRecordType = {
+2 -2
View File
@@ -206,7 +206,7 @@ function setupAccessGuard(router: Router) {
if (to.path === subAppRootPath) {
const defaultHome =
preferences.app.defaultHomePath || '/ai-platform/agent';
preferences.app.defaultHomePath || '/dashboard/workspace';
// 确保路径包含子应用前缀
const subAppTargetPath = defaultHome.startsWith(subAppRootPath)
? defaultHome
@@ -222,7 +222,7 @@ function setupAccessGuard(router: Router) {
const redirectPath = normalizeHomePath(
(from.query.redirect ??
(to.path === preferences.app.defaultHomePath
? userInfo.homePath
? preferences.app.defaultHomePath
: to.fullPath)) as string,
);
+14
View File
@@ -1,4 +1,7 @@
export const LIGHT_MENU_NAMES = new Set([
'ControlCenter',
'Dashboard',
'DashboardWorkspace',
'AIAgent',
'AIKnowledgeDetail',
'AIModelConfig',
@@ -8,15 +11,21 @@ export const LIGHT_MENU_NAMES = new Set([
'AnnouncementList',
'AnnouncementManage',
'CodexAgentChat',
'MessageCenter',
'MessageList',
'KnowledgeBase',
'SystemManagement',
'SystemConfig',
'SystemMenu',
'SystemPermission',
'SystemRole',
'UIConfig',
'UserManagement',
]);
const LIGHT_ROUTE_PATH_PREFIXES = [
'/control-center',
'/dashboard',
'/ai-platform/agent',
'/ai-platform/knowledge',
'/ai-platform/knowledge-base',
@@ -24,10 +33,15 @@ const LIGHT_ROUTE_PATH_PREFIXES = [
'/ai-platform/workflow',
'/ai-platform/workflow-runs',
'/agent-chat',
'/message/list',
'/message/announcement',
'/message/announcement-list',
'/page-render/main_home',
'/system/config',
'/system/menu',
'/system/new-permission',
'/system/role',
'/system/ui-config',
'/system/user',
];
@@ -4,6 +4,7 @@ import { mergeRouteModules, traverseTreeValues } from '@vben/utils';
import { coreRoutes, fallbackNotFoundRoute } from './core';
import aiPlatformRoutes from './modules/ai-platform';
import dashboardRoutes from './modules/dashboard';
// 有需要可以自行打开注释,并创建文件夹
// const externalRouteFiles = import.meta.glob('./external/**/*.ts', { eager: true });
@@ -12,6 +13,7 @@ import aiPlatformRoutes from './modules/ai-platform';
/** 动态路由 */
const dynamicRoutes: RouteRecordRaw[] = mergeRouteModules({
'./modules/ai-platform.ts': { default: aiPlatformRoutes },
'./modules/dashboard.ts': { default: dashboardRoutes },
});
/** 外部路由列表,访问这些页面可以不需要Layout,可能用于内嵌在别的系统(不会显示在菜单中) */
@@ -5,7 +5,7 @@ const routes: RouteRecordRaw[] = [
meta: { hideInMenu: true },
name: 'ControlCenterLegacyRedirect',
path: '/control-center',
redirect: '/ai-platform/agent',
redirect: '/dashboard/workspace',
},
{
meta: {
@@ -14,7 +14,7 @@ const routes: RouteRecordRaw[] = [
},
name: 'PageRenderMainHome',
path: '/page-render/main_home',
redirect: '/ai-platform/agent',
redirect: '/dashboard/workspace',
},
{
meta: { hideInMenu: true },
@@ -0,0 +1,28 @@
import type { RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
meta: {
hideInMenu: true,
icon: 'lucide:layout-dashboard',
order: 0,
title: 'menu-title.controlCenter',
},
name: 'Dashboard',
path: '/dashboard',
redirect: '/dashboard/workspace',
children: [
{
component: () => import('#/views/dashboard/workspace/index.vue'),
meta: {
hideInMenu: true,
title: 'menu-title.workspace',
},
name: 'DashboardWorkspace',
path: '/dashboard/workspace',
},
],
},
];
export default routes;