import React, { useMemo } from 'react';
import { Modal } from 'antd';

interface ApprovalModalProps {
    modalVisible: boolean;
    onCancel: () => void;
    url: string;
}
/**
 * 审批流程弹窗
 */
const ApprovalModal: React.FC<ApprovalModalProps> = (props) => {
    const { modalVisible, onCancel, url } = props;
    const iframeContent = useMemo(() => {
        return url != "" && <iframe width={"100%"} height={600} src={url} />
    }, [url]);
    return (
        <Modal
            destroyOnClose
            title="审批流程"
            visible={modalVisible}
            width={"80%"}
            centered
            onCancel={() => onCancel()}
            footer={null}
        >
            {iframeContent}
        </Modal>
    );
};

export default ApprovalModal;