forked from nsjcy/frontEnd/nsjcy

liyj
2020-02-03 7a4d973140ee0168f509098b52745c8a7947ca74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
// import { Link } from 'react-router-dom';
// import { Modal } from 'antd-mobile';
// import { Icon } from 'antd';
 
import { Form, Row, Col, Input, DatePicker, Button } from 'antd';
// import moment from 'moment';
const { RangePicker } = DatePicker;
 
import './index.scss';
 
export default class ToReviewForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      key: 0
    };
  }
  onReset = () => {
    this.props.onChange('reset');
    this.setState(prev => ({
      key: prev.key + 1
    }));
  }
 
  disabledTimeStart = current => {
    const { formdata: { endTime } } = this.props;
    if (!current || !endTime) return false;
    return current.valueOf() > endTime + 3600 * 1000;
  }
  disabledTimeEnd = current => {
    const { formdata: { startTime } } = this.props;
    if (!current || !startTime) return false;
    return current.valueOf() < startTime;
  }
  render() {
    const { onSubmit, onChange } = this.props;
    return (
      <Form className="form-main" key={this.state.key}>
        <Row gutter={16}>
          <Col span={5}>
            <Input placeholder="姓名" onPressEnter={onSubmit}
              onChange={e => onChange('name', e.target.value)} />
          </Col>
          <Col span={5}>
            <Input placeholder="职位" onPressEnter={onSubmit}
              onChange={e => onChange('upasPostname', encodeURIComponent(e.target.value))} />
          </Col>
          <Col span={5}>
            <Input placeholder="联系方式" onPressEnter={onSubmit}
              onChange={e => onChange('mobile', encodeURIComponent(e.target.value))} />
          </Col>
          <Col span={2}>
            <Button type="primary" onClick={onSubmit}>查询</Button>
          </Col>
          <Col span={2}>
            <Button onClick={this.onReset}>重置</Button>
          </Col>
        </Row>
      </Form>
    );
  }
}