From c0930736f5b5955efecdac4c0ca85957d4f7b574 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 16 十二月 2019 22:55:17 +0800 Subject: [PATCH] 2019-12-16 --- src/components/header/index.jsx | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 752bfe3..539228e 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -6,7 +6,16 @@ import moment from 'moment' import {Dropdown, Menu, Icon, Modal, Form, notification, Switch } from 'antd' import asyncComponent from '@/utils/asyncComponent' -import {toggleCollapse, modifyMainMenu, resetState, resetDebug, resetEditState, resetEditLevel, logout} from '@/store/action' +import { + toggleCollapse, + modifyMainMenu, + resetState, + resetDebug, + resetEditState, + resetEditLevel, + initPermission, + logout +} from '@/store/action' import Api from '@/api' import zhCN from '@/locales/zh-CN/header.js' import enUS from '@/locales/en-US/header.js' @@ -184,7 +193,24 @@ // 鑾峰彇涓昏彍鍗� let result = await Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}) if (result.status) { + let _permAction = {} + let _permFuncField = [] + if (result.UserRoles && result.UserRoles[0] && result.UserRoles[0].RoleMenu) { + result.UserRoles[0].RoleMenu.forEach(menu => { + _permAction[menu.MenuID] = true + }) + } + if (result.sModular && result.sModular.length > 0) { + result.sModular.forEach(field => { + if (field.ModularNo) { + _permFuncField.push(field.ModularNo) + } + }) + _permFuncField = _permFuncField.sort() + } + + this.props.initPermission(_permAction, _permFuncField) } } @@ -293,7 +319,9 @@ selectmenu: state.selectedMainMenu, debug: state.debug, editState: state.editState, - editLevel: state.editLevel + editLevel: state.editLevel, + permAction: state.permAction, + permFuncField: state.permFuncField } } @@ -303,6 +331,7 @@ modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)), resetEditState: (state) => dispatch(resetEditState(state)), resetEditLevel: (level) => dispatch(resetEditLevel(level)), + initPermission: (permAction, permFuncField) => dispatch(initPermission(permAction, permFuncField)), resetState: () => dispatch(resetState()), resetDebug: () => dispatch(resetDebug()), logout: () => dispatch(logout()) -- Gitblit v1.8.0