|
@@ -1,8 +1,5 @@
|
|
|
-import {CloseOutlined} from '@ant-design/icons';
|
|
|
-import css from './index.module.css';
|
|
|
import {FC} from 'react';
|
|
|
-import {ModalField} from '@components';
|
|
|
-import {Button, Space} from 'antd';
|
|
|
+import {ModalField, Modal as ModalComponent} from '@components';
|
|
|
import ReacatModal from 'react-modal';
|
|
|
import {useFormState} from './hooks';
|
|
|
|
|
@@ -23,42 +20,21 @@ const Modal: FC<Props> = function({visible, onClose, onFetch, name, id}) {
|
|
|
const [{control, isLoading}, onSubmit] = useFormState({visible, onClose, onFetch, name, id});
|
|
|
|
|
|
return (
|
|
|
- <ReacatModal isOpen={visible} style={modalStyle} closeTimeoutMS={200} ariaHideApp={false}>
|
|
|
- <section className={css.dialog}>
|
|
|
- <div className={css.dialogTitle}>
|
|
|
- <h3>{isEdit ? '修改' : '新增'}部门</h3>
|
|
|
- <CloseOutlined className={css.dialogClose} onClick={onClose} />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className={css.dialogContent}>
|
|
|
- <form onSubmit={onSubmit}>
|
|
|
- <ModalField
|
|
|
- name='departmentName'
|
|
|
- width='300px'
|
|
|
- label='部门名称'
|
|
|
- control={control}
|
|
|
- />
|
|
|
- <Space className={css.dialogBtnGroup}>
|
|
|
- <Button
|
|
|
- loading={isLoading}
|
|
|
- type='primary'
|
|
|
- htmlType='submit'
|
|
|
- >
|
|
|
- 确定
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- disabled={isLoading}
|
|
|
- type='default'
|
|
|
- onClick={onClose}
|
|
|
- htmlType='button'
|
|
|
- >
|
|
|
- 关闭
|
|
|
- </Button>
|
|
|
- </Space>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- </section>
|
|
|
- </ReacatModal>
|
|
|
+ <ModalComponent
|
|
|
+ visible={visible}
|
|
|
+ style={modalStyle}
|
|
|
+ title={`${isEdit ? '修改' : '新增'}部门`}
|
|
|
+ onClose={onClose}
|
|
|
+ onSubmit={onSubmit}
|
|
|
+ isLoading={isLoading}
|
|
|
+ >
|
|
|
+ <ModalField
|
|
|
+ name='departmentName'
|
|
|
+ width='300px'
|
|
|
+ label='部门名称'
|
|
|
+ control={control}
|
|
|
+ />
|
|
|
+ </ModalComponent>
|
|
|
|
|
|
);
|
|
|
};
|