From c95918fb0fffb61b1117fbf4cd429e291b9594d0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 九月 2021 01:02:34 +0800 Subject: [PATCH] 2021-09-17 --- src/components/header/index.jsx | 46 +++++----------------------------------------- 1 files changed, 5 insertions(+), 41 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 84855e4..22d4bf1 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -10,7 +10,6 @@ toggleCollapse, modifyMenuTree, modifyMainMenu, - modifyTabview, initActionPermission, initMenuPermission, logout @@ -221,21 +220,12 @@ Promise.all([roledefer, menudefer]).then(response => { if (response[1]) { - let tabs = fromJS(this.props.tabviews).toJS() let menu = fromJS(response[1]).toJS() if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } else { - tabs = tabs.map(tab => { - tab.selected = false - return tab - }) - - menu.selected = true - tabs.push(menu) - this.props.modifyTabview(tabs) + MKEmitter.emit('modifyTabs', menu, 'plus') } } }) @@ -384,10 +374,6 @@ sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) sessionStorage.setItem('isEditState', 'true') - this.props.modifyMenuTree([]) - this.props.modifyMainMenu(null) - this.props.modifyTabview([]) - this.props.history.replace('/design') } } @@ -412,10 +398,6 @@ sessionStorage.setItem('isEditState', 'true') this.setSystemFuncs() - - this.props.modifyMenuTree([]) - this.props.modifyMainMenu(null) - this.props.modifyTabview([]) this.props.history.replace('/design') } else { @@ -632,27 +614,11 @@ if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { // NewPage涓烘墦寮�澶栭儴椤甸潰鍦板潃锛宯ewpage涓烘墦寮�绯荤粺鑿滃崟 window.open(menu.src) } else if (menu.OpenType === 'blank') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } else if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } else { - let tabs = fromJS(this.props.tabviews).toJS() - tabs = tabs.filter(tab => { - tab.selected = false - return tab.MenuID !== menu.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - menu.selected = true - tabs.push(menu) - this.props.modifyTabview(tabs) - }) + MKEmitter.emit('modifyTabs', menu, 'plus') } if (window.GLOB.systemType === 'production') { @@ -890,7 +856,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, collapse: state.collapse, menuTree: state.menuTree, mainMenu: state.mainMenu, @@ -901,7 +866,6 @@ const mapDispatchToProps = (dispatch) => { return { toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), -- Gitblit v1.8.0