Replace home quick links with AI entries

This commit is contained in:
2026-06-10 20:10:54 +08:00
parent 16e84c6991
commit e3352bf04c
3 changed files with 131 additions and 10 deletions
+70 -7
View File
@@ -7883,6 +7883,51 @@
"sys_dept_id": null
}
},
{
"model": "core.menu.model.Menu",
"pk": "aiadm-codex",
"fields": {
"application_id": null,
"is_system": true,
"parent_id": "4CW_HY32ozaVOQpSz7njE",
"name": "Codex",
"title": "menu-title.codex",
"authCode": null,
"path": "/agent-chat/codex",
"type": "menu",
"component": "/_core/agent-chat/index",
"redirect": null,
"activePath": null,
"query": null,
"noBasicLayout": false,
"icon": "lucide:code",
"activeIcon": null,
"order": 50,
"hideInMenu": false,
"hideChildrenInMenu": false,
"hideInBreadcrumb": false,
"hideInTab": false,
"affixTab": false,
"affixTabOrder": null,
"keepAlive": false,
"maxNumOfOpenTab": null,
"fullPathKey": true,
"link": null,
"iframeSrc": null,
"openInNewWindow": false,
"badge": null,
"badgeType": null,
"badgeVariants": null,
"id": "aiadm-codex",
"sort": 50,
"is_deleted": false,
"sys_create_datetime": "2026-06-01T12:00:00.000000",
"sys_update_datetime": "2026-06-01T12:00:00.000000",
"sys_creator_id": null,
"sys_modifier_id": null,
"sys_dept_id": null
}
},
{
"model": "core.menu.model.Menu",
"pk": "iGGhzrgeACiioTy0PF-CU",
@@ -14125,15 +14170,33 @@
"rows": 2,
"menus": [
{
"id": "mWJtvLYnAMa_3fR_jjtBc",
"title": "应用管理",
"icon": "lucide:app-window",
"path": "/application",
"id": "ai-agent",
"title": "智能体",
"icon": "lucide:square-user",
"path": "/ai-platform/agent",
"bgColor": ""
},
{
"id": "ai-workflow",
"title": "流程编排",
"icon": "lucide:workflow",
"path": "/ai-platform/workflow",
"bgColor": ""
},
{
"id": "ai-knowledge",
"title": "知识库",
"icon": "lucide:library-big",
"path": "/ai-platform/knowledge-base",
"bgColor": ""
},
{
"id": "codex",
"title": "Codex",
"icon": "lucide:code",
"path": "/agent-chat/codex",
"bgColor": ""
},
null,
null,
null,
null,
null,
null,
@@ -54,6 +54,7 @@
"workflowRunHistory": "执行历史",
"aiAgent": "智能体",
"knowledgeBase": "知识库",
"codex": "Codex",
"controlCenter": "控制中心",
"applicationManagement": "应用管理",
"startChat": "开始聊天",
@@ -15,6 +15,62 @@ const pageConfig = ref<string>('');
const pageName = ref('');
const pageCode = ref('');
const MAIN_HOME_AI_LINKS = [
{
bgColor: '',
icon: 'lucide:square-user',
id: 'ai-agent',
path: '/ai-platform/agent',
title: '智能体',
},
{
bgColor: '',
icon: 'lucide:workflow',
id: 'ai-workflow',
path: '/ai-platform/workflow',
title: '流程编排',
},
{
bgColor: '',
icon: 'lucide:library-big',
id: 'ai-knowledge',
path: '/ai-platform/knowledge-base',
title: '知识库',
},
{
bgColor: '',
icon: 'lucide:code',
id: 'codex',
path: '/agent-chat/codex',
title: 'Codex',
},
null,
null,
null,
null,
];
function normalizeMainHomeConfig(config: Record<string, any>) {
if (pageCode.value !== 'main_home' || !Array.isArray(config.widgets)) {
return config;
}
return {
...config,
widgets: config.widgets.map((widget: Record<string, any>) => {
if (widget.type !== 'quick-links') return widget;
return {
...widget,
props: {
...widget.props,
menus: MAIN_HOME_AI_LINKS,
},
};
}),
};
}
// 获取页面编码
function getPageCode(): string {
// 优先从 query 获取
@@ -51,10 +107,11 @@ async function loadPageData() {
try {
const page = await getPageByCodeApi(code);
pageName.value = page.name;
pageConfig.value =
const config =
page.page_config && Object.keys(page.page_config).length > 0
? JSON.stringify(page.page_config)
: '';
? normalizeMainHomeConfig(page.page_config)
: null;
pageConfig.value = config ? JSON.stringify(config) : '';
} catch (error: any) {
ElMessage.error(error?.message || '加载页面失败');
} finally {