import type { FC } from 'react'; import { ModalForm, ProFormSelect, ProFormDateTimePicker, ProFormText, ProFormTextArea, } from '@ant-design/pro-form'; import type { BasicListItemDataType } from '../data'; import styles from '../style.less'; import { Button, Result } from 'antd'; type OperationModalProps = { done: boolean; visible: boolean; current: Partial | undefined; onDone: () => void; onSubmit: (values: BasicListItemDataType) => void; }; const OperationModal: FC = (props) => { const { done, visible, current, onDone, onSubmit, children } = props; if (!visible) { return null; } return ( visible={visible} title={done ? null : `任务${current ? '编辑' : '添加'}`} className={styles.standardListForm} width={640} onFinish={async (values) => { onSubmit(values); }} initialValues={current} submitter={{ render: (_, dom) => (done ? null : dom), }} trigger={<>{children}} modalProps={{ onCancel: () => onDone(), destroyOnClose: true, bodyStyle: done ? { padding: '72px 0' } : {}, }} > {!done ? ( <> ) : ( 知道了 } className={styles.formResult} /> )} ); }; export default OperationModal;