/**
 * 导出检查任务详情pdf
 */
import { ElMessage } from 'element-plus';
import { downloadFile } from '@/views/disaster/utils';
import { exportTaskDetailPDF } from '@/api/disaster-precaution';
const exportTaskDetailToPDF = async (preventInspectTaskId: number, name: string) => {
  const res = await exportTaskDetailPDF(preventInspectTaskId);
  if (res.size === 0) return;
  const blob = new Blob([res], { type: 'application/pdf' });
  const url = window.URL.createObjectURL(blob);
  downloadFile(url, `${name}检查任务详情.pdf`);
  ElMessage.success(`${name}检查任务详情导出成功`);
};

export { exportTaskDetailToPDF };
