|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="new-fire-details">
|
|
|
<!-- 顶部标题栏 -->
|
|
|
- <headerTop :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" :showSave="showSave" @save="saveEditSub" @back="backEditSub" />
|
|
|
+ <headerTop :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" :showSave="showSave" @save="saveEditSub" @export="exportEditSub" @back="backEditSub" />
|
|
|
<editFilePage :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" ref="editFilePageRef" />
|
|
|
<editInspection :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" ref="editInspectionRef" />
|
|
|
<photoEdit :caseId="caseId" :title="pageTitle" ref="photoEditRef" />
|
|
|
@@ -38,7 +38,7 @@ import { ElMessage } from "element-plus";
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
import showIndex from './showIndex.vue';
|
|
|
import editIndex from './editIndex.vue';
|
|
|
-import { copyCase, updateCaseInfo } from "@/store/case";
|
|
|
+import { copyCase, updateCaseInfo, exportCaseDetailInfo, getCaseDetailInfo, getCaseInquestInfo, exportCaseInquestInfo } from "@/store/case";
|
|
|
import { getCaseInfoOffline as getCaseInfo, getCaseSceneListOffline as getCaseSceneList, uploadRecordFragments, getUploadRecordProgress } from "@/store/editCsae";
|
|
|
import { RouteName, router } from "@/router";
|
|
|
import shot from './components/shot.vue';
|
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
createTemploraryID,
|
|
|
} from '@/store/system'
|
|
|
import { isOfflineMode } from '@/util/offline'
|
|
|
+import saveAs from "@/util/file-serve";
|
|
|
|
|
|
// 从路由获取参数
|
|
|
const appId = import.meta.env.VITE_APP_APP === 'criminal' ? 'criminal' : !import.meta.env.VITE_APP_APP ? '' : 'fire';
|
|
|
@@ -136,6 +137,8 @@ onMounted(() => {
|
|
|
const title = detail?.title || '';
|
|
|
const mapUrl = detail?.mapUrl;
|
|
|
const latAndLong = detail?.latAndLong;
|
|
|
+ const firePayload = detail?.fire;
|
|
|
+ const criminalPayload = detail?.criminal;
|
|
|
if (!title) return;
|
|
|
const cr: any = currentRecord.value || {};
|
|
|
if (fromRoute.value === 'fire') {
|
|
|
@@ -143,10 +146,18 @@ onMounted(() => {
|
|
|
cr.tmProject.projectName = title;
|
|
|
if (mapUrl !== undefined) cr.tmProject.mapUrl = mapUrl;
|
|
|
if (latAndLong !== undefined) cr.tmProject.latAndLong = latAndLong;
|
|
|
+ if (firePayload && typeof firePayload === 'object') {
|
|
|
+ cr.tmProject = { ...(cr.tmProject || {}), ...(firePayload || {}) };
|
|
|
+ }
|
|
|
+ if (mapUrl !== undefined) cr.mapUrl = mapUrl;
|
|
|
+ if (latAndLong !== undefined) cr.latAndLong = latAndLong;
|
|
|
} else if (fromRoute.value === 'criminal') {
|
|
|
cr.caseTitle = title;
|
|
|
if (mapUrl !== undefined) cr.mapUrl = mapUrl;
|
|
|
if (latAndLong !== undefined) cr.latAndLong = latAndLong;
|
|
|
+ if (criminalPayload && typeof criminalPayload === 'object') {
|
|
|
+ Object.assign(cr, criminalPayload || {});
|
|
|
+ }
|
|
|
}
|
|
|
currentRecord.value = { ...cr };
|
|
|
};
|
|
|
@@ -308,6 +319,72 @@ const saveEditSub = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const exportEditSub = async () => {
|
|
|
+ const currentType = route.query.type as string | undefined;
|
|
|
+ if (currentType !== 'extraction' && currentType !== 'inquest') {
|
|
|
+ ElMessage.warning('当前页面不支持导出');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const sub = route.query.editSub as string | '';
|
|
|
+ let comp: any = null;
|
|
|
+ if (sub === 'editInspection') comp = editInspectionRef.value as any;
|
|
|
+ else comp = editFilePageRef.value as any;
|
|
|
+ if (!comp || typeof comp.handleSave !== 'function') {
|
|
|
+ ElMessage.warning('当前页面暂未就绪,稍后再试');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await comp.handleSave();
|
|
|
+ if (!res) return;
|
|
|
+
|
|
|
+ let exportId = typeof route.query.id === 'string' ? Number(route.query.id) : undefined;
|
|
|
+
|
|
|
+ // 优先使用保存返回的 ID
|
|
|
+ if (res && typeof res === 'object') {
|
|
|
+ if (res.id) exportId = Number(res.id);
|
|
|
+ else if (res.data && res.data.id) exportId = Number(res.data.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (currentType === 'extraction') {
|
|
|
+ if (exportId === undefined) {
|
|
|
+ const resInfo: any = await getCaseDetailInfo(caseId.value);
|
|
|
+ const list = resInfo?.data;
|
|
|
+ if (Array.isArray(list) && list.length) {
|
|
|
+ const sorted = list
|
|
|
+ .filter((i: any) => i && (typeof i.id === 'number' || typeof i.id === 'string'))
|
|
|
+ .sort((a: any, b: any) => Number(b.id) - Number(a.id));
|
|
|
+ exportId = sorted[0] ? Number(sorted[0].id) : undefined;
|
|
|
+ } else if (list && (typeof list.id === 'number' || typeof list.id === 'string')) {
|
|
|
+ exportId = Number(list.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const blob = await exportCaseDetailInfo(caseId.value, exportId);
|
|
|
+ await saveAs(blob, `${pageTitle.value || '提取清单'}_提取清单.docx`);
|
|
|
+ } else if (currentType === 'inquest') {
|
|
|
+ if (exportId === undefined) {
|
|
|
+ const resInfo: any = await getCaseInquestInfo(caseId.value);
|
|
|
+ const list = resInfo?.data;
|
|
|
+ if (Array.isArray(list) && list.length) {
|
|
|
+ const sorted = list
|
|
|
+ .filter((i: any) => i && (typeof i.id === 'number' || typeof i.id === 'string'))
|
|
|
+ .sort((a: any, b: any) => Number(b.id) - Number(a.id));
|
|
|
+ exportId = sorted[0] ? Number(sorted[0].id) : undefined;
|
|
|
+ } else if (list && (typeof list.id === 'number' || typeof list.id === 'string')) {
|
|
|
+ exportId = Number(list.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const blob = await exportCaseInquestInfo(caseId.value, exportId);
|
|
|
+ await saveAs(blob, `${pageTitle.value || '勘验笔录'}_勘验笔录.docx`);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (e) {
|
|
|
+ console.error('导出失败', e);
|
|
|
+ ElMessage.error('导出失败,请稍后重试');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const backEditSub = () => {
|
|
|
const newQuery: any = { ...route.query };
|
|
|
delete newQuery.editSub;
|