|
@@ -4,21 +4,25 @@ import { Button } from 'antd'
|
|
|
import MyTable from '@/components/MyTable'
|
|
|
import { C4tableC } from '@/utils/tableData'
|
|
|
import MyPopconfirm from '@/components/MyPopconfirm'
|
|
|
+import { baseURL } from '@/utils/http'
|
|
|
+import B1upXLSX from '@/pages/B_enterTibet/B1collect/B1edit/B1upXLSX'
|
|
|
+import { TypeinfoXLSX } from '@/pages/B_enterTibet/B1collect/type'
|
|
|
+import C4impImg from './C4impImg'
|
|
|
|
|
|
type Props = {
|
|
|
colseFu: (flag: boolean) => void
|
|
|
}
|
|
|
|
|
|
function C4import({ colseFu }: Props) {
|
|
|
+ const [acTxt, setAcTxt] = useState('导入藏品数据')
|
|
|
+
|
|
|
const tableLastBtn = useMemo(() => {
|
|
|
return [
|
|
|
{
|
|
|
title: '导入结果',
|
|
|
render: (item: any) => (
|
|
|
<Button size='small' type='text'>
|
|
|
- <a href={item.src} download target='_blank' rel='noreferrer'>
|
|
|
- 下载
|
|
|
- </a>
|
|
|
+ 查看
|
|
|
</Button>
|
|
|
)
|
|
|
},
|
|
@@ -26,13 +30,9 @@ function C4import({ colseFu }: Props) {
|
|
|
title: '操作',
|
|
|
render: (item: any) => {
|
|
|
return (
|
|
|
- <>
|
|
|
- <MyPopconfirm txtK='导入当前合格数据' onConfirm={() => {}} />
|
|
|
- <Button size='small' type='text' onClick={() => setList([])}>
|
|
|
- 重新上传
|
|
|
- </Button>
|
|
|
- <MyPopconfirm txtK='清空数据' onConfirm={() => {}} />
|
|
|
- </>
|
|
|
+ <Button size='small' type='text' danger>
|
|
|
+ 删除记录
|
|
|
+ </Button>
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -44,20 +44,88 @@ function C4import({ colseFu }: Props) {
|
|
|
const flagRef = useRef(false)
|
|
|
// 导入合格数据之后变成true
|
|
|
|
|
|
+ const B1upXLSXRef = useRef<any>(null)
|
|
|
+
|
|
|
+ // 上传表格数据
|
|
|
+ const [infoXLSX, setInfoXLSX] = useState<TypeinfoXLSX>({
|
|
|
+ show: false,
|
|
|
+ succ: [],
|
|
|
+ err: []
|
|
|
+ })
|
|
|
+
|
|
|
// 待完善
|
|
|
return (
|
|
|
<div className={styles.C4import}>
|
|
|
<div className='C4top'>
|
|
|
<div>
|
|
|
- 一普数据<Button type='primary'>上传表格</Button>
|
|
|
- <Button>下载模板</Button>
|
|
|
- <span className='jianGe'></span>
|
|
|
- 省平台数据<Button type='primary'>上传表格</Button>
|
|
|
- <Button>下载模板</Button>
|
|
|
+ <span className='C4top11'>
|
|
|
+ {['导入藏品数据', '导入藏品图片'].map(v => (
|
|
|
+ <Button
|
|
|
+ onClick={() => setAcTxt(v)}
|
|
|
+ key={v}
|
|
|
+ type={acTxt === v ? 'primary' : 'default'}
|
|
|
+ >
|
|
|
+ {v}
|
|
|
+ </Button>
|
|
|
+ ))}
|
|
|
+ </span>
|
|
|
+ {acTxt === '导入藏品数据' ? (
|
|
|
+ <>
|
|
|
+ 一普数据{' '}
|
|
|
+ <a
|
|
|
+ href={`${baseURL}/baseData/ZP_TEMP.xlsx`}
|
|
|
+ download='一普数据模板'
|
|
|
+ target='_blank'
|
|
|
+ rel='noreferrer'
|
|
|
+ >
|
|
|
+ <Button>下载模板</Button>
|
|
|
+ </a>
|
|
|
+ <Button type='primary' onClick={() => B1upXLSXRef.current?.openUpFu('1')}>
|
|
|
+ 上传表格
|
|
|
+ </Button>
|
|
|
+ <span className='jianGe'></span>
|
|
|
+ 省平台数据{' '}
|
|
|
+ <a
|
|
|
+ href={`${baseURL}/baseData/ZP_TEMP.xlsx`}
|
|
|
+ download='省平台数据模板'
|
|
|
+ target='_blank'
|
|
|
+ rel='noreferrer'
|
|
|
+ >
|
|
|
+ <Button>下载模板</Button>
|
|
|
+ </a>
|
|
|
+ <Button type='primary' onClick={() => B1upXLSXRef.current?.openUpFu('2')}>
|
|
|
+ 上传表格
|
|
|
+ </Button>
|
|
|
+ <span className='C4tit'>每组数据最多1000条</span>
|
|
|
+ <B1upXLSX
|
|
|
+ ref={B1upXLSXRef}
|
|
|
+ closeFu={() => setInfoXLSX({ show: false, succ: [], err: [] })}
|
|
|
+ infoXLSX={infoXLSX}
|
|
|
+ upSuccFu={(succ, err) => setInfoXLSX({ show: true, succ, err })}
|
|
|
+ isZongZhang={true}
|
|
|
+ clickSuccFu={arr => {
|
|
|
+ // 导入成功
|
|
|
+ flagRef.current = true
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
<Button onClick={() => colseFu(flagRef.current)}>返回</Button>
|
|
|
</div>
|
|
|
- <MyTable list={list} columnsTemp={C4tableC} lastBtn={tableLastBtn} pagingInfo={false} />
|
|
|
+
|
|
|
+ <div hidden={acTxt !== '导入藏品数据'}>
|
|
|
+ <MyTable
|
|
|
+ classKey='C4import'
|
|
|
+ yHeight={700}
|
|
|
+ list={list}
|
|
|
+ columnsTemp={C4tableC}
|
|
|
+ lastBtn={tableLastBtn}
|
|
|
+ pagingInfo={false}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <C4impImg hidden={acTxt === '导入藏品数据'} />
|
|
|
|
|
|
{/* 表格 */}
|
|
|
</div>
|