|
@@ -6,7 +6,7 @@ import { API_downloadFiles, API_getFileListByIds } from '@/store/action/Cledger/
|
|
|
import { Button } from 'antd'
|
|
import { Button } from 'antd'
|
|
|
import { selectObj } from '@/utils/dataChange'
|
|
import { selectObj } from '@/utils/dataChange'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
import { MessageFu } from '@/utils/message'
|
|
|
-import { downloadFileByUrl } from '@/utils'
|
|
|
|
|
|
|
+import { downloadFileByUrl, fileImgArr } from '@/utils'
|
|
|
import MyTable from '@/components/MyTable'
|
|
import MyTable from '@/components/MyTable'
|
|
|
import ImageLazy from '@/components/ImageLazy'
|
|
import ImageLazy from '@/components/ImageLazy'
|
|
|
import store from '@/store'
|
|
import store from '@/store'
|
|
@@ -14,14 +14,13 @@ import { EyeOutlined } from '@ant-design/icons'
|
|
|
import { baseURL } from '@/utils/http'
|
|
import { baseURL } from '@/utils/http'
|
|
|
import { GI3tableC } from '@/utils/tableData'
|
|
import { GI3tableC } from '@/utils/tableData'
|
|
|
import DownLog from '@/pages/Zother/DownLog'
|
|
import DownLog from '@/pages/Zother/DownLog'
|
|
|
|
|
+import SetFileType from '@/pages/Zother/SetFileType'
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
info: GoodsType
|
|
info: GoodsType
|
|
|
fileList: FileListType[]
|
|
fileList: FileListType[]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 待完善sg-设置模块 等后端写接口
|
|
|
|
|
-
|
|
|
|
|
function GItab3({ info, fileList }: Props) {
|
|
function GItab3({ info, fileList }: Props) {
|
|
|
const [list, setList] = useState<FileListType[]>([])
|
|
const [list, setList] = useState<FileListType[]>([])
|
|
|
|
|
|
|
@@ -77,7 +76,7 @@ function GItab3({ info, fileList }: Props) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- MessageFu.warning('该文件已经被删除')
|
|
|
|
|
|
|
+ MessageFu.warning('找不到文件或已被删除')
|
|
|
getFileListFu()
|
|
getFileListFu()
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -92,62 +91,79 @@ function GItab3({ info, fileList }: Props) {
|
|
|
}, [checkArr, getFileListFu, list])
|
|
}, [checkArr, getFileListFu, list])
|
|
|
|
|
|
|
|
const staBtn = useMemo(() => {
|
|
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}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ let arr: any[] = []
|
|
|
|
|
+
|
|
|
|
|
+ arr.push({
|
|
|
|
|
+ title: '缩略图/查看',
|
|
|
|
|
+ render: (item: FileListType) => {
|
|
|
|
|
+ const lastNameArr = item.fileName.split('.')
|
|
|
|
|
+ let lastName = lastNameArr[lastNameArr.length - 1]
|
|
|
|
|
+ lastName = lastName.toLocaleLowerCase()
|
|
|
|
|
+
|
|
|
|
|
+ if (fileImgArr.includes(lastName)) {
|
|
|
|
|
+ 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>
|
|
</div>
|
|
|
- )
|
|
|
|
|
- } else if (item.type === 'video') {
|
|
|
|
|
|
|
+ <video src={baseURL + item.filePath} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const lastNameArr = item.fileName.split('.')
|
|
|
|
|
+ let laseName = lastNameArr[lastNameArr.length - 1]
|
|
|
|
|
+ laseName = laseName.toLocaleLowerCase()
|
|
|
|
|
+ if (['pdf', 'txt'].includes(laseName)) {
|
|
|
return (
|
|
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>
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size='small'
|
|
|
|
|
+ type='text'
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ window.open(baseURL + item.filePath)
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 查看
|
|
|
|
|
+ </Button>
|
|
|
)
|
|
)
|
|
|
- } 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>
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } else return <div className='tableImgAuto'>-</div>
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- ]
|
|
|
|
|
- }, [])
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if (['all', 'img'].includes(btnAc)) {
|
|
|
|
|
+ arr.push({
|
|
|
|
|
+ title: '图片类型',
|
|
|
|
|
+ render: (item: FileListType) => {
|
|
|
|
|
+ let txt = '/'
|
|
|
|
|
+ if (item.type === 'img') txt = item.effect || '(空)'
|
|
|
|
|
+ return txt
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return arr
|
|
|
|
|
+ }, [btnAc])
|
|
|
|
|
|
|
|
const tableLastBtn = useMemo(() => {
|
|
const tableLastBtn = useMemo(() => {
|
|
|
return [
|
|
return [
|
|
@@ -165,7 +181,7 @@ function GItab3({ info, fileList }: Props) {
|
|
|
>
|
|
>
|
|
|
下载
|
|
下载
|
|
|
</Button>
|
|
</Button>
|
|
|
- <Button size='small' type='text' onClick={() => MessageFu.warning('开发中')}>
|
|
|
|
|
|
|
+ <Button size='small' type='text' onClick={() => setFileType(item)}>
|
|
|
设置
|
|
设置
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
|
|
<Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
|
|
@@ -180,6 +196,9 @@ function GItab3({ info, fileList }: Props) {
|
|
|
// 下载记录参数
|
|
// 下载记录参数
|
|
|
const [downLogId, setDownLogId] = useState(0)
|
|
const [downLogId, setDownLogId] = useState(0)
|
|
|
|
|
|
|
|
|
|
+ // 设置附件
|
|
|
|
|
+ const [fileType, setFileType] = useState({} as FileListType)
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.GItab3}>
|
|
<div className={styles.GItab3}>
|
|
|
<div className='GI3top'>
|
|
<div className='GI3top'>
|
|
@@ -216,6 +235,15 @@ function GItab3({ info, fileList }: Props) {
|
|
|
|
|
|
|
|
{/* 下载记录 */}
|
|
{/* 下载记录 */}
|
|
|
{downLogId ? <DownLog id={downLogId} closeFu={() => setDownLogId(0)} /> : null}
|
|
{downLogId ? <DownLog id={downLogId} closeFu={() => setDownLogId(0)} /> : null}
|
|
|
|
|
+
|
|
|
|
|
+ {/* 设置附件类型 */}
|
|
|
|
|
+ {fileType.id ? (
|
|
|
|
|
+ <SetFileType
|
|
|
|
|
+ infoTemp={fileType}
|
|
|
|
|
+ succFu={getFileListFu}
|
|
|
|
|
+ closeFu={() => setFileType({} as FileListType)}
|
|
|
|
|
+ />
|
|
|
|
|
+ ) : null}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|