| | |
| | | } |
| | | } |
| | | |
| | | modifyTabs = (tab, type) => { |
| | | const { tabviews } = this.state |
| | | modifyTabs = (tab, type, fixed) => { |
| | | const { tabviews, activeId } = this.state |
| | | |
| | | if (type === 'plus') { |
| | | if (type === 'plus' && fixed) { |
| | | let _tabs = tabviews.filter(item => item.MenuID !== tab.MenuID) |
| | | let index = _tabs.findIndex(item => item.MenuID === activeId) |
| | | |
| | | this.setState({ |
| | | tabviews: _tabs |
| | | }, () => { |
| | | if (index > -1) { |
| | | _tabs.splice(index + 1, 0, tab) |
| | | } else { |
| | | _tabs.push(tab) |
| | | } |
| | | this.setState({ |
| | | tabviews: _tabs, |
| | | activeId: tab.MenuID |
| | | }) |
| | | }) |
| | | } else if (type === 'plus') { |
| | | if (tabviews.findIndex(item => item.MenuID === tab.MenuID) > -1) { |
| | | let _tabs = tabviews.filter(item => item.MenuID !== tab.MenuID) |
| | | this.setState({ |
| | |
| | | const { tabviews, activeId } = this.state |
| | | |
| | | return ( |
| | | <section id="mk-tabview-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <section id="mk-tabview-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '') + (tabviews && tabviews.length > 0 ? ' hastab' : '')}> |
| | | <div className="content-header"> |
| | | {tabviews && tabviews.length > 0 && |
| | | <Tabs activeKey={activeId}> |