From 81c3fd3ac5017591d987d9c9fe42042fae5c7d7d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 30 十一月 2021 14:30:47 +0800 Subject: [PATCH] 2021-11-30 --- src/views/design/header/index.jsx | 73 +++++++++++++++++++----------------- 1 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 4352e77..8e60745 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -8,7 +8,6 @@ import { modifyMenuTree, modifyMainMenu, - modifyTabview, resetEditLevel, logout } from '@/store/action' @@ -19,6 +18,7 @@ import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' +import MKEmitter from '@/utils/events.js' import './index.scss' const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu')) @@ -92,6 +92,7 @@ getMenulist = (result) => { let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] + let thdMenuList = [] result.fst_menu && result.fst_menu.forEach(fst => { let fstItem = { MenuID: fst.MenuID, @@ -157,6 +158,8 @@ } } + thdMenuList.push(trdItem) + return trdItem }) } @@ -168,6 +171,7 @@ menulist.push(fstItem) }) + sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList)) return { menulist } } @@ -210,7 +214,8 @@ this.props.modifyMainMenu(menulist[0] || null) this.props.resetEditLevel(false) - this.props.modifyTabview([]) + + MKEmitter.emit('modifyTabs', null, 'replace') } exitEdit = () => { @@ -236,34 +241,36 @@ componentDidMount () { if (window.GLOB.systemType !== 'production') { - Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { - if (res.status) { - let _permFuncField = [] - let _sysRoles = [] - - if (res.Roles && res.Roles.length > 0) { - _sysRoles = res.Roles.map(role => { - return { - uuid: Utils.getuuid(), - value: role.RoleID, - text: role.RoleName - } - }) + setTimeout(() => { + Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { + if (res.status) { + let _permFuncField = [] + let _sysRoles = [] + + if (res.Roles && res.Roles.length > 0) { + _sysRoles = res.Roles.map(role => { + return { + uuid: Utils.getuuid(), + value: role.RoleID, + text: role.RoleName + } + }) + } + + if (res.sModular && res.sModular.length > 0) { + res.sModular.forEach(field => { + if (field.ModularNo) { + _permFuncField.push(field.ModularNo) + } + }) + _permFuncField = _permFuncField.sort() + } + + sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) + sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) } - - if (res.sModular && res.sModular.length > 0) { - res.sModular.forEach(field => { - if (field.ModularNo) { - _permFuncField.push(field.ModularNo) - } - }) - _permFuncField = _permFuncField.sort() - } - - sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) - sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) - } - }) + }) + }, 50) } else if (window.GLOB.systemType === 'production') { this.props.resetEditLevel('HS') this.props.modifyMainMenu({ @@ -296,7 +303,7 @@ } render () { - const { mainMenu, editLevel, tabviews } = this.props + const { mainMenu, editLevel } = this.props const { menulist } = this.state return ( @@ -324,7 +331,7 @@ } {editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} - {!editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} + {!editLevel && menulist ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? <div className="app-entrance entrance"> <div className="icon"><Icon type="appstore" /></div> @@ -335,7 +342,7 @@ </Button> </div> : null } - {editLevel === 'HS' && tabviews.length === 0 && options.sysType === 'local' && window.GLOB.systemType === 'production' && this.props.memberLevel >= 20 ? + {editLevel === 'HS' && options.sysType === 'local' && window.GLOB.systemType === 'production' && this.props.memberLevel >= 20 ? <div className="app-prod-entrance entrance"> <div className="icon"><Icon type="appstore" /></div> <div className="title">搴旂敤绠$悊</div> @@ -396,7 +403,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, menuTree: state.menuTree, mainMenu: state.mainMenu, editLevel: state.editLevel, @@ -407,7 +413,6 @@ const mapDispatchToProps = (dispatch) => { return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), resetEditLevel: (level) => dispatch(resetEditLevel(level)), -- Gitblit v1.8.0