|
@@ -1,13 +1,17 @@
|
|
|
import React, { useMemo, useState } from 'react'
|
|
import React, { useMemo, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
import styles from './index.module.scss'
|
|
|
import { useSelector } from 'react-redux'
|
|
import { useSelector } from 'react-redux'
|
|
|
-import { RootState } from '@/store'
|
|
|
|
|
|
|
+import store, { RootState } from '@/store'
|
|
|
import { openLink } from '@/utils/history'
|
|
import { openLink } from '@/utils/history'
|
|
|
import TableList from '@/pages/Zother/TableList'
|
|
import TableList from '@/pages/Zother/TableList'
|
|
|
-import { API_getFileList, API_downloadFiles, API_getFileLog } from '@/store/action/Cledger/C4file'
|
|
|
|
|
|
|
+import { API_getFileList, API_downloadFiles } from '@/store/action/Cledger/C4file'
|
|
|
import { goodsFileTableC } from '@/utils/tableData'
|
|
import { goodsFileTableC } from '@/utils/tableData'
|
|
|
-import { Button, message, Modal, Table } from 'antd'
|
|
|
|
|
|
|
+import { Button, message } from 'antd'
|
|
|
import { baseURL } from '@/utils/http'
|
|
import { baseURL } from '@/utils/http'
|
|
|
|
|
+import { FileListType } from '@/components/Z3upFiles/data'
|
|
|
|
|
+import ImageLazy from '@/components/ImageLazy'
|
|
|
|
|
+import { EyeOutlined } from '@ant-design/icons'
|
|
|
|
|
+import DownLog from '@/pages/Zother/DownLog'
|
|
|
|
|
|
|
|
const C4search = [
|
|
const C4search = [
|
|
|
{
|
|
{
|
|
@@ -32,8 +36,7 @@ function C4file() {
|
|
|
// 跨页参数
|
|
// 跨页参数
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
|
|
|
// 下载记录参数
|
|
// 下载记录参数
|
|
|
- const [isShowDownloadLog, setIsShowDownloadLog] = useState(false)
|
|
|
|
|
- const [downloadLogData, setDownloadLogData] = useState<any[]>([])
|
|
|
|
|
|
|
+ const [downLogId, setDownLogId] = useState(0)
|
|
|
// 额外参数
|
|
// 额外参数
|
|
|
const extraParams = useMemo(
|
|
const extraParams = useMemo(
|
|
|
() => ({
|
|
() => ({
|
|
@@ -90,15 +93,7 @@ function C4file() {
|
|
|
window.open(fullUrl)
|
|
window.open(fullUrl)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // 查看下载记录
|
|
|
|
|
- const downloadLogFn = async (id: number) => {
|
|
|
|
|
- const res: any = await API_getFileLog(id)
|
|
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
|
|
- setDownloadLogData(res.data)
|
|
|
|
|
- setIsShowDownloadLog(true)
|
|
|
|
|
- console.log(res.data)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
// 故事管理/藏品总账定制右侧内容
|
|
// 故事管理/藏品总账定制右侧内容
|
|
|
const storyTableListToprr = ({
|
|
const storyTableListToprr = ({
|
|
|
clickSearch,
|
|
clickSearch,
|
|
@@ -199,7 +194,7 @@ function C4file() {
|
|
|
>
|
|
>
|
|
|
下载
|
|
下载
|
|
|
</Button>
|
|
</Button>
|
|
|
- <Button size='small' type='text' onClick={() => downloadLogFn(item.id)}>
|
|
|
|
|
|
|
+ <Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
|
|
|
下载记录
|
|
下载记录
|
|
|
</Button>
|
|
</Button>
|
|
|
</>
|
|
</>
|
|
@@ -208,6 +203,64 @@ function C4file() {
|
|
|
]
|
|
]
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
+ const staBtn = useMemo(() => {
|
|
|
|
|
+ return [
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '缩略图/查看',
|
|
|
|
|
+ render: (item: FileListType) => {
|
|
|
|
|
+ if (item.type === 'img') {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className='tableImgAuto'>
|
|
|
|
|
+ <ImageLazy
|
|
|
|
|
+ width={60}
|
|
|
|
|
+ height={60}
|
|
|
|
|
+ src={item.thumb || item.filePath}
|
|
|
|
|
+ srcBig={item.filePath || item.thumb}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else if (item.type === 'video') {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className='tablelookVideo'>
|
|
|
|
|
+ <div
|
|
|
|
|
+ className='tablelookBox'
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ store.dispatch({
|
|
|
|
|
+ type: 'layout/lookDom',
|
|
|
|
|
+ payload: { src: item.filePath, type: 'video' }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ <EyeOutlined rev={undefined} />
|
|
|
|
|
+
|
|
|
|
|
+ <div>预览</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <video src={baseURL + item.filePath} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const lastNameArr = item.fileName.split('.')
|
|
|
|
|
+ let laseName = lastNameArr[lastNameArr.length - 1]
|
|
|
|
|
+ laseName = laseName.toLocaleLowerCase()
|
|
|
|
|
+ if (laseName === 'pdf') {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size='small'
|
|
|
|
|
+ type='text'
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ window.open(baseURL + item.filePath)
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 查看
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else return <div className='tableImgAuto'>-</div>
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }, [])
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.B1collect}>
|
|
<div className={styles.B1collect}>
|
|
|
<div className='pageTitle'>藏品附件</div>
|
|
<div className='pageTitle'>藏品附件</div>
|
|
@@ -226,34 +279,11 @@ function C4file() {
|
|
|
storyTableLastBtn={storyTableLastBtn}
|
|
storyTableLastBtn={storyTableLastBtn}
|
|
|
extraParams={extraParams}
|
|
extraParams={extraParams}
|
|
|
rowSelection={rowSelection}
|
|
rowSelection={rowSelection}
|
|
|
|
|
+ staBtn={staBtn}
|
|
|
/>
|
|
/>
|
|
|
- <Modal
|
|
|
|
|
- title='下载记录'
|
|
|
|
|
- open={isShowDownloadLog}
|
|
|
|
|
- onCancel={() => setIsShowDownloadLog(false)}
|
|
|
|
|
- footer={null}
|
|
|
|
|
- >
|
|
|
|
|
- <Table
|
|
|
|
|
- rowKey='id'
|
|
|
|
|
- columns={[
|
|
|
|
|
- {
|
|
|
|
|
- title: '下载人员',
|
|
|
|
|
- dataIndex: 'creatorName',
|
|
|
|
|
- key: 'creatorName'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '下载时间',
|
|
|
|
|
- dataIndex: 'createTime',
|
|
|
|
|
- key: 'createTime'
|
|
|
|
|
- }
|
|
|
|
|
- ]}
|
|
|
|
|
- dataSource={downloadLogData}
|
|
|
|
|
- pagination={{
|
|
|
|
|
- pageSize: 3,
|
|
|
|
|
- position: ['bottomCenter']
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- </Modal>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ {/* 下载记录 */}
|
|
|
|
|
+ {downLogId ? <DownLog id={downLogId} closeFu={() => setDownLogId(0)} /> : null}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|