import { Button, Card, DatePicker, Form, Icon, Input, InputNumber, Radio, Select, Tooltip, } from 'antd'; import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale'; import React, { Component } from 'react'; import { Dispatch } from 'redux'; import { FormComponentProps } from 'antd/es/form'; import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { connect } from 'dva'; import styles from './style.less'; const FormItem = Form.Item; const { Option } = Select; const { RangePicker } = DatePicker; const { TextArea } = Input; interface BasicFormProps extends FormComponentProps { submitting: boolean; dispatch: Dispatch; } class BasicForm extends Component { handleSubmit = (e: React.FormEvent) => { const { dispatch, form } = this.props; e.preventDefault(); form.validateFieldsAndScroll((err, values) => { if (!err) { dispatch({ type: 'formBasicForm/submitRegularForm', payload: values, }); } }); }; render() { const { submitting } = this.props; const { form: { getFieldDecorator, getFieldValue }, } = this.props; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 7 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 12 }, md: { span: 10 }, }, }; const submitFormLayout = { wrapperCol: { xs: { span: 24, offset: 0 }, sm: { span: 10, offset: 7 }, }, }; return ( }>
} > {getFieldDecorator('title', { rules: [ { required: true, message: formatMessage({ id: 'form-basic-form.title.required' }), }, ], })( , )} } > {getFieldDecorator('date', { rules: [ { required: true, message: formatMessage({ id: 'form-basic-form.date.required' }), }, ], })( , )} } > {getFieldDecorator('goal', { rules: [ { required: true, message: formatMessage({ id: 'form-basic-form.goal.required' }), }, ], })(