| | |
| | | } |
| | | |
| | | getRolesMenu () { |
| | | // 获取角色权限 |
| | | let roledefer = new Promise(resolve => { |
| | | // edition_type 接口版本控制 ''、'Y'、'A' |
| | | setTimeout(() => { |
| | | Api.getSystemConfig({ |
| | | func: 's_Get_TrdMenu_Role', |
| | | edition_type: 'A', |
| | | pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | }).then(result => { |
| | | let _permAction = {loaded: true} // 按钮权限 |
| | | |
| | | if (result && result.status) { |
| | | if (result.UserRoles_Menu) { |
| | | result.UserRoles_Menu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | } |
| | | } else if (result) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | this.props.initActionPermission(_permAction) |
| | | resolve() |
| | | }) |
| | | }, 50) |
| | | }) |
| | | |
| | | // 获取主菜单参数 |
| | | let menudefer = new Promise(resolve => { |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType} |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | |
| | |
| | | let mainMenu = menulist[0] || '' |
| | | let _menu = null |
| | | |
| | | if (mainMenu === '') { // 是否显示侧边栏控制 |
| | | let _url = window.location.href.split('#')[0] |
| | | localStorage.setItem(_url + '-sideHidden', 'true') |
| | | } else { |
| | | let _url = window.location.href.split('#')[0] |
| | | localStorage.removeItem(_url + '-sideHidden') |
| | | } |
| | | |
| | | if (sessionStorage.getItem('ThirdMenu')) { // 是否为打开新页面 |
| | | let ThirdMenuId = sessionStorage.getItem('ThirdMenu') |
| | | _menu = thdMenuList.filter(item => item.MenuID === ThirdMenuId)[0] // 通过url中menuid筛选出选中的主菜单 |
| | |
| | | this.props.modifyMainMenu(mainMenu) |
| | | this.props.initMenuPermission([...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]) |
| | | |
| | | resolve(_menu) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([roledefer, menudefer]).then(response => { |
| | | if (response[1]) { |
| | | let menu = fromJS(response[1]).toJS() |
| | | |
| | | if (_menu) { // 延时打开,防止标签组未完成加载 |
| | | setTimeout(() => { |
| | | if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { |
| | | MKEmitter.emit('modifyTabs', menu, 'replace') |
| | | MKEmitter.emit('modifyTabs', _menu, 'replace') |
| | | } else { |
| | | MKEmitter.emit('modifyTabs', menu, 'plus') |
| | | MKEmitter.emit('modifyTabs', _menu, 'plus') |
| | | } |
| | | }, 200) |
| | | } |
| | | }) |
| | | |
| | | // 获取角色权限, edition_type 接口版本控制 ''、'Y'、'A' |
| | | setTimeout(() => { |
| | | Api.getSystemConfig({ |
| | | func: 's_Get_TrdMenu_Role', |
| | | edition_type: 'A', |
| | | pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | }).then(result => { |
| | | let _permAction = {loaded: true} // 按钮权限 |
| | | |
| | | if (result && result.status) { |
| | | if (result.UserRoles_Menu) { |
| | | result.UserRoles_Menu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | } |
| | | } else if (result) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | this.props.initActionPermission(_permAction) |
| | | }) |
| | | }, 50) |
| | | } |
| | | |
| | | getMenulist = (result) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | changeToHome = () => { |
| | | if (!['linkage', 'menu_board'].includes(window.GLOB.navBar)) return |
| | | |
| | | MKEmitter.emit('modifyTabs', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}, 'replace') |
| | | } |
| | | |
| | | render () { |
| | | const { mainMenu, collapse } = this.props |
| | | const { thdMenuList, searchkey, debug, menulist, navBar, menuType, appVersion } = this.state |
| | |
| | | |
| | | return ( |
| | | <header className="header-container ant-menu-dark" id="main-header-container"> |
| | | <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}><img src={this.state.logourl} alt=""/></div> |
| | | <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')} onClick={this.changeToHome}><img src={this.state.logourl} alt=""/></div> |
| | | <div className={'header-collapse ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}> |
| | | {navBar !== 'topmenu' ? (collapse ? <MenuUnfoldOutlined onClick={this.handleCollapse}/> : <MenuFoldOutlined onClick={this.handleCollapse}/>) : null} |
| | | </div> |