import React, { Component } from 'react'; import moment from 'moment'; import { Form, Button, Switch, DatePicker, Input, InputNumber, Modal, Alert } from 'antd'; import Select from '../../components/Select'; import Multiple from '../../components/Multiple'; import Radio from '../../components/Radio'; import TreeSelect from '../../components/TreeSelect'; import './index.less'; const { TextArea } = Input; class FormLayout extends Component { constructor(props) { super(props); this.state = { show: !!props.modal, loading: false, err: '' }; } onConfirm() { this.props.form.validateFields((err, fieldsValue) => { if (err) { return; } if (this.props.onConfirm && this.props.modal) { this.setState({ loading: true }); this.props .onConfirm(fieldsValue) .then(() => { this.setState({ loading: false }); this.onCancel(); }) .catch(e => { this.setState({ loading: false, err: e.message }); }); } else { this.onCancel(); } }); } onCancel() { if (this.props.modal) this.setState({ show: false }); if (this.props.onCancel) this.props.onCancel(); } getItem(item) { switch (item.type) { case 'tree': return ( ); case 'radio': return ; case 'select': return (