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

import MainTab from './MainTab';
import MainTable from './MainTable';
@inject('intelogin') //todo
@observer
export default class Top extends React.Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this.props.intelogin.getMenus();
    }

    render() {
        const { intelogin } = this.props,
        { top, mainTable, menus, } = intelogin,
        { title, } = top,
        { tableStore } = mainTable,
        {　　 buttons, dropMenuDatas, } = menus;

        return (
            <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@hfn16i`}
                datas={dropMenuDatas}
                collectParams={{
                    favouritetype: 5,
                    objid: 0,
                    importantlevel:1,
                }}
            >
                <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@6vbcm0`}
                    title={title}
                    icon={<i className='icon-coms-integration'/>}
                    iconBgcolor="#1a57a0"
                    loading={tableStore.loading}
                    buttons={buttons}
                    showDropIcon={true}
                    dropMenuDatas={dropMenuDatas}
                >
                    <MainTab ecId={`${this && this.props && this.props.ecId || ''}_MainTab@2o9bfe`} />
                    <MainTable ecId={`${this && this.props && this.props.ecId || ''}_MainTable@nfsayw`} />
                </WeaTop>
            </WeaRightMenu>
        )
    }

}
