chenlei vor 1 Monat
Ursprung
Commit
22b4766e95

+ 17 - 13
src/pages/A_workbench/A1dataSta/components/Tab1/index.tsx

@@ -24,7 +24,7 @@ export const A1Tab1: FC = () => {
 
 
   const getDetail = async (year: number) => {
   const getDetail = async (year: number) => {
     const res = await A1_APIGetCheck(year)
     const res = await A1_APIGetCheck(year)
-    return JSON.parse(res.data.snap) as Record<string, number>
+    return res.data ? (JSON.parse(res.data.snap) as Record<string, number>) : null
   }
   }
 
 
   const getYearList = () => {
   const getYearList = () => {
@@ -62,6 +62,8 @@ export const A1Tab1: FC = () => {
 
 
     const levels = ['total', 'level0', 'level1', 'level2', 'level3', 'level4']
     const levels = ['total', 'level0', 'level1', 'level2', 'level3', 'level4']
     levels.forEach(level => {
     levels.forEach(level => {
+      if (!curRes || !prevRes) return
+
       const curProp =
       const curProp =
         level === 'total' ? 'total' : `pcs${level.charAt(0).toUpperCase()}${level.slice(1)}`
         level === 'total' ? 'total' : `pcs${level.charAt(0).toUpperCase()}${level.slice(1)}`
       const diff = curRes[curProp] - prevRes[curProp]
       const diff = curRes[curProp] - prevRes[curProp]
@@ -71,18 +73,20 @@ export const A1Tab1: FC = () => {
       }
       }
     })
     })
 
 
-    setCurYearData([
-      {
-        ...curRes,
-        id: 1
-      }
-    ])
-    setPrevYearData([
-      {
-        ...prevRes,
-        id: 1
-      }
-    ])
+    curRes &&
+      setCurYearData([
+        {
+          ...curRes,
+          id: 1
+        }
+      ])
+    prevRes &&
+      setPrevYearData([
+        {
+          ...prevRes,
+          id: 1
+        }
+      ])
     setAddData([_addData])
     setAddData([_addData])
   }, [curYear])
   }, [curYear])
 
 

+ 2 - 1
src/pages/F_exhibition/F1exhibition/constants.ts

@@ -29,7 +29,8 @@ export const F1_SON_TYPE_OBJ = {
 }
 }
 export const F1_SON_TYPE_NAME_OBJ = {
 export const F1_SON_TYPE_NAME_OBJ = {
   [F1_SON_TYPE_NAME_ENUM.FIXED]: '固定展览',
   [F1_SON_TYPE_NAME_ENUM.FIXED]: '固定展览',
-  [F1_SON_TYPE_NAME_ENUM.TEMP]: '临时展览'
+  [F1_SON_TYPE_NAME_ENUM.TEMP]: '临时展览',
+  [F1_SON_TYPE_NAME_ENUM.THEME]: '主题展览'
 }
 }
 
 
 export const F1EXHIBITION_TABLE_COLUMNS = [
 export const F1EXHIBITION_TABLE_COLUMNS = [