import React, { PureComponent } from 'react'; import { connect } from 'dva'; import { Form, Input, DatePicker, Select, Button, Card } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const FormItem = Form.Item; const { Option } = Select; const { RangePicker } = DatePicker; @connect(state => ({ submitting: state.form.regularFormSubmitting, })) @Form.create() export default class BasicForms extends PureComponent { handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { this.props.dispatch({ type: 'form/submitRegularForm', payload: values, }); } }); } render() { const { submitting } = this.props; const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 3 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 12 }, md: { span: 10 }, }, }; const submitFormLayout = { wrapperCol: { xs: { span: 24, offset: 0 }, sm: { span: 10, offset: 3 }, }, }; return (
{getFieldDecorator('appType', { rules: [{ required: true, message: '应用类型', }], })( )} {getFieldDecorator('productName', { rules: [{ required: true, message: '请输入产品名', }], })( )} {getFieldDecorator('appName', { rules: [ { required: true, message: '请输入应用名' }, { pattern: /^[a-zA-Z0-9-]+$/, message: '只能输入英文、数字、中划线' }, ], })( )} {getFieldDecorator('appChineseName', { rules: [ { required: true, message: '请输入应用中文名' }, { pattern: /^[\u4e00-\u9fa5]+$/, message: '请输入中文' }, ], })( )} {getFieldDecorator('dateRange', { rules: [{ type: 'array', required: true, message: '请选择生效日期' }], })( )} {getFieldDecorator('domain', { rules: [{ required: true, message: '请输入域名' }], })( )}
); } }