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
        labelCol={{ span: 4 }}
        layout="horizontal"
        preserve={false}
        initialValues={props.values}
        onFinish={props.onFinish}
      >
        <Form.Item name="id" hidden={true}>
          <Input />
        </Form.Item>
        <Form.Item name="goodsType_Name" label="商品类型名称" rules={[{ required: true,max:50 }]}>
          <Input />
        </Form.Item>
        <Form.Item
          name="status"
          label="状态"
          defaultValue={props.values.status}
          rules={[{ required: true, message: '请选择状态' }]}
        >
          <Select placeholder="请选择状态">
            <OptGroup>
              <Select.Option value="0">正常</Select.Option>
              <Select.Option value="1">停用</Select.Option>
            </OptGroup>
          </Select>
        </Form.Item>
        <Form.Item name="remark" label="备注" >
          <Input />
        </Form.Item>
        {/* <Form.Item name="notifyType" label="大屏通知" rules={[{ required: true }]}>
          <Select>
            {props.dicData.map((item, index) => {
              return (
                <Select.Option index={index} value={item.value} key={item.value}>
                  {item.remark}
                </Select.Option>
              );
            })}
          </Select>
        </Form.Item> */}

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

export default CreateForm;
