| | |
| | | uuid: tabs.uuid, |
| | | type: tabs.type, |
| | | floor: tabs.floor, |
| | | tabId: tabs.tabId || '', |
| | | parentId: tabs.parentId || '', |
| | | subtype: tabs.subtype, |
| | | setting: {span: 12, position: 'top', tabStyle: 'line', name: tabs.name}, |
| | | subtabs: [ |
| | | { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] }, |
| | | { uuid: Utils.getuuid(), label: 'Tab 2', icon: '', components: [] }, |
| | | { uuid: Utils.getuuid(), label: 'Tab 3', icon: '', components: [] } |
| | | { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 1', icon: '', components: [] }, |
| | | { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 2', icon: '', components: [] }, |
| | | { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 3', icon: '', components: [] } |
| | | ] |
| | | } |
| | | this.setState({ |
| | |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('tabsChange', this.handleTabsChange) |
| | | } |
| | | |
| | | handleTabsChange = (parentId) => { |
| | | const { tabs } = this.state |
| | | |
| | | if (parentId === tabs.parentId) { |
| | | MKEmitter.emit('tabsChange', tabs.uuid) |
| | | } |
| | | } |
| | | |
| | | updateComponent = (component) => { |
| | |
| | | } |
| | | |
| | | tabAdd = (e) => { |
| | | const { tabs } = this.state |
| | | |
| | | e.stopPropagation() |
| | | |
| | | this.setState({ |
| | | editab: { |
| | | uuid: '', |
| | | parentId: tabs.uuid, |
| | | floor: tabs.floor, |
| | | label: '', |
| | | icon: '', |
| | | components: [] |
| | |
| | | <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> |
| | | </Popover> |
| | | } key={tab.uuid}> |
| | | <TabComponents menu={menu} parentId={tabs.uuid} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | </TabPane> |
| | | ))} |
| | | <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane> |