king
2020-12-04 d441fa1e1cc80f4ea462a750a42a2b25c1f2b202
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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,         // 菜单类型
  }
 
  state = {
    tabs: null,
    parentIds: []
  }
 
  UNSAFE_componentWillMount () {
    const { config } = this.props
    this.setState({
      tabs: config,
      parentIds: config.parentIds || []
    })
  }
 
  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