| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Tabs, Icon, Popover, Modal } from 'antd' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | floor: tabs.floor, |
| | | 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: [], |
| | | }] |
| | | 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: [] } |
| | | ] |
| | | } |
| | | this.setState({ |
| | | tabs: _tabs |
| | |
| | | } |
| | | |
| | | updateComponent = (component) => { |
| | | const { tabs } = this.state |
| | | |
| | | if (!is(fromJS(tabs.setting), fromJS(component.setting))) { |
| | | // 注册事件-标签变化,通知标签内元素 |
| | | MKEmitter.emit('tabsChange', tabs.uuid) |
| | | } |
| | | |
| | | this.setState({ |
| | | tabs: component |
| | | }) |
| | |
| | | <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> |
| | | </Popover> |
| | | } key={tab.uuid}> |
| | | {/* Content of Tab Pane {tab.label} */} |
| | | <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | <TabComponents menu={menu} parentId={tabs.uuid} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | </TabPane> |
| | | ))} |
| | | <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane> |