import React from 'react';
import {
    ProFormSelect,
    ProFormText,
    ModalForm,
} from '@ant-design/pro-form';



const UpdateForm = (props) => {
    const {updateModalVisible,updateModalVisibleChange,values,onSubmit} = props;
    // console.log({values});
    return (
        <>
           {
               JSON.stringify(values) !== '{}'&&<ModalForm
               title="编辑人员"
               width="800px"
               initialValues={{...values}}
               labelCol={{ span: 3, offset: 3 }}
               layout={'horizontal'}
               visible={updateModalVisible}
               onVisibleChange={(visible)=>updateModalVisibleChange(visible)}
               onFinish={(value)=>onSubmit({...values,...value})}
             >
               <ProFormText
                 label="姓名"
                 rules={[
                   {
                     required: true,
                     message:'人员名是必填项',
                   },
                 ]}
                 width="sm"
                 name="name"
               />
               <ProFormText
                 label="账户"
                 rules={[
                   {
                     required: true,
                     message:'账户名是必填项',
                   },
                 ]}
                 width="sm"
                 name="account"
               />
               <ProFormText
                 label="密码"
                 rules={[
                   {
                     required: false,
                     message:'密码是必填项',
                   },
                 ]}
                 placeholder="密码不修改时留空"
                 width="sm"
                 name="password"
               />
               <ProFormSelect
                 options={[
                   {
                     value: 0,
                     label: '离职',
                   },
                   {
                     value: 1,
                     label: '在职',
                   },
                 ]}
                 width="sm"
                 name="hospitalStatus"
                 label="在职状态"
               />
             </ModalForm>
           }
        </>
    );
};

export default UpdateForm;
