import React, { Component } from "react"; import { Button, Form, Input, Select, DatePicker } from "antd"; // import moment from 'moment'; const { RangePicker } = DatePicker; const { Option } = Select; const dateFormat = 'YYYY-MM-DD'; @Form.create() export default class SearchForm extends Component { constructor(props) { super(props); this.state = { policeys: [], orderId: '' } } componentDidMount() { // this.props.onSearch(this.props.form.getFieldsValue()); this._search(); } _search = (e) => { e && e.preventDefault(); this.props.form.validateFields((err, values) => { if(err) return; const { applyDate, practiceDate, payDate } = values; // 报名时间 if(applyDate.length == 2) { values.applyStartDate = applyDate[0].format(dateFormat); values.applyEndDate = applyDate[1].format(dateFormat); }else { values.applyStartDate = ''; values.applyEndDate = ''; } Reflect.deleteProperty(values, 'applyDate'); // delete values.applyDate; // 实操培训时间 if(practiceDate.length == 2) { values.practiceStartDate = practiceDate[0].format(dateFormat); values.practiceEndDate = practiceDate[1].format(dateFormat); }else { values.practiceStartDate = ''; values.practiceEndDate = ''; } Reflect.deleteProperty(values, 'practiceDate'); // delete values.practiceDate; // 缴费时间 if(payDate.length == 2) { values.payStartDate = payDate[0].format(dateFormat); values.payEndDate = payDate[1].format(dateFormat); }else { values.payStartDate = ''; values.payEndDate = ''; } // delete values.payDate; Reflect.deleteProperty(values, 'payDate'); console.log(values) // // 开班时间 // if(classDate.length == 2) { // values.classStartDate = classDate[0].format(dateFormat); // values.classEndDate = classDate[1].format(dateFormat); // }else { // values.classStartDate = ''; // values.classEndDate = ''; // } // // delete values.classDate; // Reflect.deleteProperty(values, 'classDate'); // 搜索的时候重置为第一页 values.pageNumber = 1; // 传递参数 this.props.onSearch && this.props.onSearch(values); }); } _reset = () => { this.props.form.resetFields(); this._search(); // const data = this.props.form.getFieldsValue(); // this.props.onSearch(data); } render() { const { getFieldDecorator } = this.props.form; return (
{getFieldDecorator('keyword', { initialValue: '' })( )} {getFieldDecorator('isMakeUp', { initialValue: '' })( )} {getFieldDecorator('applyStatus', { initialValue: '' })( )} {getFieldDecorator('backgroundStatus', { initialValue: '' })( )} {/* {getFieldDecorator('comInsId', { initialValue: '' })( )} */} {getFieldDecorator('internStatus', { initialValue: '' })( )} {getFieldDecorator('orderStatus', { initialValue: '' })( )} {getFieldDecorator('materialApproveStatus', { initialValue: '' })( )} {getFieldDecorator('trackLearnStatus', { initialValue: '' })( )} {getFieldDecorator('classOpenStatus', { initialValue: '' })( )} {getFieldDecorator('graduateTestState', { initialValue: '' })( )} {getFieldDecorator('identifyTestState', { initialValue: '' })( )} {getFieldDecorator('applyDate', { initialValue: [] })( )} {getFieldDecorator('departName', { initialValue: '' })( )}
{getFieldDecorator('payDate', { initialValue: [] })( )} {getFieldDecorator('practiceDate', { initialValue: [] })( )} {/* {getFieldDecorator('classDate', { initialValue: [] })( )} */}
); } }