import React from 'react';
import { Input, Modal, Form, Select, Button, InputNumber } from 'antd';
const CreateForm = (props) => {
  const { Option, OptGroup } = Select;
  return (
    <Modal
      title={props.values.id ? '编辑' : '新建'}
      width={640}
      visible={props.modalVisible}
      bodyStyle={{ padding: '32px 40px 1px 48px' }}
      footer={null}
      onCancel={() => {
        props.onCancel();
      }}
      destroyOnClose
      maskClosable={false}
    >
      <Form
        layout="horizontal"
        labelCol={{ span: 6 }}
        preserve={false}
        initialValues={props.values}
        onFinish={props.onFinish}
      >
        <Form.Item name="id" hidden={true}>
          <Input />
        </Form.Item>
        <Form.Item name="name" label="企业名称" rules={[{ required: true, max: 30 }]}>
          <Input placeholder="请输入企业名称" />
        </Form.Item>
        
        <Form.Item name="adminName" label="管理员姓名" rules={[{ required: true, max: 20 }]}>
          <Input placeholder="请输入管理员姓名" />
        </Form.Item>
    
        <Form.Item name="email" label="登陆账号(手机号)"
         tooltip="初始密码为:123456"
         rules={[{ required: true, max: 50,message:"请输入手机号"},{pattern: /^1[3-9][0-9]{9}$/,
message: '手机号格式不正确', }]}>
          <Input placeholder="手机号是登录账户" disabled={props.values.id?true:false} />
        </Form.Item>
        {/* <Form.Item name="type" label="所属平台" rules={[{ required: true }]}>
               <Select placeholder='请选择所属平台' allowClear  options={[
                  {
                    value: 0,
                    label: '团餐',
                  },
                  {
                    value: 1,
                    label: '门店',
                  },
                  {
                    value: 2,
                    label: '后厨',
                  },
                ]}/>
              </Form.Item> */}
        {/* <Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/,
message: '手机号格式不正确' }]}>
          <Input placeholder="请输入电话" />
        </Form.Item> */}
        <Form.Item name="remark" label="备注" rules={[{ max: 100 }]}>
          <Input placeholder="请输入备注" />
        </Form.Item>
        <Form.Item>
        <Button  htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} >
                        取消
                    </Button>
        <Button type="primary" htmlType="submit" style={{float:'right'}} >
                        保存
                    </Button>
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default CreateForm;
