import React from 'react';
import { Modal, Form, Input, Button, Select } from 'antd';

const CreateForm = (props) => {
  const { Option, OptGroup } = Select;
  return (
    <Modal
      title={props.values.id ? '编辑' : '新建'}
      width={640}
      visible={props.createModalVisible}
      bodyStyle={{ padding: '32px 40px 48px' }}
      footer={null}
      onCancel={() => {
        props.onCancel();
      }}
      destroyOnClose
    >
      <Form
        layout="vertical"
        preserve={false}
        initialValues={props.values}
        onFinish={props.onFinish} >
        <Form.Item name="id" hidden={true}>
          <Input />
        </Form.Item>
        <Form.Item label={"产品名称"} name="name"  rules={[{ required: true,max:50}]} >
          <Input />
        </Form.Item>
        <Form.Item label={"产品标签"} name="code"  rules={[{ required: true,max:50}]} >
          <Input />
        </Form.Item>
        <Form.Item label={"备注"} name="remark"  rules={[{ required: false,max:50}]} >
          <Input />
        </Form.Item>
        <Form.Item>
          <Button type="primary" htmlType="submit">
            保存
          </Button>
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default CreateForm;
