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

//根据情况import组件
import Tab from './Tab';
import Table from './Table';

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

    getChildren = () => {
        return (
            <div>
                <Tab ecId={`${this && this.props && this.props.ecId || ''}_Tab@lllwh4`} />
                <Table ecId={`${this && this.props && this.props.ecId || ''}_Table@783erv`} />
            </div>
        )
    }

    render() {
        const {
            hrmUsedemand
        } = this.props, {
            mainDialog,
            closeDialog,
            buttons,
            style,
            dropMenuDatas,
        } = hrmUsedemand, {
            title,
            visible,
        } = mainDialog;

        return (
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@c6d6yx`}
                title={title}
                icon="icon-coms-hrm"
                iconBgcolor="#217346"
                visible={visible}
                hasScroll={true}
                onCancel={() => closeDialog()}
                buttons={buttons}
                style={style}
            >
                <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@92bsfj`} datas={dropMenuDatas}>
                    {visible && this.getChildren()}
                </WeaRightMenu>
            </WeaDialog>
        )

    }
}