Browse Source

藏品详情页-藏品附件

shaogen1995 4 days ago
parent
commit
926e37fc56

+ 56 - 0
src/assets/styles/base.css

@@ -199,3 +199,59 @@ textarea {
 .ant-dropdown-menu-title-content {
   text-align: center;
 }
+.tablelookVideo {
+  display: flex;
+  justify-content: center;
+  position: relative;
+}
+.tablelookVideo .tablelookBox {
+  cursor: pointer;
+  transition: opacity 0.3s;
+  opacity: 0;
+  z-index: 10;
+  position: absolute;
+  top: 0;
+  left: 50%;
+  transform: translateX(-50%);
+  width: 60px;
+  height: 60px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 18px;
+  color: #fff;
+  background-color: rgba(0, 0, 0, 0.6);
+}
+.tablelookVideo .tablelookBox > div {
+  font-size: 14px;
+}
+.tablelookVideo .tablelookBox:hover {
+  opacity: 1;
+}
+.tablelookVideo video {
+  width: 60px;
+  height: 60px;
+  object-fit: cover;
+}
+.ant-table-wrapper .ant-table-selection,
+.ant-table-wrapper .ant-checkbox-wrapper {
+  width: 50px !important;
+}
+.ant-table-wrapper .ant-table-selection .ant-checkbox-inner,
+.ant-table-wrapper .ant-checkbox-wrapper .ant-checkbox-inner {
+  width: 24px !important;
+  height: 24px !important;
+}
+.ant-table-wrapper .ant-table-selection .ant-checkbox-inner:after,
+.ant-table-wrapper .ant-checkbox-wrapper .ant-checkbox-inner:after {
+  left: 35%;
+}
+.ant-table-wrapper .ant-table-tbody .ant-checkbox-wrapper {
+  position: relative;
+  left: -2px;
+}
+.ant-table-wrapper .ant-table-thead .ant-checkbox-indeterminate .ant-checkbox-inner:after {
+  width: 15px;
+  height: 15px;
+  left: 50%;
+}

+ 66 - 0
src/assets/styles/base.less

@@ -341,3 +341,69 @@ textarea {
 .ant-dropdown-menu-title-content {
   text-align: center;
 }
+
+// ----------表格中的视频查看
+.tablelookVideo {
+  display: flex;
+  justify-content: center;
+  position: relative;
+
+  .tablelookBox {
+    cursor: pointer;
+    transition: opacity 0.3s;
+    opacity: 0;
+    z-index: 10;
+    position: absolute;
+    top: 0;
+    left: 50%;
+    transform: translateX(-50%);
+    width: 60px;
+    height: 60px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    font-size: 18px;
+    color: #fff;
+    background-color: rgba(0, 0, 0, 0.6);
+
+    & > div {
+      font-size: 14px;
+    }
+    &:hover {
+      opacity: 1;
+    }
+  }
+  video {
+    width: 60px;
+    height: 60px;
+    object-fit: cover;
+  }
+}
+
+// -----------表格中的多选框
+.ant-table-wrapper {
+  .ant-table-selection,
+  .ant-checkbox-wrapper {
+    width: 50px !important;
+
+    .ant-checkbox-inner {
+      width: 24px !important;
+      height: 24px !important;
+    }
+    .ant-checkbox-inner:after {
+      left: 35%;
+    }
+  }
+  .ant-table-tbody .ant-checkbox-wrapper {
+    position: relative;
+    left: -2px;
+  }
+
+  .ant-table-thead .ant-checkbox-indeterminate {
+    .ant-checkbox-inner:after {
+      width: 15px;
+      height: 15px;
+      left: 50%;
+    }
+  }
+}

+ 7 - 1
src/components/MyTable/index.tsx

@@ -164,7 +164,13 @@ function MyTable({
           return tempCom
         },
 
-        custom: (item: any) => v[2]?.(item) || isNull
+        custom: (item: any) => v[2]?.(item) || isNull,
+        sizeNum: (item: any) => {
+          let txt = isNull
+          const size = item[v[2]] || ''
+          if (size) txt = (size / v[3]).toFixed(2)
+          return txt
+        }
       }
 
       return Reflect.get(obj, v[0])

+ 72 - 42
src/pages/Cledger/C4file/index.tsx

@@ -1,13 +1,17 @@
 import React, { useMemo, useState } from 'react'
 import styles from './index.module.scss'
 import { useSelector } from 'react-redux'
-import { RootState } from '@/store'
+import store, { RootState } from '@/store'
 import { openLink } from '@/utils/history'
 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 { Button, message, Modal, Table } from 'antd'
+import { Button, message } from 'antd'
 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 = [
   {
@@ -32,8 +36,7 @@ function C4file() {
   // 跨页参数
   const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
   // 下载记录参数
-  const [isShowDownloadLog, setIsShowDownloadLog] = useState(false)
-  const [downloadLogData, setDownloadLogData] = useState<any[]>([])
+  const [downLogId, setDownLogId] = useState(0)
   // 额外参数
   const extraParams = useMemo(
     () => ({
@@ -90,15 +93,7 @@ function C4file() {
       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 = ({
     clickSearch,
@@ -199,7 +194,7 @@ function C4file() {
             >
               下载
             </Button>
-            <Button size='small' type='text' onClick={() => downloadLogFn(item.id)}>
+            <Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
               下载记录
             </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} />
+                  &nbsp;
+                  <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 (
     <div className={styles.B1collect}>
       <div className='pageTitle'>藏品附件</div>
@@ -226,34 +279,11 @@ function C4file() {
         storyTableLastBtn={storyTableLastBtn}
         extraParams={extraParams}
         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>
   )
 }

+ 29 - 27
src/pages/ZgoodsInfo/GItab1/index.tsx

@@ -24,7 +24,7 @@ function GItab1({ info, fileList }: Props) {
 
   return (
     <div className={styles.GItab1}>
-      <div className='GI1left'>
+      <div className='GI1left' style={{ width: imgList.length === 0 ? '100%' : '' }}>
         {GIrowArr.map(item => (
           <div key={item.key} className={classNames('GI1Lrow', item.full ? 'GI1LrowFull' : '')}>
             <div>{item.name}</div>
@@ -32,35 +32,37 @@ function GItab1({ info, fileList }: Props) {
           </div>
         ))}
       </div>
-      <div className='GI1Right'>
-        <div className='GI1Right1'>
-          {imgAcObj ? (
-            <ImageLazy
-              width={240}
-              height={220}
-              src={imgAcObj.thumb || imgAcObj.filePath}
-              srcBig={imgAcObj.filePath || imgAcObj.thumb}
-            />
-          ) : null}
-        </div>
-        <div className='GI1Right2'>
-          {imgList.map((item, index) => (
-            <div
-              onClick={() => setImgAc(index)}
-              className={classNames('GI1Rrow', imgAc === index ? 'GI1RrowAc' : '')}
-              key={item.id}
-            >
+      {imgList.length === 0 ? null : (
+        <div className='GI1Right'>
+          <div className='GI1Right1'>
+            {imgAcObj ? (
               <ImageLazy
-                width={64}
-                height={64}
-                src={item.thumb || item.filePath}
-                srcBig={item.filePath || item.thumb}
-                noLook={true}
+                width={240}
+                height={220}
+                src={imgAcObj.thumb || imgAcObj.filePath}
+                srcBig={imgAcObj.filePath || imgAcObj.thumb}
               />
-            </div>
-          ))}
+            ) : null}
+          </div>
+          <div className='GI1Right2'>
+            {imgList.map((item, index) => (
+              <div
+                onClick={() => setImgAc(index)}
+                className={classNames('GI1Rrow', imgAc === index ? 'GI1RrowAc' : '')}
+                key={item.id}
+              >
+                <ImageLazy
+                  width={64}
+                  height={64}
+                  src={item.thumb || item.filePath}
+                  srcBig={item.filePath || item.thumb}
+                  noLook={true}
+                />
+              </div>
+            ))}
+          </div>
         </div>
-      </div>
+      )}
     </div>
   )
 }

+ 4 - 3
src/pages/ZgoodsInfo/GItab2/index.module.scss

@@ -1,7 +1,8 @@
 .GItab2 {
-  width: 100%;
-  height: 100%;
-  overflow-y: auto;
   :global {
+    h2 {
+      font-size: 18px;
+      margin-bottom: 20px;
+    }
   }
 }

+ 40 - 36
src/pages/ZgoodsInfo/GItab2/index.tsx

@@ -1,43 +1,47 @@
-import React, { useEffect } from 'react'
+import React, { useMemo } from 'react'
 import styles from './index.module.scss'
-function GItab2() {
-  useEffect(() => {
-    console.log('GItab2')
-  }, [])
+import MyTable from '@/components/MyTable'
+import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+import { selectObj } from '@/utils/dataChange'
+
+type Props = {
+  info: GoodsType
+}
+
+function GItab2({ info }: Props) {
+  // 藏品状态
+  const goodsStatus = useMemo(() => {
+    let txt = '(空)'
+    const obj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
+    if (obj) txt = obj.label
+    return txt
+  }, [info.siteStatus])
 
   return (
     <div className={styles.GItab2}>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
-      <h1>GItab2</h1>
+      {/* 待完善sg -等陈磊/伟浩写完库房相关*/}
+      <h2>库存状态:{goodsStatus}</h2>
+
+      {!info.siteStatus || [1, 2, 5].includes(info.siteStatus) || !info.storageId ? (
+        <div className='GImainNone'>当前状态无库存信息</div>
+      ) : (
+        <MyTable
+          list={[
+            { id: 1, xx1: '仓库名称', xx2: '' },
+            { id: 2, xx1: '仓库负责人', xx2: '' },
+            { id: 3, xx1: '排', xx2: '' },
+            { id: 4, xx1: '列', xx2: '' },
+            { id: 5, xx1: '层', xx2: '' },
+            { id: 6, xx1: '格', xx2: '' }
+          ]}
+          columnsTemp={[
+            ['txt', '库存信息', 'xx1'],
+            ['txt', '库存详情', 'xx2']
+          ]}
+          lastBtn={[]}
+          pagingInfo={false}
+        />
+      )}
     </div>
   )
 }

+ 10 - 3
src/pages/ZgoodsInfo/GItab3/index.module.scss

@@ -1,7 +1,14 @@
 .GItab3 {
-  width: 100%;
-  height: 100%;
-  overflow-y: auto;
   :global {
+    .GI3top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 20px;
+      & > div {
+        .ant-btn {
+          margin-right: 15px;
+        }
+      }
+    }
   }
 }

+ 211 - 34
src/pages/ZgoodsInfo/GItab3/index.tsx

@@ -1,43 +1,220 @@
-import React, { useEffect } from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
-function GItab3() {
+import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+import { FileListType } from '@/components/Z3upFiles/data'
+import { API_downloadFiles, API_getFileListByIds } from '@/store/action/Cledger/C4file'
+import { Button } from 'antd'
+import { selectObj } from '@/utils/dataChange'
+import { MessageFu } from '@/utils/message'
+import { downloadFileByUrl } from '@/utils'
+import MyTable from '@/components/MyTable'
+import ImageLazy from '@/components/ImageLazy'
+import store from '@/store'
+import { EyeOutlined } from '@ant-design/icons'
+import { baseURL } from '@/utils/http'
+import { GI3tableC } from '@/utils/tableData'
+import DownLog from '@/pages/Zother/DownLog'
+
+type Props = {
+  info: GoodsType
+  fileList: FileListType[]
+}
+
+// 待完善sg-设置模块 等后端写接口
+
+function GItab3({ info, fileList }: Props) {
+  const [list, setList] = useState<FileListType[]>([])
+
   useEffect(() => {
-    console.log('GItab3')
+    setList(fileList)
+  }, [fileList])
+
+  // 获取附件详情列表
+  const getFileListFu = useCallback(async () => {
+    const res = await API_getFileListByIds(info.fileIds.split(','))
+    if (res.code === 0) {
+      setList(res.data)
+    }
+  }, [info.fileIds])
+
+  // 附件表格对象
+  const tableObj = useMemo(() => {
+    let obj: any = {
+      all: list
+    }
+    list.forEach(v => {
+      if (obj[v.type]) obj[v.type].push(v)
+      else obj[v.type] = [v]
+    })
+
+    return obj
+  }, [list])
+
+  const [btnAc, setBtnAc] = useState('all')
+  // 多选
+  const [checkArr, setCheckArr] = useState<React.Key[]>([])
+
+  // 多选
+  const rowSelection = useMemo(
+    () => ({
+      selectedRowKeys: checkArr,
+      onChange: (selectedRowKeys: React.Key[]) => {
+        setCheckArr(selectedRowKeys)
+      }
+    }),
+    [checkArr]
+  )
+
+  // 点击批量下载
+  const downsFu = useCallback(async () => {
+    if (checkArr.length === 1) {
+      const obj = list.find(v => v.id === checkArr[0])!
+      if (obj) {
+        const res = await API_downloadFiles([obj.id])
+        if (res.code === 0) {
+          downloadFileByUrl(obj.filePath, obj.fileName, () => {
+            setCheckArr([])
+          })
+        }
+      } else {
+        MessageFu.warning('该文件已经被删除')
+        getFileListFu()
+      }
+    } else {
+      const res: any = await API_downloadFiles(checkArr as number[])
+      if (res && res.code === 0 && res.data) {
+        const path = res.data as string
+        const fullUrl = path.startsWith('http') ? path : `${baseURL}${path}`
+        window.open(fullUrl)
+        setCheckArr([])
+      }
+    }
+  }, [checkArr, getFileListFu, list])
+
+  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} />
+                  &nbsp;
+                  <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>
+          }
+        }
+      }
+    ]
   }, [])
 
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: FileListType) => (
+          <>
+            <Button
+              size='small'
+              type='text'
+              onClick={async () => {
+                const res = await API_downloadFiles([item.id])
+                if (res.code === 0) downloadFileByUrl(item.filePath, item.fileName)
+              }}
+            >
+              下载
+            </Button>
+            <Button size='small' type='text'>
+              设置
+            </Button>
+            <Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
+              下载记录
+            </Button>
+          </>
+        )
+      }
+    ]
+  }, [])
+
+  // 下载记录参数
+  const [downLogId, setDownLogId] = useState(0)
+
   return (
     <div className={styles.GItab3}>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
-      <h1>GItab3</h1>
+      <div className='GI3top'>
+        <div>
+          {[{ label: '全部', value: 'all' }, ...selectObj['附件类型']].map(v => (
+            <Button
+              key={v.value}
+              onClick={() => {
+                setBtnAc(v.value)
+                setCheckArr([])
+              }}
+              type={btnAc === v.value ? 'primary' : 'default'}
+            >
+              {v.label}
+            </Button>
+          ))}
+        </div>
+        <Button type='primary' disabled={checkArr.length === 0} onClick={downsFu}>
+          批量下载
+        </Button>
+      </div>
+
+      {/* 表格 */}
+      <MyTable
+        classKey='GItab3'
+        list={tableObj[btnAc] || []}
+        columnsTemp={GI3tableC}
+        lastBtn={tableLastBtn}
+        staBtn={staBtn}
+        pagingInfo={false}
+        rowSelection={rowSelection}
+      />
+
+      {/* 下载记录 */}
+      {downLogId ? <DownLog id={downLogId} closeFu={() => setDownLogId(0)} /> : null}
     </div>
   )
 }

+ 9 - 3
src/pages/ZgoodsInfo/index.tsx

@@ -42,7 +42,7 @@ function ZgoodsInfo() {
       // 获取附件信息
       const fileIds = res.data.fileIds || ''
       if (fileIds) {
-        const res22 = await API_getFileListByIds(fileIds.split(',').map((v: string) => Number(v)))
+        const res22 = await API_getFileListByIds(fileIds.split(','))
         if (res22.code === 0) {
           setFileList(res22.data)
         }
@@ -62,8 +62,14 @@ function ZgoodsInfo() {
         show: false,
         Dom: <GItab1 info={info} fileList={fileList} />
       },
-      { id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
-      { id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
+      { id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 info={info} /> },
+      {
+        id: 333,
+        name: '藏品附件',
+        done: false,
+        show: false,
+        Dom: <GItab3 info={info} fileList={fileList} />
+      },
       { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
       { id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
     ]

+ 21 - 0
src/pages/Zother/DownLog/index.module.scss

@@ -0,0 +1,21 @@
+.DownLog {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 800px !important;
+    }
+    .ant-modal-body {
+      padding-top: 10px !important;
+      border-top: 1px solid #ccc;
+      .ant-table-cell {
+        padding: 8px !important;
+      }
+    }
+    .DownLogBtn {
+      margin-top: 15px;
+      text-align: center;
+    }
+  }
+}

+ 57 - 0
src/pages/Zother/DownLog/index.tsx

@@ -0,0 +1,57 @@
+import React, { useCallback, useEffect, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Modal } from 'antd'
+import MyTable from '@/components/MyTable'
+import { API_getFileLog } from '@/store/action/Cledger/C4file'
+
+type listType = {
+  createTime: string
+  creatorId: number
+  creatorName: string
+  fileId: number
+  id: number
+  updateTime: string
+}
+
+type Props = {
+  id: number
+  closeFu: () => void
+}
+
+function DownLog({ closeFu, id }: Props) {
+  const [list, setList] = useState<listType[]>([])
+
+  const getList = useCallback(async () => {
+    const res = await API_getFileLog(id)
+    if (res.code === 0) {
+      setList(res.data || [])
+    }
+  }, [id])
+
+  useEffect(() => {
+    getList()
+  }, [getList])
+
+  return (
+    <Modal wrapClassName={styles.DownLog} title='下载记录' open={true} footer={[]}>
+      <MyTable
+        yHeight={500}
+        classKey='DownLog'
+        list={list}
+        columnsTemp={[
+          ['txt', '下载人员', 'creatorName'],
+          ['txt', '下载时间', 'createTime']
+        ]}
+        pagingInfo={false}
+      />
+
+      <div className='DownLogBtn'>
+        <Button onClick={closeFu}>关闭</Button>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoDownLog = React.memo(DownLog)
+
+export default MemoDownLog

+ 0 - 7
src/pages/Zother/SelectGoods/index.module.scss

@@ -61,13 +61,6 @@
         top: 15px;
         text-align: center;
       }
-      .ant-checkbox-inner {
-        width: 30px;
-        height: 30px;
-      }
-      .ant-checkbox-inner:after {
-        left: 35%;
-      }
     }
   }
 }

+ 3 - 0
src/pages/Zother/SonGoodsList/data.ts

@@ -64,6 +64,9 @@ export type GoodsType = {
   // 区分是不是 征集数据-详情还没有入数据库
   pageType?: 'clue'
   clueId: number
+
+  // 库存信息id
+  storageId: number
 }
 
 // 选择线索-----------------

+ 4 - 1
src/pages/Zother/TableList/index.tsx

@@ -36,6 +36,7 @@ type Props = {
   extraParams?: any
   // antd Table rowSelection 配置(例如跨页多选)
   rowSelection?: any
+  staBtn?: any
 }
 
 const TableList = forwardRef<any, Props>(function TableList(props, ref) {
@@ -52,7 +53,8 @@ const TableList = forwardRef<any, Props>(function TableList(props, ref) {
     storyTableLastBtn,
     storyTableListToprr,
     extraParams,
-    rowSelection
+    rowSelection,
+    staBtn
   } = props
   const dispatch = useDispatch()
 
@@ -233,6 +235,7 @@ const TableList = forwardRef<any, Props>(function TableList(props, ref) {
           yHeight={yHeight}
           list={tableInfo.list}
           columnsTemp={columnsTemp}
+          staBtn={staBtn || []}
           lastBtn={storyTableLastBtn ? storyTableLastBtn : tableLastBtn}
           pageNum={formData.pageNum}
           pageSize={formData.pageSize}

+ 25 - 0
src/utils/index.ts

@@ -1,4 +1,5 @@
 import { FileListType } from '@/components/Z3upFiles/data'
+import { baseURL } from './http'
 
 // 上传文件自动归类
 type FileObjType = {
@@ -36,3 +37,27 @@ export const fileIdsResFu = (listTemp: FileListType[]) => {
   const fileIds = [...fileImgArr, ...fileOtherArr].map(v => v.id).join(',')
   return fileIds
 }
+
+// 简化版本:通过URL下载同域文件
+export const downloadFileByUrl = async (fileUrl: string, fileName?: string, back?: () => void) => {
+  const a = document.createElement('a')
+  a.href = baseURL + fileUrl
+  a.target = '_blank'
+
+  // 设置下载文件名
+  if (fileName) {
+    a.download = fileName
+  } else {
+    // 自动从URL提取文件名
+    const urlParts = fileUrl.split('/')
+    const originalName = urlParts[urlParts.length - 1]
+    a.download = originalName || 'download'
+  }
+
+  // 触发下载
+  a.style.display = 'none'
+  document.body.appendChild(a)
+  a.click()
+  document.body.removeChild(a)
+  if (back) back()
+}

+ 11 - 2
src/utils/tableData.ts

@@ -146,13 +146,12 @@ export const warehouseSetTableC = [
 //藏品附件
 export const goodsFileTableC = [
   ['select', '附件类型', 'type', selectObj['附件类型']],
-  ['img', '缩略图', 'thumb'],
   ['txt', '附件名称', 'fileName'],
   ['txt', '藏品登记号', 'joinNum'],
   ['txt', '藏品名称', 'joinName'],
   ['dateRes', '上传日期', 'createTime'],
   ['txtC', '上传人', 'creatorName'],
-  ['txt', '文件大小', 'fileSize']
+  ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
 ]
 
 // 藏品入库
@@ -176,3 +175,13 @@ export const outStorageTableC = [
   ['txt', '发起日期', 'date'],
   ['select', '申请状态', 'status', selectObj['藏品入库申请状态']]
 ]
+
+// 待完善sg---一些字段等后端完善
+export const GI3tableC = [
+  ['select', '附件类型', 'type', selectObj['附件类型']],
+  ['txt', '附件名称', 'fileName'],
+  ['txt', '图片类型', 'xxxx'],
+  ['dateRes', '上传日期', 'createTime'],
+  ['txtC', '上传人', 'creatorName'],
+  ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
+]