|
@@ -1,6 +1,7 @@
|
|
|
-import { TASK_STAGE_OPTIONS_DISPOSAL_MANAGEMENT, FIX_STATUS_OPTIONS } from './constant';
|
|
|
|
|
|
|
+import { downloadFile } from '@/views/disaster/utils';
|
|
|
import type { DisasterLossDetailQuery } from '@/types/disaster-control';
|
|
import type { DisasterLossDetailQuery } from '@/types/disaster-control';
|
|
|
import { exportLossRecordToXML } from '@/api/disaster-control';
|
|
import { exportLossRecordToXML } from '@/api/disaster-control';
|
|
|
|
|
+import { TASK_STAGE_OPTIONS_DISPOSAL_MANAGEMENT, FIX_STATUS_OPTIONS } from './constant';
|
|
|
|
|
|
|
|
// 获取任务阶段
|
|
// 获取任务阶段
|
|
|
const getTaskStage = (taskStage: number) => {
|
|
const getTaskStage = (taskStage: number) => {
|
|
@@ -14,14 +15,10 @@ const getfixStatus = (fixStatus: number) => {
|
|
|
// 导出损失明细
|
|
// 导出损失明细
|
|
|
const exportLossRecord = async (data: DisasterLossDetailQuery, name: string) => {
|
|
const exportLossRecord = async (data: DisasterLossDetailQuery, name: string) => {
|
|
|
const res = await exportLossRecordToXML(data);
|
|
const res = await exportLossRecordToXML(data);
|
|
|
|
|
+ if (res.size === 0) return;
|
|
|
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
- const a = document.createElement('a');
|
|
|
|
|
- a.href = url;
|
|
|
|
|
- a.download = `${name}损失明细.xlsx`;
|
|
|
|
|
- a.click();
|
|
|
|
|
- a.remove();
|
|
|
|
|
- window.URL.revokeObjectURL(url);
|
|
|
|
|
|
|
+ downloadFile(url, `${name}损失明细`);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export { getTaskStage, getfixStatus, exportLossRecord };
|
|
export { getTaskStage, getfixStatus, exportLossRecord };
|