From 64a8cd04229f7b903913fc3dc7ef4aef267ac3bc Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 26 十月 2026 17:36:14 +0800
Subject: [PATCH] Merge branch 'dev_pro2.0' into dev_南通_苏珩
---
src/store/auth.ts | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/store/auth.ts b/src/store/auth.ts
index c2b1dd6..2e28670 100644
--- a/src/store/auth.ts
+++ b/src/store/auth.ts
@@ -6,6 +6,7 @@
import { useRouter } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants';
+import { isAiEnable } from '@vben/hooks';
import { preferences } from '@vben/preferences';
import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
@@ -22,6 +23,22 @@
} from '#/api';
import { $t } from '#/locales';
import { automaticApproval, loadAuditPolicy } from '#/store/audit-policy';
+
+/** AI 鎬诲紑鍏冲叧闂椂锛岃繛鍚� /ai 妯″潡鑿滃崟涓�骞堕殣钘� */
+function filterAiMenus<T extends { children?: T[]; path?: string }>(
+ menus: T[],
+): T[] {
+ return menus
+ .filter((menu) => {
+ const path = menu.path?.replace(/^\//, '');
+ return !(path === 'ai' || path?.startsWith('ai/'));
+ })
+ .map((menu) =>
+ menu.children?.length
+ ? { ...menu, children: filterAiMenus(menu.children) }
+ : menu,
+ );
+}
export const useAuthStore = defineStore('auth', () => {
const accessStore = useAccessStore();
@@ -168,7 +185,9 @@
userStore.setUserInfo(authPermissionInfo.user);
userStore.setUserRoles(authPermissionInfo.roles);
// accessStore
- accessStore.setAccessMenus(authPermissionInfo.menus);
+ accessStore.setAccessMenus(
+ isAiEnable() ? authPermissionInfo.menus : filterAiMenus(authPermissionInfo.menus),
+ );
accessStore.setAccessCodes(authPermissionInfo.permissions);
return authPermissionInfo;
}
--
Gitblit v1.9.3