Parcourir la source

Merge branch 'master' of http://192.168.0.115:3000/shaogen1995/YW_Goods into master

shaogen1995 il y a 1 mois
Parent
commit
19af4f683b

BIN
public/templates/1.docx


BIN
public/templates/2.docx


BIN
public/templates/5.docx


BIN
public/templates/7.docx


BIN
public/templates/8.docx


BIN
public/templates/9.docx


+ 21 - 6
src/pages/A_workbench/A1dataSta/components/Tab1/index.tsx

@@ -62,14 +62,29 @@ export const A1Tab1: FC = () => {
 
     const levels = ['total', 'level0', 'level1', 'level2', 'level3', 'level4']
     levels.forEach(level => {
-      if (!curRes || !prevRes) return
-
       const curProp =
         level === 'total' ? 'total' : `pcs${level.charAt(0).toUpperCase()}${level.slice(1)}`
-      const diff = curRes[curProp] - prevRes[curProp]
-      if (diff) {
-        // @ts-ignore
-        _addData[`${level}${diff > 0 ? 'Increase' : 'Decrease'}`] = Math.abs(diff)
+
+      if (!curRes && prevRes) {
+        // 没有今年数据,但有去年数据
+        const diff = -prevRes[curProp]
+        if (diff) {
+          // @ts-ignore
+          _addData[`${level}Decrease`] = Math.abs(diff)
+        }
+      } else if (!prevRes && curRes) {
+        // 没有去年数据,但有今年数据
+        const diff = curRes[curProp]
+        if (diff) {
+          // @ts-ignore
+          _addData[`${level}Increase`] = Math.abs(diff)
+        }
+      } else if (prevRes && curRes) {
+        const diff = curRes[curProp] - prevRes[curProp]
+        if (diff) {
+          // @ts-ignore
+          _addData[`${level}${diff > 0 ? 'Increase' : 'Decrease'}`] = Math.abs(diff)
+        }
       }
     })
 

+ 3 - 1
src/pages/F_exhibition/F1exhibition/F1edit/index.tsx

@@ -192,7 +192,9 @@ function F1edit() {
         snapsTemp.forEach((v: any) => {
           const { cusForm, ...obj } = JSON.parse(v.snap || '{}')
           if (obj.id) obj.id2 = v.id
-          const temp: any = {}
+          const temp: any = {
+            ...cusForm
+          }
           if (cusForm) {
             if (cusForm[`${v.goodsId}-lendDate`]) {
               temp[`${v.goodsId}-lendDate`] = dayjs(cusForm[`${v.goodsId}-lendDate`])

+ 1 - 1
src/pages/Y_goodsDetails/Y2look/index.tsx

@@ -59,7 +59,7 @@ function Y2look() {
           {
             thumb: info.thumb
           },
-          ...res[0].data.filter((i: any) => i.type === 'img')
+          ...(res[0].data?.filter((i: any) => i.type === 'img') || [])
         ]
       })
     })

+ 33 - 7
src/utils/exportTemplates.ts

@@ -475,6 +475,11 @@ export const exportWordHandler = async (type: EXPORT_WORD_ENUM, data: Record<any
         page: numberToChinese(page),
         borrowDate: dayjs(temp.createTime).format('YYYY年MM月DD日')
       }
+      temp.goods.forEach((i: any) => {
+        if (i.numName !== '藏品总登记号') {
+          i.num = ''
+        }
+      })
       break
     case EXPORT_WORD_ENUM.HALL_PUT_BACK:
       temp = {
@@ -486,12 +491,16 @@ export const exportWordHandler = async (type: EXPORT_WORD_ENUM, data: Record<any
       }
       break
     case EXPORT_WORD_ENUM.SUB_PUT_BACK:
-      console.log(temp)
       temp = {
         ...temp,
         num: dayjs(temp.date).format('YYYY') + temp.num,
         date: dayjs(temp.date).format('YYYY年MM月DD日')
       }
+      temp.goods.forEach((i: any) => {
+        if (i.numName !== '藏品总登记号') {
+          i.num = ''
+        }
+      })
       break
     case EXPORT_WORD_ENUM.COLLECTION_INVENTORY:
       temp = {
@@ -518,6 +527,9 @@ export const exportWordHandler = async (type: EXPORT_WORD_ENUM, data: Record<any
         group: numberToChinese(temp.goods.length),
         page: numberToChinese(page)
       }
+      temp.goods.forEach((i: any) => {
+        i.pcsActual = i.pcsActual || i.pcs.match(/\d+\.?\d*/)?.[0]
+      })
       break
     case EXPORT_WORD_ENUM.FORM_FOR_DIGITAL:
       const __date = dayjs(temp.createTime)
@@ -562,8 +574,12 @@ export const exportWordHandler = async (type: EXPORT_WORD_ENUM, data: Record<any
     case EXPORT_WORD_ENUM.COLLECTION_CARD:
       const rtf2 = temp.rtf ? JSON.parse(temp.rtf).txtArr[0].txt : ''
       const stack2 = []
-      for (const url of getImageUrlsFromHtml(rtf2)) {
-        stack2.push(await getBase64Sync(url))
+      try {
+        for (const url of getImageUrlsFromHtml(rtf2)) {
+          stack2.push(await getBase64Sync(url))
+        }
+      } catch (err) {
+        console.log(`rtf img transfer base64 error: `, err)
       }
       temp = {
         ...temp,
@@ -595,10 +611,20 @@ export const exportWordHandler = async (type: EXPORT_WORD_ENUM, data: Record<any
         imgs: stack2
       }
 
-      if (type === EXPORT_WORD_ENUM.COLLECTION_ARCHIVES) {
-        temp.imagePages = await arrangeImages(temp.imagePages)
-      } else if (temp.thumb) {
-        temp.thumb = await getBase64Sync(temp.thumb)
+      if (temp.numName !== '藏品总登记号') {
+        temp.num2 = temp.num
+        temp.num = ''
+      }
+
+      try {
+        if (type === EXPORT_WORD_ENUM.COLLECTION_ARCHIVES) {
+          temp.imagePages = await arrangeImages(temp.imagePages)
+        } else if (temp.thumb) {
+          temp.thumb = await getBase64Sync(temp.thumb)
+        }
+      } catch (err) {
+        console.log(err)
+        temp.imagePages = []
       }
       break
     case EXPORT_WORD_ENUM.OUTSIDER_FORM: