TemplateListSearch.js 1.7 KB
Newer Older
1
import React from 'react';
sin-ning@aliyun.com's avatar
sin-ning@aliyun.com committed
2
import { Button, Col, Form, Input, Row, Select } from 'antd';
3 4 5 6 7 8 9 10 11

const FormItem = Form.Item;

/**
 * table 查询
 *
 * @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
 */
const SignListSearch = Form.create()(props => {
sin-ning@aliyun.com's avatar
sin-ning@aliyun.com committed
12
  const { handleSearch, signList } = props;
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
  const { getFieldDecorator, validateFields, form } = props.form;

  function onSubmit(e) {
    e.preventDefault();

    validateFields((err, fields) => {
      const searchParams = fields;
      if (handleSearch) {
        handleSearch(searchParams);
      }
    });
  }

  function handleFormReset() {
    form.resetFields();
  }

  return (
    <Form onSubmit={onSubmit} layout="inline">
      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
        <Col md={8} sm={24}>
          <FormItem label="编号">
            {getFieldDecorator('id')(<Input placeholder="请输入ID" />)}
          </FormItem>
        </Col>
        <Col md={8} sm={24}>
          <FormItem label="签名">
sin-ning@aliyun.com's avatar
sin-ning@aliyun.com committed
40 41 42 43 44 45 46 47 48
            {getFieldDecorator('smsSignId')(
              <Select>
                {signList.map(item => (
                  <Select.Option key={item.id} value={item.id}>
                    {item.sign}
                  </Select.Option>
                ))}
              </Select>
            )}
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
          </FormItem>
        </Col>
      </Row>

      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
        <Col md={8} sm={24}>
          <span>
            <Button type="primary" htmlType="submit">
              查询
            </Button>
            <Button style={{ marginLeft: 8 }} onClick={handleFormReset}>
              重置
            </Button>
          </span>
        </Col>
      </Row>
    </Form>
  );
});

export default SignListSearch;