import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; import moment from 'moment'; import { Row, Col, Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message, Badge, Divider, Steps, Radio } from 'antd'; import StandardTable from '../../components/StandardTable'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './TableList.less'; const FormItem = Form.Item; const { Step } = Steps; const { TextArea } = Input; const { Option } = Select; const RadioGroup = Radio.Group; const getValue = obj => Object.keys(obj).map(key => obj[key]).join(','); const statusMap = ['default', 'processing', 'success', 'error']; const status = ['关闭', '运行中', '已上线', '异常']; const CreateForm = Form.create()((props) => { const { modalVisible, form, handleAdd, handleModalVisible } = props; const okHandle = () => { form.validateFields((err, fieldsValue) => { if (err) return; handleAdd(fieldsValue); }); }; return ( handleModalVisible()} > {form.getFieldDecorator('desc', { rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }], })( )} ); }); @Form.create() class UpdateForm extends PureComponent { constructor(props) { super(props); this.state = { formVals: { name: props.values.name, desc: props.values.desc, key: props.values.key, target: '0', template: '0', type: '1', time: '', frequency: 'month', }, currentStep: 0, }; this.formLayout = { labelCol: { span: 7 }, wrapperCol: { span: 13 }, }; } handleNext = (currentStep) => { const { form, handleUpdate } = this.props; form.validateFields((err, fieldsValue) => { if (err) return; const formVals = { ...this.state.formVals, ...fieldsValue }; this.setState({ formVals, }, () => { if (currentStep < 2) { this.forward(); } else { handleUpdate(this.state.formVals); } }); }); } backward = () => { this.setState({ currentStep: this.state.currentStep - 1, }); } forward = () => { this.setState({ currentStep: this.state.currentStep + 1, }); } renderContent = (currentStep, formVals) => { const { form } = this.props; if (currentStep === 1) { return [ {form.getFieldDecorator('target', { initialValue: formVals.target, })( )} , {form.getFieldDecorator('template', { initialValue: formVals.template, })( )} , {form.getFieldDecorator('type', { initialValue: formVals.type, })( )} , ]; } if (currentStep === 2) { return [ {form.getFieldDecorator('time', { rules: [{ required: true, message: '请选择开始时间!' }], })( )} , {form.getFieldDecorator('frequency', { initialValue: formVals.frequency, })( )} , ]; } return [ {form.getFieldDecorator('name', { rules: [{ required: true, message: '请输入规则名称!' }], initialValue: formVals.name, })( )} , {form.getFieldDecorator('desc', { rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }], initialValue: formVals.desc, })(