import React from 'react';
import { Modal } from 'antd';
import {
    ProFormSelect,
    ProFormText,
    ModalForm,
} from '@ant-design/pro-form';
import { useIntl, FormattedMessage } from 'umi';


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: (
                       <FormattedMessage id="pages.searchTable.departmentName" defaultMessage="科室名是必填项" />
                     ),
                   },
                 ]}
                 width="sm"
                 name="departmentName"
               />
               <ProFormText
                 label="科室编码"
                 rules={[
                   {
                     required: true,
                     message: (
                       <FormattedMessage id="pages.searchTable.departmentCode" defaultMessage="科室编码是必填项" />
                     ),
                   },
                 ]}
                 width="sm"
                 name="departmentCode"
               />
             </ModalForm>
           }
        </>
    );
};

export default UpdateForm;
