lanxin 1 dzień temu
rodzic
commit
8894df8598

+ 15 - 5
src/pages/Cledger/C1ledger/C1ImportRes/index.tsx

@@ -105,11 +105,21 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
         // 2. 再导入数据
         // 2. 再导入数据
         const importId = recordRes.data.id
         const importId = recordRes.data.id
         const res: any = await API_addImportExcel(
         const res: any = await API_addImportExcel(
-          successData.map((item: any) => ({
-            ...item,
-            importId,
-            importError: item.importIsTrue === 0 ? 1 : 0
-          })) as any
+          successData.map((item: any) => {
+            const obj = {
+              ...item,
+              importId,
+              importError: item.importIsTrue === 0 ? 1 : 0
+            }
+            // 过滤掉值为 null 的属性
+            // console.log(
+            //   'obj',
+            //   Object.fromEntries(Object.entries(obj).filter(([, v]) => v != null && v !== 'null'))
+            // )
+            return Object.fromEntries(
+              Object.entries(obj).filter(([, v]) => v != null && v !== 'null')
+            ) as any
+          })
         )
         )
         if (res?.code === 0) {
         if (res?.code === 0) {
           MessageFu.success('导入成功')
           MessageFu.success('导入成功')

+ 10 - 0
src/pages/Cledger/C1ledger/C1importZipRes/index.tsx

@@ -26,6 +26,8 @@ function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props)
   const [searchKey, setSearchKey] = useState('')
   const [searchKey, setSearchKey] = useState('')
   const [checkResult, setCheckResult] = useState()
   const [checkResult, setCheckResult] = useState()
   const [importLoading, setImportLoading] = useState(false)
   const [importLoading, setImportLoading] = useState(false)
+  const [pageNum, setPageNum] = useState(1)
+  const [pageSize, setPageSize] = useState(10)
   const fileInputRef = useRef<HTMLInputElement>(null)
   const fileInputRef = useRef<HTMLInputElement>(null)
 
 
   // 条件搜索
   // 条件搜索
@@ -37,6 +39,7 @@ function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props)
       return matchesSearch && matchesCheck
       return matchesSearch && matchesCheck
     })
     })
     setTableInfoData(filtered)
     setTableInfoData(filtered)
+    setPageNum(1) // 搜索/筛选变化时重置到第一页
   }, [tableInfo.img, searchKey, checkResult])
   }, [tableInfo.img, searchKey, checkResult])
 
 
   // 重新上传
   // 重新上传
@@ -137,6 +140,13 @@ function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props)
           list={tableInfoData}
           list={tableInfoData}
           columnsTemp={importZipDataTableCheckC}
           columnsTemp={importZipDataTableCheckC}
           yHeight={500}
           yHeight={500}
+          pageNum={pageNum}
+          pageSize={pageSize}
+          total={tableInfoData.length}
+          onChange={(p, s) => {
+            setPageNum(p)
+            setPageSize(s)
+          }}
         />
         />
       </div>
       </div>
       <div className={styles.TableListBottom}>
       <div className={styles.TableListBottom}>