lanxin 7 ساعت پیش
والد
کامیت
1a31804d8b

+ 49 - 15
src/pages/Cledger/C1ledger/C1Import/index.tsx

@@ -11,7 +11,9 @@ import {
   API_getImportResult,
   API_getImportResult,
   API_deleteImportResult,
   API_deleteImportResult,
   API_getImportExcelResult,
   API_getImportExcelResult,
-  API_deleteImportExcelResult
+  API_deleteImportExcelResult,
+  API_getFileLog,
+  API_saveFileLog
 } from '@/store/action/Cledger/C1ledger'
 } from '@/store/action/Cledger/C1ledger'
 import { importDataTableC } from '@/utils/tableData'
 import { importDataTableC } from '@/utils/tableData'
 import { Button, Radio } from 'antd'
 import { Button, Radio } from 'antd'
@@ -19,6 +21,8 @@ import { MessageFu } from '@/utils/message'
 import { baseURL } from '@/utils/http'
 import { baseURL } from '@/utils/http'
 import C1ImportRes from '../C1ImportRes'
 import C1ImportRes from '../C1ImportRes'
 import C1ImportZipRes from '../C1importZipRes'
 import C1ImportZipRes from '../C1importZipRes'
+import { downloadFileByUrl } from '@/utils'
+import DownLog from '@/pages/Zother/DownLog'
 
 
 const C1ImportBaseFormData = {
 const C1ImportBaseFormData = {
   pageNum: 1,
   pageNum: 1,
@@ -37,6 +41,8 @@ function C1Import({ onClose }: { onClose: () => void }) {
   const [isLook, setIsLook] = useState(false)
   const [isLook, setIsLook] = useState(false)
   const fileInputRef = useRef<HTMLInputElement>(null)
   const fileInputRef = useRef<HTMLInputElement>(null)
   const clickSearchRef = useRef<() => void>(() => {})
   const clickSearchRef = useRef<() => void>(() => {})
+  // 下载记录参数
+  const [downLogId, setDownLogId] = useState(0)
   const [uploadData, setUploadData] = useState<{
   const [uploadData, setUploadData] = useState<{
     visible: boolean
     visible: boolean
     result: any | null
     result: any | null
@@ -263,6 +269,23 @@ function C1Import({ onClose }: { onClose: () => void }) {
             <Button size='small' type='text' onClick={() => handleDeleteImportResult(item)}>
             <Button size='small' type='text' onClick={() => handleDeleteImportResult(item)}>
               删除记录
               删除记录
             </Button>
             </Button>
+            <br />
+            <Button
+              size='small'
+              type='text'
+              onClick={() => {
+                downloadFileByUrl(item.filePath, item.fileName)
+                API_saveFileLog({
+                  moduleIds: [item.id],
+                  moduleName: isImportData ? 'Excel导入' : '图片导入'
+                } as any)
+              }}
+            >
+              下载
+            </Button>
+            <Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
+              下载记录
+            </Button>
           </>
           </>
         )
         )
       }
       }
@@ -288,20 +311,31 @@ function C1Import({ onClose }: { onClose: () => void }) {
           />
           />
         )
         )
       ) : (
       ) : (
-        <TableList
-          key={isImportData ? 'importExcel' : 'importZip'}
-          baseFormData={C1ImportBaseFormData}
-          getListAPI={isImportData ? API_getImportExcelList : API_getImportZipList}
-          pageKey={isImportData ? 'importExcel' : 'importZip'}
-          tableInfo={isImportData ? importExcelTableInfo : importZipTableInfo}
-          columnsTemp={importDataTableC}
-          rightBtnWidth={'100%'}
-          leftRowWidth={'20%'}
-          yHeight={592}
-          searchDom={[]}
-          storyTableListToprr={storyTableListToprr}
-          storyTableLastBtn={storyTableLastBtn}
-        />
+        <>
+          <TableList
+            key={isImportData ? 'importExcel' : 'importZip'}
+            baseFormData={C1ImportBaseFormData}
+            getListAPI={isImportData ? API_getImportExcelList : API_getImportZipList}
+            pageKey={isImportData ? 'importExcel' : 'importZip'}
+            tableInfo={isImportData ? importExcelTableInfo : importZipTableInfo}
+            columnsTemp={importDataTableC}
+            rightBtnWidth={'100%'}
+            leftRowWidth={'20%'}
+            yHeight={592}
+            searchDom={[]}
+            storyTableListToprr={storyTableListToprr}
+            storyTableLastBtn={storyTableLastBtn}
+          />
+          {/* 下载记录 */}
+          {downLogId ? (
+            <DownLog
+              id={downLogId}
+              moduleName={isImportData ? 'Excel导入' : '图片导入'}
+              getListAPI={API_getFileLog as any}
+              closeFu={() => setDownLogId(0)}
+            />
+          ) : null}
+        </>
       )}
       )}
     </div>
     </div>
   )
   )

+ 10 - 1
src/pages/Cledger/C1ledger/C1ImportRes/index.tsx

@@ -4,7 +4,11 @@ import { importDataTableCheckC } from '@/utils/tableData'
 import { selectObj } from '@/utils/dataChange'
 import { selectObj } from '@/utils/dataChange'
 import MyTable from '@/components/MyTable'
 import MyTable from '@/components/MyTable'
 import { Input, Select, Button } from 'antd'
 import { Input, Select, Button } from 'antd'
