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="code"  rules={[{ required: true,max: 20 }]} >
          <Input />
        </Form.Item>
        <Form.Item label={"菜谱名称"} name="name"  rules={[{ required: true,max: 20 }]} >
          <Input />
        </Form.Item>

        <Form.Item>
          <Button type="primary" htmlType="submit">
            保存
          </Button>
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default CreateForm;
