| | |
| | | import { Tabs, Icon } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const TabTransfer = asyncComponent(() => import('../../share/tabtransfer')) |
| | |
| | | |
| | | class antvBarLineChart extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | bids: PropTypes.any, // 父级Id集 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | |
| | | |
| | | state = { |
| | | tabs: null, |
| | | parentIds: [] |
| | | parentIds: [], |
| | | bids: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, bids } = this.props |
| | | this.setState({ |
| | | tabs: config, |
| | | parentIds: config.parentIds || [] |
| | | parentIds: config.parentIds || [], |
| | | bids: bids ? bids : {} |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () {} |
| | | componentDidMount () { |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { parentIds, bids } = this.state |
| | | |
| | | if (!parentIds.includes(MenuID)) return |
| | | |
| | | this.setState({ |
| | | bids: {...bids, [MenuID]: id} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { BID, mainSearch } = this.props |
| | | const { tabs } = this.state |
| | | const { mainSearch } = this.props |
| | | const { tabs, bids } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-antv-tabs-wrap" style={tabs.style}> |
| | | <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> |
| | | {tabs.subtabs.map(tab => ( |
| | | <TabPane tab={<span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>} key={tab.uuid}> |
| | | <TabTransfer config={tab} BID={BID} mainSearch={mainSearch}/> |
| | | <TabTransfer config={tab} bids={bids} mainSearch={mainSearch}/> |
| | | </TabPane> |
| | | ))} |
| | | </Tabs> |