Browse Source

前端系统管理菜单 根据角色判断是否显示

wukai 1 year ago
parent
commit
447ba95d3f
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/layout/indexCommon.vue

+ 18 - 0
src/layout/indexCommon.vue

@@ -475,6 +475,24 @@ const menuList = reactive({
     },
   ],
 });
+
+	const roles = useUserStore().roles;
+	const permissionRoles = ['admin','dept','system','audit']
+	const super_admin = "admin";
+    const hasRole = roles.some(role => {
+      return super_admin === role || permissionRoles.includes(role)
+    })
+	if(hasRole){
+		menuList.data.push(
+		{
+			label: "系统管理",
+			path: "/admin",
+			imgs: system,
+			beimgs: issystem,
+		}
+		);
+	}
+	
 const clickPath = (index, items) => {
   items = toRaw(items);
   // toFileData.value = null