From dade6a8b4772abc113383246d05ab59162630e7c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 27 八月 2025 17:21:21 +0800
Subject: [PATCH] '上传变更公告获取详情与删除'

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

diff --git a/src/router/utils.ts b/src/router/utils.ts
index 9137806..8052c47 100644
--- a/src/router/utils.ts
+++ b/src/router/utils.ts
@@ -26,7 +26,10 @@
 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";
 
@@ -55,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))
   );
@@ -85,7 +96,7 @@
 /** 浠巐ocalStorage閲屽彇鍑哄綋鍓嶇櫥褰曠敤鎴风殑瑙掕壊roles锛岃繃婊ゆ棤鏉冮檺鐨勮彍鍗� */
 function filterNoPermissionTree(data: RouteComponent[]) {
   const currentRoles =
-    storageLocal().getItem<DataInfo<number>>(userKey)?.exRoles ?? [];
+    storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [];
   const newTree = cloneDeep(data).filter((v: any) =>
     isOneOfArray(v.meta?.roles, currentRoles)
   );

--
Gitblit v1.9.1