import {
    inject,
    observer
} from 'mobx-react'
import {
    WeaTab
} from 'ecCom'

@inject('hrmRecruitLibrary') //todo
@observer
export default class SubTab extends React.Component {
    constructor(props) {
        super(props);
    }

    componentWillUnmount() {
        this.props.hrmRecruitLibrary.resetSubTab()
    }

    render() {
        const {
            hrmRecruitLibrary
        } = this.props, {
            subTabDatas,
            clickTab,
            subTab,
            mainTable,
            iconButtons,
        } = hrmRecruitLibrary, {
            curKey,
        } = subTab, {
            index
        } = mainTable;

        return (
            <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@k0ok8m`}
                datas={ (index == '8') ? [] : subTabDatas}
                keyParam='key'
                selectedKey={curKey}
                buttons={(index == '8') ? iconButtons : []}
                onChange={key => clickTab(key)}
            />
        )
    }
}