|
|
@@ -25,8 +25,9 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
|
|
|
{
|
|
|
title: '失败原因',
|
|
|
render: (_: any, record: any) => {
|
|
|
- const isFail = record.importIsTrue === 0 || record.importIsTrue === 0
|
|
|
- const errArr = record.EError ?? record.eerror ?? []
|
|
|
+ const isFail = record.importIsTrue === 0
|
|
|
+ const errArr = record.importErrorMsg ?? record.EError ?? record.eerror ?? []
|
|
|
+ // console.log('errArr', errArr)
|
|
|
if (!isFail) return ''
|
|
|
return Array.isArray(errArr) ? (
|
|
|
<span style={{ whiteSpace: 'pre-line' }}>{errArr.join('\n')}</span>
|
|
|
@@ -52,6 +53,8 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
|
|
|
const [searchKey, setSearchKey] = useState('')
|
|
|
const [checkResult, setCheckResult] = useState()
|
|
|
const [importLoading, setImportLoading] = useState(false)
|
|
|
+ const [pageNum, setPageNum] = useState(1)
|
|
|
+ const [pageSize, setPageSize] = useState(10)
|
|
|
const fileInputRef = useRef<HTMLInputElement>(null)
|
|
|
// 条件搜索(保留 _rowKey 用于表格 key)
|
|
|
useEffect(() => {
|
|
|
@@ -67,6 +70,7 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
|
|
|
return matchesSearch && matchesCheck
|
|
|
})
|
|
|
setTableInfoData(filtered)
|
|
|
+ setPageNum(1) // 搜索/筛选变化时重置到第一页
|
|
|
}, [tableInfo.excel, searchKey, checkResult])
|
|
|
|
|
|
// 重新上传
|
|
|
@@ -101,11 +105,21 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
|
|
|
// 2. 再导入数据
|
|
|
const importId = recordRes.data.id
|
|
|
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) {
|
|
|
MessageFu.success('导入成功')
|
|
|
@@ -170,6 +184,13 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
|
|
|
yHeight={500}
|
|
|
staBtn={staBtn}
|
|
|
lastBtn={lastBtn}
|
|
|
+ pageNum={pageNum}
|
|
|
+ pageSize={pageSize}
|
|
|
+ total={tableInfoData.length}
|
|
|
+ onChange={(p, s) => {
|
|
|
+ setPageNum(p)
|
|
|
+ setPageSize(s)
|
|
|
+ }}
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={styles.TableListBottom}>
|