import React, {
	Component
} from 'react';
import {
	observer
} from 'mobx-react';
import {
	WeaTableNew
} from 'comsMobx';
import Tabs from '../../../coms/Tabs';
import classnames from 'classnames';
const {
	WeaTable
} = WeaTableNew;

@observer
export default class EditResource extends Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {
		const {
			store,
			routeProps
		} = this.props;
		store.init(routeProps.params);
	}

	componentWillReceiveProps(nextProps) {}

	render = () => {
		const {
			store
		} = this.props;
		const {
			tabConfig,
			getTabIndex,
			formTarget,
			showError,
			refreshData,
			table,
			selectedOrg
		} = store;
		const {
			conditionForm: form,
			conditionFormFields: fields
		} = formTarget;
		const tabProps = {
			tabConfig: tabConfig,
			tabChangeHandle: this.tabChangeHandle,
			activeTabInfo: {
				activeTabKey: tabConfig.activeTabKey,
				activeTabIndex: getTabIndex(tabConfig.tabs, tabConfig.activeTabKey)
			},
			store: store,
			conditionForm: form,
			conditionFormFields: fields,
		}
		const classes = classnames({
			['tabPane']: true,
			['tabPane-include']: true
		});

		return (
			<Tabs {...tabProps}>
				<div className={classes}>
					{selectedOrg}
					<WeaTable
                        comsWeaTableStore={table}
                        hasOrder={true}
                        needScroll={true}
                    />
				</div>
			</Tabs>
		)
	}
}