|
|
@@ -1,17 +1,19 @@
|
|
|
/**
|
|
|
* 导出检查任务详情pdf
|
|
|
*/
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
import { exportTaskDetailPDF } from '@/api/disaster-precaution';
|
|
|
-const exportTaskDetailToPDF = async (preventInspectTaskId: number) => {
|
|
|
+const exportTaskDetailToPDF = async (preventInspectTaskId: number, name: string) => {
|
|
|
const res = await exportTaskDetailPDF(preventInspectTaskId);
|
|
|
- const blob = new Blob([res.data], { type: 'application/pdf' });
|
|
|
+ const blob = new Blob([res], { type: 'application/pdf' });
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
const a = document.createElement('a');
|
|
|
a.href = url;
|
|
|
- a.download = '检查任务详情.pdf';
|
|
|
+ a.download = `${name}检查任务详情.pdf`;
|
|
|
a.click();
|
|
|
a.remove();
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
+ ElMessage.success(`${name}检查任务详情导出成功`);
|
|
|
};
|
|
|
|
|
|
export { exportTaskDetailToPDF };
|