bill 2 месяцев назад
Родитель
Сommit
7d04af2a9c

+ 18 - 3
src/example/fuse/enter-shared.ts

@@ -321,7 +321,7 @@ export const uploadResourse = genLoading(
 );
 
 export const getResource = (url: string) => {
-    return url;
+  return url;
   // if (url.includes("//")) {
   //   return url;
   // } else if (import.meta.env.DEV && import.meta.env.VITE_STATIC) {
@@ -332,7 +332,9 @@ export const getResource = (url: string) => {
   // }
 };
 
-export const getTableTemp = () => {
+let tempCache: any
+export let getTableTemp = async () => {
+  if (tempCache) return tempCache;
   let table: Record<string, string>;
   let title: string = params.value.title;
   if (params.value.table) {
@@ -350,11 +352,24 @@ export const getTableTemp = () => {
       绘图人: "",
       绘图时间: "",
     };
+
+    if (params.value.overviewId) {
+      const item = await get("fusion/caseOverview/settingInfo", {
+        overviewId: params.value.overviewId,
+      });
+      if (item) {
+        table.案发时间 = item.crimeTimeBegin;
+        table.案发地点 = item.caseLocation;
+        table.绘图单位 = item.orgName;
+        table.绘图人 = item.investigatorName;
+        table.绘图时间 = item.caseTypeName;
+      }
+    }
   }
   if (!title) {
     title = "默认标题";
   }
-  return { table, title };
+  return tempCache = { table, title }
 };
 
 export const getTileGroups = async () => {

+ 3 - 2
src/example/fuse/enter.ts

@@ -76,8 +76,9 @@ if (window.platform.sceneDraw) {
 
 window.platform.getTabulationData = async (...args: any[]) => {
   const result = await platform.getTabulationData.apply(this, args as any);
-  if (!result.title && platform.getTableTemp().title) {
-    result.title = platform.getTableTemp().title;
+  const temp = await platform.getTableTemp()
+  if (!result.title && temp.title) {
+    result.title = temp.title;
   }
   if (!result.store) {
     result.store = {

+ 6 - 6
src/example/fuse/views/tabulation/gen-tab.ts

@@ -70,12 +70,13 @@ export const genTabulationData = async (
   compass?: number,
   cover?: TabCover | null
 ) => {
+  const temp: Record<string, string> = await window.platform.getTableTemp();
   const { margin, size } = getPaperConfig(
     paperConfigs[paperKey].size,
     paperConfigs[paperKey].scale
   );
 
-  const getTable = () => {
+  const getTable = async () => {
     const w1 = getRealPixel(25, paperKey);
     const w2 = getRealPixel(55, paperKey);
     const h = getRealPixel(8, paperKey);
@@ -90,8 +91,7 @@ export const genTabulationData = async (
       fontColor: "#000000",
     };
     const valueColl = { ...nameColl, width: w2 };
-    const tableTemp: Record<string, string> =
-      window.platform.getTableTemp().table;
+    const tableTemp = temp.table
     const rows = Object.entries(tableTemp);
     const data = {
       ...getBaseItem(),
@@ -194,7 +194,7 @@ export const genTabulationData = async (
   const getTitle = () => {
     const title = {
       ...getBaseItem(),
-      content: window.platform.getTableTemp().title,
+      content: temp.title,
       width: getRealPixel(90, paperKey),
       heihgt: getRealPixel(14.4, paperKey),
       fontSize: getRealPixel(12, paperKey),
@@ -289,10 +289,10 @@ export const genTabulationData = async (
   };
 
   const data: DrawData = {
-    table: [getTable()],
+    table: [await getTable()],
     serial: [],
   };
-  if (window.platform.getTableTemp().title) {
+  if (temp.title) {
     data.text = [getTitle()]
   }
   const image = await getCover();