import React, { useState } from 'react';
import { Row, Col, Modal, Form, Input, Button, InputNumber, Select } from 'antd';

const CreateForm = (props) => {
  return (
    <Modal
      title={props.values.id ? '编辑角色' : '新建角色'}
      width={1000}
      visible={props.modalVisible}
      maskClosable={false}
      bodyStyle={{ padding: '32px 40px 1px 48px' }}
      footer={null}
      onCancel={() => {
        props.onCancel();
      }}
      destroyOnClose
    >
      <Form
        layout="horizontal"
        preserve={false}
        labelCol={{
          span: 4,
        }}
        initialValues={props.values}
        onFinish={props.onFinish}
      >
        <Form.Item name="id" hidden={true}>
          <Input />
        </Form.Item>
      
       
            <Form.Item name="name" label="角色名称" rules={[{ required: true, max: 64 }]}>
              <Input placeholder="请输入角色名称" />
            </Form.Item>
            <Form.Item name="sort" label="排序">
              <InputNumber style={{width:'100%'}} min={1} decimalSeparator="0"/>
            </Form.Item>
            <Form.Item name="remark" label="备注" rules={[{ max: 500 }]}>
              <Input.TextArea 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;
