import {
	inject,
	observer,
} from 'mobx-react'
import {
	toJS
} from 'mobx'
import {
	WeaTableNew
} from 'comsMobx'
import {
	message
} from 'antd'
import {
	i18n
} from '../../public/i18n';
const WeaTable = WeaTableNew.WeaTable;

@inject('hrmAssImple')
@observer
export default class MainTable extends React.Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {
		this.props.hrmAssImple.getTableInfo();
	}

	onOperatesClick = (record, rowIndex, operate) => {
		const {
			hrmAssImple
		} = this.props, {
			setSelectRowKeys,
			openDialog,
		} = hrmAssImple, {
			randomFieldId
		} = record, {
			index
		} = operate;

		setSelectRowKeys(randomFieldId);

		switch (index) {
			case '0':
				openDialog();
				break;
		}

	}

	render() {
		const {
			hrmAssImple,
		} = this.props, {
			mainTable,
		} = hrmAssImple, {
			tableStore
		} = mainTable;

		return (
			<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@aop3bo`} 
			 	comsWeaTableStore={tableStore}
			 	hasOrder={true}
			 	needScroll={true}
			 	onOperatesClick={(record, rowIndex, operate) => this.onOperatesClick(record, rowIndex, operate)}
			/>
		)

	}
}