-import { API_addImportExcel, API_addImportExcelRecord } from '@/store/action/Cledger/C1ledger'
+import {
+  API_addImportExcel,
+  API_addImportExcelRecord,
+  API_saveFileLog
+} from '@/store/action/Cledger/C1ledger'
 import { MessageFu } from '@/utils/message'
 import { MessageFu } from '@/utils/message'
 
 
 type Props = {
 type Props = {
@@ -122,6 +126,11 @@ function C1ImportRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
           })
           })
         )
         )
         if (res?.code === 0) {
         if (res?.code === 0) {
+          // 3. 保存下载记录
+          // await API_saveFileLog({
+          //   moduleIds: [importId],
+          //   moduleName: 'Excel导入'
+          // } as any)
           MessageFu.success('导入成功')
           MessageFu.success('导入成功')
           onClose()
           onClose()
         } else {
         } else {

+ 6 - 1
src/pages/Cledger/C1ledger/C1importZipRes/index.tsx

@@ -15,7 +15,7 @@ type Props = {
 }
 }
 
 
 function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
 function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props) {
-  console.log('tableInfo', tableInfo)
+  // console.log('tableInfo', tableInfo)
   const successCount = useMemo(() => {
   const successCount = useMemo(() => {
     return tableInfo.pcsSuccess ?? tableInfo.img.filter((item: any) => item.isTrue === 1).length
     return tableInfo.pcsSuccess ?? tableInfo.img.filter((item: any) => item.isTrue === 1).length
   }, [tableInfo.img, tableInfo.pcsSuccess])
   }, [tableInfo.img, tableInfo.pcsSuccess])
@@ -87,6 +87,11 @@ function C1ImportZipRes({ onClose, tableInfo, uploadFu, isLook = false }: Props)
         }))
         }))
         const res: any = await API_addImportZip(payload as any)
         const res: any = await API_addImportZip(payload as any)
         if (res?.code === 0) {
         if (res?.code === 0) {
+          // 3. 保存下载记录
+          // await API_saveFileLog({
+          //   moduleIds: [importId],
+          //   moduleName: '图片导入'
+          // } as any)
           MessageFu.success('导入成功')
           MessageFu.success('导入成功')
           onClose()
           onClose()
         } else {
         } else {

+ 5 - 2
src/pages/Cledger/C4file/index.tsx

@@ -7,7 +7,8 @@ import TableList from '@/pages/Zother/TableList'
 import {
 import {
   API_getFileList,
   API_getFileList,
   API_downloadFiles,
   API_downloadFiles,
-  API_getFileInfoByid
+  API_getFileInfoByid,
+  API_getFileLog
 } from '@/store/action/Cledger/C4file'
 } from '@/store/action/Cledger/C4file'
 import { goodsFileTableC } from '@/utils/tableData'
 import { goodsFileTableC } from '@/utils/tableData'
 import { Button, message } from 'antd'
 import { Button, message } from 'antd'
@@ -332,7 +333,9 @@ function C4file() {
       />
       />
 
 
       {/* 下载记录 */}
       {/* 下载记录 */}
-      {downLogId ? <DownLog id={downLogId} closeFu={() => setDownLogId(0)} /> : null}
+      {downLogId ? (
+        <DownLog id={downLogId} getListAPI={API_getFileLog} closeFu={() => setDownLogId(0)} />
+      ) : null}
     </div>
     </div>
   )
   )
 }
 }

+ 14 - 6
src/pages/Zother/DownLog/index.tsx

@@ -3,7 +3,6 @@ import styles from './index.module.scss'
 import { Button, Modal } from 'antd'
 import { Button, Modal } from 'antd'
 import MyTable from '@/components/MyTable'
 import MyTable from '@/components/MyTable'
 import { API_getFileLog } from '@/store/action/Cledger/C4file'
 import { API_getFileLog } from '@/store/action/Cledger/C4file'
-
 type listType = {
 type listType = {
   createTime: string
   createTime: string
   creatorId: number
   creatorId: number
@@ -15,18 +14,27 @@ type listType = {
 
 
 type Props = {
 type Props = {
   id: number
   id: number
+  moduleName?: string
   closeFu: () => void
   closeFu: () => void
+  getListAPI?: (args: any) => Promise<any>
 }
 }
 
 
-function DownLog({ closeFu, id }: Props) {
+function DownLog({ closeFu, id, moduleName, getListAPI = API_getFileLog }: Props) {
   const [list, setList] = useState<listType[]>([])
   const [list, setList] = useState<listType[]>([])
 
 
   const getList = useCallback(async () => {
   const getList = useCallback(async () => {
-    const res = await API_getFileLog(id)
-    if (res.code === 0) {
-      setList(res.data || [])
+    if (moduleName) {
+      const res = await getListAPI({ moduleIds: [id], moduleName })
+      if (res.code === 0) {
+        setList(res.data || [])
+      }
+    } else {
+      const res = await getListAPI(id)
+      if (res.code === 0) {
+        setList(res.data || [])
+      }
     }
     }
-  }, [id])
+  }, [getListAPI, id, moduleName])
 
 
   useEffect(() => {
   useEffect(() => {
     getList()
     getList()

+ 14 - 0
src/store/action/Cledger/C1ledger.ts

@@ -203,6 +203,20 @@ export const API_getGoodsByGoodId = (data: GetGoodsByGoodIdReq) => {
   return http.post(`cms/good/ledger/file`, data)
   return http.post(`cms/good/ledger/file`, data)
 }
 }
 
 
+/**
+ * 藏品总账-导入数据-保存下载记录
+ */
+export const API_saveFileLog = (data: any): any => {
+  return http.post(`cms/fileLog/saveEntity`, data)
+}
+
+/**
+ * 藏品总账-导入数据-查看下载记录
+ */
+export const API_getFileLog = (data: any): any => {
+  return http.post(`cms/fileLog/findByModuleId`, data)
+}
+
 // ----------------故事模块-----------
 // ----------------故事模块-----------
 /**
 /**
  * 故事-新增
  * 故事-新增