|
@@ -6,7 +6,7 @@ import { USER_MENUS } from '@/config/setting';
|
|
|
import { getResourcesTree } from '@/api/layout';
|
|
import { getResourcesTree } from '@/api/layout';
|
|
|
import { SYSTEM_NAME } from '@/config/setting';
|
|
import { SYSTEM_NAME } from '@/config/setting';
|
|
|
import Vue from 'vue';
|
|
import Vue from 'vue';
|
|
|
-import { getCurrentUser,setCurrentUser } from '@/utils/token-util';
|
|
|
|
|
|
|
+import { getCurrentUser, setCurrentUser } from '@/utils/token-util';
|
|
|
|
|
|
|
|
const formatRouter = (list) => {
|
|
const formatRouter = (list) => {
|
|
|
let menuList = []; // menuType
|
|
let menuList = []; // menuType
|
|
@@ -17,7 +17,7 @@ const formatRouter = (list) => {
|
|
|
for (const p of list) {
|
|
for (const p of list) {
|
|
|
if (p.menuType === 2) {
|
|
if (p.menuType === 2) {
|
|
|
// p.children = [];
|
|
// p.children = [];
|
|
|
- // authorities.push(p);
|
|
|
|
|
|
|
+ authorities.push(p);
|
|
|
p.hide = true;
|
|
p.hide = true;
|
|
|
}
|
|
}
|
|
|
//报表菜单 source = 2 为报表时 extend 为报表id
|
|
//报表菜单 source = 2 为报表时 extend 为报表id
|
|
@@ -67,7 +67,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 设置登录用户的权限
|
|
// 设置登录用户的权限
|
|
|
setAuthorities(state, authorities) {
|
|
setAuthorities(state, authorities) {
|
|
|
- state.authorities = authorities;
|
|
|
|
|
|
|
+ state.authorities = authorities.map((item) => item.permissionCode);
|
|
|
},
|
|
},
|
|
|
// 设置登录用户的权限路由
|
|
// 设置登录用户的权限路由
|
|
|
setAuthoritiesRouter(state, authoritiesRouter) {
|
|
setAuthoritiesRouter(state, authoritiesRouter) {
|
|
@@ -111,15 +111,19 @@ export default {
|
|
|
// console.log('menus',menus, 'homePath',homePath)
|
|
// console.log('menus',menus, 'homePath',homePath)
|
|
|
// return { menus, homePath };
|
|
// return { menus, homePath };
|
|
|
// },
|
|
// },
|
|
|
- async fetchUserInfo({ commit}) {
|
|
|
|
|
- let currentUser = getCurrentUser()
|
|
|
|
|
- const result = await getResourcesTree({groupId:currentUser.currentGroupId,roleId:currentUser.currentRoleId}).catch(() => {});
|
|
|
|
|
|
|
+ async fetchUserInfo({ commit }) {
|
|
|
|
|
+ let currentUser = getCurrentUser();
|
|
|
|
|
+ const result = await getResourcesTree({
|
|
|
|
|
+ groupId: currentUser.currentGroupId,
|
|
|
|
|
+ roleId: currentUser.currentRoleId
|
|
|
|
|
+ }).catch(() => {});
|
|
|
const list = result?.filter((i) => i.path === '/page-wt');
|
|
const list = result?.filter((i) => i.path === '/page-wt');
|
|
|
if (!list?.length) {
|
|
if (!list?.length) {
|
|
|
return {};
|
|
return {};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const { menuList, authorities } = formatRouter(list[0].children);
|
|
const { menuList, authorities } = formatRouter(list[0].children);
|
|
|
|
|
+ console.log(list[0].children,'authorities')
|
|
|
|
|
|
|
|
// 用户权限
|
|
// 用户权限
|
|
|
// const authorities =
|
|
// const authorities =
|