import { Modal } from 'antd' import { ExclamationCircleOutlined, DeleteOutlined } from '@ant-design/icons' /** * 标准确认对话框组件 * @param {Object} options - 对话框配置 * @param {string} options.title - 标题 * @param {string|ReactNode} options.content - 内容 * @param {string} options.okText - 确认按钮文字 * @param {string} options.cancelText - 取消按钮文字 * @param {string} options.type - 类型: 'warning', 'danger', 'info' * @param {Function} options.onOk - 确认回调 * @param {Function} options.onCancel - 取消回调 */ const ConfirmDialog = { /** * 显示删除确认对话框(单个项目) */ delete: ({ title = '确认删除', itemName, itemInfo, onOk, onCancel }) => { Modal.confirm({ title, content: (

您确定要删除以下项目吗?

{itemName}

{itemInfo && (

{itemInfo}

)}

此操作不可恢复,请谨慎操作!

), okText: '确认删除', cancelText: '取消', okType: 'danger', centered: true, icon: , onOk, onCancel, }) }, /** * 显示批量删除确认对话框 */ batchDelete: ({ count, items, onOk, onCancel }) => { Modal.confirm({ title: '批量删除确认', content: (

您确定要删除选中的 {count} 个项目吗?

{items.map((item, index) => (
{item.name} {item.info && ( ({item.info}) )}
))}

此操作不可恢复,请谨慎操作!

), okText: '确认删除', cancelText: '取消', okType: 'danger', centered: true, icon: , onOk, onCancel, }) }, /** * 显示警告确认对话框 */ warning: ({ title, content, okText = '确定', cancelText = '取消', onOk, onCancel }) => { Modal.confirm({ title, content, okText, cancelText, centered: true, icon: , onOk, onCancel, }) }, /** * 显示通用确认对话框 */ confirm: ({ title, content, okText = '确定', cancelText = '取消', okType = 'primary', onOk, onCancel, }) => { Modal.confirm({ title, content, okText, cancelText, okType, centered: true, onOk, onCancel, }) }, } export default ConfirmDialog