import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import { is, fromJS } from 'immutable'
|
import { Tabs, Icon } from 'antd'
|
|
import asyncComponent from '@/utils/asyncComponent'
|
|
import './index.scss'
|
|
const TabTransfer = asyncComponent(() => import('../../share/tabtransfer'))
|
const { TabPane } = Tabs
|
|
class antvBarLineChart extends Component {
|
static propTpyes = {
|
BID: PropTypes.any, // 父级Id
|
config: PropTypes.object, // 组件配置信息
|
mainSearch: PropTypes.any, // 外层搜索条件
|
menuType: PropTypes.any, // 菜单类型
|
dataManager: PropTypes.any, // 数据权限
|
}
|
|
state = {
|
tabs: null
|
}
|
|
UNSAFE_componentWillMount () {
|
const { config } = this.props
|
this.setState({
|
tabs: config
|
})
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
componentDidMount () {}
|
|
/**
|
* @description 组件销毁,清除state更新,清除快捷键设置
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
}
|
|
render() {
|
const { BID, mainSearch } = this.props
|
const { tabs } = 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}/>
|
</TabPane>
|
))}
|
</Tabs>
|
</div>
|
)
|
}
|
}
|
|
export default antvBarLineChart
|