From 7c83edba1dca1028ebd415036b9eb86f8f8d85fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Thu, 11 Jun 2026 09:59:56 +0800 Subject: [PATCH] fix: use ai admin dashboard home --- .../components/WidgetRenderer.vue | 4 - .../page-render/ai-agent-home-config.ts | 246 ++++++++++++++++++ .../views/online-dev/page-render/index.vue | 12 + 3 files changed, 258 insertions(+), 4 deletions(-) create mode 100644 web/apps/web-ele/src/views/online-dev/page-render/ai-agent-home-config.ts diff --git a/web/apps/web-ele/src/components/dashboard-design/components/WidgetRenderer.vue b/web/apps/web-ele/src/components/dashboard-design/components/WidgetRenderer.vue index 6c51d68..94b0cf2 100644 --- a/web/apps/web-ele/src/components/dashboard-design/components/WidgetRenderer.vue +++ b/web/apps/web-ele/src/components/dashboard-design/components/WidgetRenderer.vue @@ -38,10 +38,6 @@ const widgetComponents: Record< 'announcement-list': defineAsyncComponent( () => import('./widgets/AnnouncementList.vue'), ), - 'approval-center': defineAsyncComponent( - () => import('./widgets/ApprovalCenter.vue'), - ), - 'my-apps': defineAsyncComponent(() => import('./widgets/MyApps.vue')), 'notice-list': defineAsyncComponent(() => import('./widgets/NoticeList.vue')), 'quick-links': defineAsyncComponent(() => import('./widgets/QuickLinks.vue')), 'server-monitor': defineAsyncComponent( diff --git a/web/apps/web-ele/src/views/online-dev/page-render/ai-agent-home-config.ts b/web/apps/web-ele/src/views/online-dev/page-render/ai-agent-home-config.ts new file mode 100644 index 0000000..edc283c --- /dev/null +++ b/web/apps/web-ele/src/views/online-dev/page-render/ai-agent-home-config.ts @@ -0,0 +1,246 @@ +import type { DashboardConfig } from '#/components/dashboard-design'; + +const AI_AGENT_HOME_CODE = 'main_home'; + +const widgetStyle = { + backgroundColor: '', + borderColor: '', + borderRadius: 8, + borderStyle: 'solid', + borderWidth: 0, + padding: 16, + shadowBlur: 4, + shadowColor: 'rgba(0, 0, 0, 0.1)', + shadowEnabled: true, + shadowOffsetX: 0, + shadowOffsetY: 1, + titleAlign: 'left', + titleColor: '', + titleFontSize: 14, + titleFontWeight: 'normal', + titleShow: true, +} as const; + +const aiAgentAdminHomeConfig: DashboardConfig = { + id: 'ai-agent-admin-main-home', + name: '控制中心', + columns: 12, + rowHeight: 68, + margin: [12, 12], + backgroundColor: '', + widgets: [ + { + id: 'welcome', + i: 'welcome', + x: 0, + y: 0, + w: 9, + h: 2, + minW: 4, + minH: 2, + type: 'welcome-card', + title: '欢迎回来', + props: { + title: '欢迎回来', + subtitle: '聚焦智能体协作、流程编排、知识库和基础权限治理', + showTime: true, + showWeather: false, + }, + style: widgetStyle, + }, + { + id: 'weather', + i: 'weather', + x: 9, + y: 0, + w: 3, + h: 2, + minW: 2, + minH: 2, + type: 'weather', + title: '今日天气', + props: { + title: '今日天气', + cityName: '北京', + latitude: 39.9042, + longitude: 116.4074, + autoLocate: false, + refreshInterval: 30, + }, + style: widgetStyle, + }, + { + id: 'ai-collaboration', + i: 'ai-collaboration', + x: 0, + y: 2, + w: 7, + h: 3, + minW: 6, + minH: 2, + type: 'quick-links', + title: 'AI 协作', + props: { + title: 'AI 协作', + columns: 4, + rows: 2, + menus: [ + { + id: 'ai-agent', + title: '智能体', + icon: 'lucide:square-user', + path: '/ai-platform/agent', + }, + { + id: 'ai-workflow', + title: '流程编排', + icon: 'lucide:workflow', + path: '/ai-platform/workflow', + }, + { + id: 'ai-workflow-runs', + title: '执行历史', + icon: 'lucide:history', + path: '/ai-platform/workflow-runs', + }, + { + id: 'ai-knowledge', + title: '知识库', + icon: 'lucide:library-big', + path: '/ai-platform/knowledge-base', + }, + { + id: 'ai-model', + title: '模型配置', + icon: 'lucide:settings', + path: '/ai-platform/model', + }, + { + id: 'codex-agent', + title: 'Codex 助手', + icon: 'lucide:code-2', + path: '/agent-chat/codex', + }, + ], + }, + style: widgetStyle, + }, + { + id: 'base-admin', + i: 'base-admin', + x: 7, + y: 2, + w: 5, + h: 3, + minW: 4, + minH: 2, + type: 'quick-links', + title: '基础管理', + props: { + title: '基础管理', + columns: 3, + rows: 2, + menus: [ + { + id: 'system-user', + title: '用户管理', + icon: 'lucide:users', + path: '/system/user', + }, + { + id: 'system-role', + title: '角色管理', + icon: 'lucide:shield-check', + path: '/system/role', + }, + { + id: 'system-permission', + title: '权限管理', + icon: 'lucide:key-round', + path: '/system/new-permission', + }, + { + id: 'system-menu', + title: '菜单管理', + icon: 'lucide:menu', + path: '/system/menu', + }, + { + id: 'announcement', + title: '公告管理', + icon: 'lucide:megaphone', + path: '/message/announcement', + }, + { + id: 'message', + title: '消息中心', + icon: 'lucide:bell', + path: '/message/list', + }, + ], + }, + style: widgetStyle, + }, + { + id: 'announcement-list', + i: 'announcement-list', + x: 0, + y: 5, + w: 4, + h: 4, + minW: 3, + minH: 3, + type: 'announcement-list', + title: '最新公告', + props: { + title: '最新公告', + limit: 6, + }, + style: widgetStyle, + }, + { + id: 'notice-list', + i: 'notice-list', + x: 4, + y: 5, + w: 4, + h: 4, + minW: 3, + minH: 3, + type: 'notice-list', + title: '消息通知', + props: { + title: '消息通知', + limit: 6, + }, + style: widgetStyle, + }, + { + id: 'server-monitor', + i: 'server-monitor', + x: 8, + y: 5, + w: 4, + h: 4, + minW: 4, + minH: 3, + type: 'server-monitor', + title: '运行监控', + props: { + title: '运行监控', + refreshInterval: 5000, + }, + style: widgetStyle, + }, + ], +}; + +function isAiAgentAdminHomeCode(code: string) { + return code === AI_AGENT_HOME_CODE; +} + +function createAiAgentAdminHomeConfig() { + return JSON.parse(JSON.stringify(aiAgentAdminHomeConfig)) as DashboardConfig; +} + +export { createAiAgentAdminHomeConfig, isAiAgentAdminHomeCode }; diff --git a/web/apps/web-ele/src/views/online-dev/page-render/index.vue b/web/apps/web-ele/src/views/online-dev/page-render/index.vue index 4788b38..07cea5b 100644 --- a/web/apps/web-ele/src/views/online-dev/page-render/index.vue +++ b/web/apps/web-ele/src/views/online-dev/page-render/index.vue @@ -7,6 +7,11 @@ import { ElEmpty, ElMessage, ElScrollbar } from 'element-plus'; import { getPageByCodeApi } from '#/api/online-dev/page-manager'; import DashboardRenderer from '#/components/dashboard-design/DashboardRenderer.vue'; +import { + createAiAgentAdminHomeConfig, + isAiAgentAdminHomeCode, +} from './ai-agent-home-config'; + defineOptions({ name: 'PageRender' }); const route = useRoute(); @@ -44,6 +49,13 @@ async function loadPageData() { loading.value = true; try { + if (isAiAgentAdminHomeCode(code)) { + const config = createAiAgentAdminHomeConfig(); + pageName.value = config.name; + pageConfig.value = JSON.stringify(config); + return; + } + const page = await getPageByCodeApi(code); pageName.value = page.name; pageConfig.value =