import {
	observer,
} from 'mobx-react'
import {
	WeaLeftRightLayout,
} from 'ecCom'
// import OrgTree from './OrgTree'
import Table from './Table'
import Tab from './Tab'
import BriefInfo from './BriefInfo'
import WeaTree from './AsyncTree'

@observer
export default class Content extends React.Component {
	constructor(props) {
		super(props);
	}

	render () {
		const {
			store
		} = this.props, {
			date,
			selectedKey,
			orgTree,
			isTreeShow,
		} = store, {
			type
		} = orgTree;

		// const tree = <OrgTree store={store} date={date} />;
		const tree = <WeaTree ecId={`${this && this.props && this.props.ecId || ''}_WeaTree@hqpfcp`} />
		const rightLayout = (
			<div>
				{type !== 'JobTitle' && <Tab ecId={`${this && this.props && this.props.ecId || ''}_Tab@8p0abv`} store={store} />}
				{
					(type !== 'all' && selectedKey === '0') ? <BriefInfo ecId={`${this && this.props && this.props.ecId || ''}_BriefInfo@pcghso`} store={store} /> : <Table ecId={`${this && this.props && this.props.ecId || ''}_Table@un4cxc`} store={store} />
				}
			</div>
		);

		if (isTreeShow) {
			return (
				<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@k15rbf`}
					isNew={true}
					leftCom={tree}
					leftWidth={280}
					resize={true}
				>
					{rightLayout}
				</WeaLeftRightLayout>
			);
		} else {
			return rightLayout;
		}


	}
}