From 23a2fff92f73b9759849a8016601a6817d7470b1 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期一, 25 八月 2025 17:30:30 +0800
Subject: [PATCH] -

---
 src/router/utils.ts |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/router/utils.ts b/src/router/utils.ts
index 28e32b8..8052c47 100644
--- a/src/router/utils.ts
+++ b/src/router/utils.ts
@@ -21,11 +21,15 @@
 import { userKey, type DataInfo } from "@/utils/auth";
 import { type menuType, routerArrays } from "@/layout/types";
 import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
+import { useUserStoreHook } from "@/store/modules/user";
 import { usePermissionStoreHook } from "@/store/modules/permission";
 const IFrame = () => import("@/layout/frame.vue");
 // https://cn.vitejs.dev/guide/features.html#glob-import
 const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
+const quanxianList = ["/item"];
+const managerList = ["/user"];
 
+const userInfo = storageLocal().getItem<DataInfo<number>>(userKey);
 // 鍔ㄦ�佽矾鐢�
 import { getAsyncRoutes } from "@/api/routes";
 
@@ -54,9 +58,17 @@
 
 /** 杩囨护meta涓璼howLink涓篺alse鐨勮彍鍗� */
 function filterTree(data: RouteComponent[]) {
+  const hasFlsh = useUserStoreHook().nowRole.hasFlsh;
+  const isManager = useUserStoreHook().isManager;
   const newTree = cloneDeep(data).filter(
-    (v: { meta: { showLink: boolean } }) => v.meta?.showLink !== false
+    (v: { path: string; meta: { showLink: boolean } }) => {
+      quanxianList.includes(v.path) ? (v.meta.showLink = hasFlsh) : null;
+      managerList.includes(v.path) ? (v.meta.showLink = isManager) : null;
+      return v.meta?.showLink !== false;
+    }
   );
+  console.log(newTree);
+
   newTree.forEach(
     (v: { children }) => v.children && (v.children = filterTree(v.children))
   );
@@ -387,7 +399,7 @@
     usePermissionStoreHook().wholeMenus[0]?.children[0]
   );
   tag && useMultiTagsStoreHook().handleTags("push", topMenu);
-  console.log(topMenu, "topMenu");
+  // console.log(topMenu, "topMenu");
 
   return topMenu;
 }

--
Gitblit v1.9.1