import {
	observer,
} from 'mobx-react';
import {
	Form,
} from 'antd';
import SetupForm from "../../form/index.js"

@observer
class HeadSet extends React.Component {
	componentDidMount() {
		this.init();
	}

	init = () => {
		const {
			store,
			form
		} = this.props, {
			setForm,
			initFormField
		} = store;

		setForm(form);
		initFormField();
	}

	componentDidUpdate(prevProps, prevState) {
		const {store, form} = this.props;

		store.setTextFormParams(form.getFieldsValue());
	}

	render() {
		const {
			form,
			store
		} = this.props, {
			form_gene_datas,
		} = store;

		return (
			<div className="head-set">
				<SetupForm ecId={`${this && this.props && this.props.ecId || ''}_SetupForm@016ym0`} datas={form_gene_datas} form={form}/>
			</div>
		);
	}
}

export default Form.create()(HeadSet);