shaogen1995 1 день назад
Родитель
Сommit
cb7b7b9d12

+ 0 - 3
src/components/MyTable/index.module.scss

@@ -1,9 +1,6 @@
 .MyTable {
   :global {
     .ant-table-body {
-      overflow-y: auto !important;
-      overflow-y: overlay !important;
-
       .ant-table-row {
         .ant-table-cell {
           padding: 10px;

+ 17 - 74
src/components/MyTable/index.tsx

@@ -8,10 +8,9 @@ import React, {
   useState
 } from 'react'
 import styles from './index.module.scss'
-import { DatePicker, Form, FormInstance, Input, Table, TableProps } from 'antd'
+import { Form, FormInstance, Table, TableProps } from 'antd'
 import ImageLazy from '../ImageLazy'
 import classNames from 'classnames'
-import { resJiLianFu } from '@/utils/history'
 import { baseURL } from '@/utils/http'
 import dayjs from 'dayjs'
 import { tablePingFu } from '@/pages/A1check/A1ledger/data'
@@ -40,30 +39,13 @@ interface MyTableProps extends Omit<TableProps, 'onChange'> {
   readOnly?: boolean
   // 没有数据的时候展示
   emptyText?: boolean
+  scrollX?: number
 }
 
 export interface MyTableMethods {
   form: FormInstance<any>
 }
 
-export const myTableTransferSize = (item: any) => {
-  let danWei = isNaN(item.sizeUnit) ? item.sizeUnit : resJiLianFu(item.sizeUnit, ' ')
-
-  let txt1 = item.sizeL ? `通长${item.sizeL}` : ''
-  let txt2 = item.sizeW ? `通宽${item.sizeW}` : ''
-  let txt3 = item.sizeH ? `通高${item.sizeH}` : ''
-
-  txt1 = txt1 ? txt1 + danWei : ''
-  txt2 = txt2 ? txt2 + danWei : ''
-  txt3 = txt3 ? txt3 + danWei : ''
-
-  let arr = [txt1, txt2, txt3]
-  arr = arr.filter(v => v)
-
-  if (!txt1 && !txt2 && !txt3) return '(空)'
-  else return arr.join(' - ')
-}
-
 export const getDesensitizeTxt = (txt: string, frontLen = 3, endLen = 4) => {
   if (!txt) return txt
   const totalVisible = frontLen + endLen
@@ -102,6 +84,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
       rowKey = 'id',
       readOnly,
       emptyText,
+      scrollX,
       ...rest
     },
     ref
@@ -168,6 +151,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
 
         const obj = {
           index: (_: any, __: any, index: number) => index + 1 + (pageNum - 1) * pageSize,
+          txt2: (item: any) => item[v[2]] || isNull,
           txt: (item: any) =>
             v[3] && !item[v[2]] ? (
               <div dangerouslySetInnerHTML={{ __html: v[3] }}></div>
@@ -186,13 +170,6 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
             let res = item[v[2]] ? dayjs(item[v[2]]).format('YYYY-MM-DD') : isNull
             return res
           },
-          // 多个字段拼接
-          ping: (item: any) => (item[v[2]] || '') + (resJiLianFu(item[v[3]]) || '') || isNull,
-          // 这个模块特有的级联控制
-          txtC: (item: any) =>
-            v[1] === '年代' && item[v[2]] === '其他' ? '其他' : resJiLianFu(item[v[2]]),
-          // 尺寸
-          size: myTableTransferSize,
           img: (item: any) =>
             v[3] && !item[v[2]] ? (
               <div dangerouslySetInnerHTML={{ __html: v[3] }}></div>
@@ -207,15 +184,6 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
                 />
               </div>
             ),
-          // 附件大小
-          fileSize: (item: any) => {
-            if (item[v[2]]) {
-              const resTxt = (item[v[2]] / 1024).toFixed(2)
-              if (resTxt === '0.00') return '0.01'
-              else return resTxt
-            } else return isNull
-          },
-          txtChange: (item: any) => Reflect.get(v[3], item[v[2]]) || v[4] || isNull,
           text: (item: any) => {
             let tempCom: any = item[v[2]] || isNull
 
@@ -235,57 +203,32 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
 
             return tempCom
           },
-          input: (item: any) => {
-            return (
-              <Form.Item noStyle name={`${item.id}-${v[2]}`}>
-                <Input
-                  allowClear
-                  readOnly={readOnly}
-                  maxLength={v[3]?.maxLength}
-                  placeholder={v[3]?.placeholder || '请输入'}
-                />
-              </Form.Item>
-            )
-          },
-          datePicker: (item: any) => {
-            return (
-              <Form.Item noStyle name={`${item.id}-${v[2]}`}>
-                <DatePicker disabled={readOnly} {...(v[3] || {})} />
-              </Form.Item>
-            )
-          },
-          custom: (item: any) => {
-            return (
-              <Form.Item noStyle name={`${item.id}-${v[2]}`}>
-                {v[3].render(readOnly)}
-              </Form.Item>
-            )
-          },
-          desensitize: (item: any) => {
-            const txt = item[v[2]]
-            if (!txt) return isNull
-            const frontLen = v[3]?.frontLen || 3
-            const endLen = v[3]?.endLen || 4
 
-            return getDesensitizeTxt(txt, frontLen, endLen)
-          },
           // 年代和质地需要拼接
           tablePing: (item: any) => {
-            const txt = tablePingFu(item, v[2])
+            const txt = tablePingFu(item, v[1])
             return txt
           }
         }
 
         return Reflect.get(obj, v[0])
       },
-      [isNull, pageNum, pageSize, readOnly, tableComObj]
+      [isNull, pageNum, pageSize, tableComObj]
     )
 
     const columns = useMemo(() => {
       const arr: any = columnsTemp.map((v: any) => ({
         title: myTitle && v.includes(myTitle.name) ? myTitle.Com : v[1],
+        fixed: typeof v[v.length - 1] === 'number' ? 'left' : '',
         render: dataChangeFu(v),
-        width: widthSet && Reflect.get(widthSet, v[2]) ? Reflect.get(widthSet, v[2]) : 'auto',
+        width:
+          widthSet && Reflect.get(widthSet, v[2])
+            ? Reflect.get(widthSet, v[2])
+            : scrollX
+              ? typeof v[v.length - 1] === 'number'
+                ? v[v.length - 1]
+                : scrollX
+              : 'auto',
         onCell:
           merge && v.includes(merge.type)
             ? // {rowSpan:3}
@@ -296,7 +239,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
       }))
 
       return arr
-    }, [columnsTemp, dataChangeFu, merge, myTitle, widthSet])
+    }, [columnsTemp, dataChangeFu, merge, myTitle, scrollX, widthSet])
 
     useImperativeHandle(ref, () => ({
       form
@@ -321,7 +264,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
             `${styles.MyTable} MyTable${classKey}`,
             emptyText ? styles.MyTableNull : ''
           )}
-          scroll={{ y: yHeight ? yHeight : '' }}
+          scroll={{ y: yHeight ? yHeight : '', x: 'max-content' }}
           dataSource={list}
           columns={[...startBtn, ...columns, ...lastBtn]}
           rowKey={rowKey}

+ 0 - 1
src/pages/A1check/A1ledger/data.ts

@@ -1,7 +1,6 @@
 import { GoodsType } from '@/pages/AAnew/data'
 import { resDictStr } from '@/utils/select'
 
-// 待完善
 export const A1topArr = [
   {
     key: 'numName',

+ 3 - 5
src/pages/A1check/A1ledger/index.module.scss

@@ -3,9 +3,7 @@
   border-radius: 10px;
   padding: 15px 24px 0;
   position: relative;
-  :global {
-    .A1table {
-      padding-top: 15px;
-    }
-  }
+  // :global {
+
+  // }
 }

+ 24 - 59
src/pages/A1check/A1ledger/index.tsx

@@ -1,4 +1,4 @@
-import React, { useCallback, useMemo, useRef } from 'react'
+import React, { useMemo, useRef } from 'react'
 import styles from './index.module.scss'
 import TopSearch from '@/pages/ZcomPage/TopSearch'
 import { A1tableType, A1topArr } from './data'
@@ -6,8 +6,10 @@ import AAbtn from '@/pages/ZcomPage/AAbtn'
 import { MessageFu } from '@/utils/message'
 import { Button } from 'antd'
 import { downloadFileByUrl, openLink } from '@/utils/history'
-import { API_upFile } from '@/store/action/layout'
-import { fileDomInitialFu } from '@/utils/domShow'
+import { A1_APIgetList } from '@/store/action/A1check/A1ledger'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import UpBtn from '@/pages/ZcomPage/UpBtn'
 
 function A1ledger() {
   // --------------右侧按钮
@@ -20,7 +22,12 @@ function A1ledger() {
           onClick={() => downloadFileByUrl('./myData/xlsx/盘点基准-一普文物信息.xlsx')}
           tit='下载模板'
         />
-        <AAbtn txt={1} onClick={() => myInput.current?.click()} tit='导入数据' />
+        <UpBtn
+          tit='导入数据'
+          url='cms/importLedger/uploadExcel'
+          backFu={() => topDomRef.current.clickReset()}
+        />
+
         <AAbtn txt={1} onClick={() => topDomRef.current.clickSearch()} tit='查询' />
         <AAbtn txt={2} onClick={() => topDomRef.current.clickReset()} />
       </>
@@ -29,60 +36,14 @@ function A1ledger() {
 
   const topDomRef = useRef<any>(null)
 
-  const myInput = useRef<HTMLInputElement>(null)
-
-  // 上传文件
-  const handeUpPhoto = useCallback(async (e: React.ChangeEvent<HTMLInputElement>) => {
-    if (e.target.files) {
-      // 拿到files信息
-      const filesInfo = e.target.files[0]
-
-      let fileNmae: string = filesInfo.name
-      fileNmae = fileNmae.toLowerCase()
-
-      // 校验格式
-      if (!fileNmae.endsWith('.xlsx')) {
-        e.target.value = ''
-        return MessageFu.warning(`只支持.xlsx格式!`)
-      }
-      const fd = new FormData()
-
-      fd.append('file', filesInfo)
-      fd.append('type', 'doc')
-      fd.append('dirCode', 'A1ledger')
-      fd.append('isDb', 'true')
-
-      // 开启压缩图片
-      fd.append('isCompress', 'true')
-
-      e.target.value = ''
-
-      try {
-        const res = await API_upFile(fd, 'cms/importLedger/uploadExcel')
-        if (res.code === 0) {
-          MessageFu.success(res.data.msg)
-          topDomRef.current.clickReset()
-        }
-        fileDomInitialFu()
-      } catch (error) {
-        fileDomInitialFu()
-      }
-    }
-  }, [])
+  const tableInfo = useSelector((state: RootState) => state.A1ledger.tableInfo)
 
   return (
     <div className={styles.A1ledger}>
-      <input
-        id='upInput'
-        type='file'
-        accept='.xlsx'
-        ref={myInput}
-        onChange={e => handeUpPhoto(e)}
-      />
-
       <div className='pageTitle'>
         盘库总账
         <AAbtn
+          // 待完善
           txt={3}
           txtArr={['该操作将清空藏品盘点所有相关数据,请谨慎操作', '清空数据']}
           onClick={() => {}}
@@ -97,25 +58,29 @@ function A1ledger() {
         rightBtn={rightBtn}
         waiWidth={490}
         sonWidth='13.3%'
+        getListAPI={A1_APIgetList}
+        tableInfo={tableInfo}
         columnsTemp={[
-          ['txt', '序号', '待完善'],
-          ['txt', '编号类型', 'numName'],
-          ['txt', '编号', 'num'],
-          ['txt', '名称', 'name'],
+          ['index', '序号', 100],
+          ['txt2', '编号类型', 'numName', 150],
+          ['txt2', '编号', 'num', 150],
+          ['txt2', '名称', 'name', 150],
           ['txt', '原名', 'namePrimitive'],
           ['tablePing', '年代'],
           ['txt', '类别', 'type'],
           ['tablePing', '质地'],
           ['txt', '完残状况', 'torn'],
-          ['txt', '数量', 'pcs'],
+          ['txt', '数量', 'pcsRegister'],
           ['txt', '级别', 'level'],
           ['txt', '来源', 'source'],
-          ['txt', '创建时间', '待完善'],
-          ['txt', '创建用户', '待完善']
+          ['txt', '创建时间', 'createTime'],
+          ['txt', '创建用户', 'creatorName']
         ]}
         tableLastBtn={[
           {
             title: '操作',
+            fixed: 'right',
+            width: 100,
             render: (item: A1tableType) => {
               return (
                 <Button size='small' type='text' onClick={() => openLink(`/goodsLook/${item.id}`)}>

+ 5 - 0
src/pages/A1check/A2manage/A2tab1/index.module.scss

@@ -0,0 +1,5 @@
+.A2tab1 {
+  margin-top: 20px;
+  // :global {
+  // }
+}

+ 92 - 0
src/pages/A1check/A2manage/A2tab1/index.tsx

@@ -0,0 +1,92 @@
+import React, { useCallback, useEffect, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A2_APIgetList1 } from '@/store/action/A1check/A2manage'
+
+import { forwardRef, useImperativeHandle } from 'react'
+import MyTable from '@/components/MyTable'
+import { RootState } from '@/store'
+import { Button } from 'antd'
+
+function A2tab1(_: any, ref: any) {
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState<any>({ pageNum: 1, pageSize: 10 })
+
+  const getList1 = useCallback(() => {
+    dispatch(A2_APIgetList1(formData))
+  }, [dispatch, formData])
+
+  useEffect(() => {
+    getList1()
+  }, [getList1])
+
+  // 点击重置
+  const clickReset = useCallback(() => {
+    setFormData({ pageNum: 1, pageSize: 10 })
+  }, [])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+    },
+    [formData]
+  )
+
+  // 可以让父组件调用子组件的方法
+  useImperativeHandle(ref, () => ({
+    clickReset
+  }))
+
+  const tableInfo = useSelector((state: RootState) => state.A2manage.tableInfo1)
+
+  return (
+    <div className={styles.A2tab1}>
+      <MyTable
+        scrollX={150}
+        yHeight={675}
+        list={tableInfo.list || []}
+        columnsTemp={[
+          ['txt2', '盘点名称', 'name', 150],
+          ['txt2', '盘点说明', 'remark', 200],
+          ['txt', '登记馆藏文物总数', '待完善'],
+          ['txt', '账物相符总数', '待完善'],
+          ['txt', '账物不符总数', '待完善'],
+          ['txt', '账物待议总数', '待完善'],
+          ['txt', '经办人', 'handler'],
+          ['txt', '负责人', 'owner'],
+          ['txt', '创建时间', 'createTime'],
+          ['txt', '创建人', 'creatorName'],
+          ['txt', '生效状态', '待完善']
+        ]}
+        lastBtn={[
+          {
+            title: '操作',
+            fixed: 'right',
+            width: 100,
+            render: (item: any) => {
+              return (
+                <Button
+                  size='small'
+                  type='text'
+                  onClick={() => {
+                    console.log('待完善')
+                  }}
+                >
+                  查看
+                </Button>
+              )
+            }
+          }
+        ]}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
+    </div>
+  )
+}
+
+export default forwardRef(A2tab1)

+ 56 - 0
src/pages/A1check/A2manage/data.ts

@@ -0,0 +1,56 @@
+import { resDictStr } from '@/utils/select'
+
+export const A2topArr = [
+  {
+    key: 'numName',
+    placeholder: '编号类型',
+    type: 'Select',
+    options: resDictStr('编号类型')
+  },
+  {
+    key: 'num',
+    placeholder: '请输入编号',
+    type: 'Input'
+  },
+  {
+    key: 'name',
+    placeholder: '请搜索名称或原名',
+    type: 'Input'
+  },
+  {
+    key: 'level',
+    placeholder: '级别',
+    type: 'Select',
+    options: resDictStr('文物级别')
+  },
+  {
+    key: 'type',
+    placeholder: '类别',
+    type: 'Select',
+    options: resDictStr('类别')
+  },
+  {
+    key: '待完善1',
+    placeholder: '相符情况',
+    type: 'Select',
+    options: resDictStr('相符情况')
+  },
+  {
+    key: '待完善2',
+    placeholder: '不符情况',
+    type: 'Select',
+    options: resDictStr('不符情况')
+  },
+  {
+    key: '待完善3',
+    placeholder: '不符原因',
+    type: 'Select',
+    options: resDictStr('不符原因')
+  },
+  {
+    key: '待完善4',
+    placeholder: '生效状态',
+    type: 'Select',
+    options: resDictStr('生效状态')
+  }
+]

+ 17 - 0
src/pages/A1check/A2manage/index.module.scss

@@ -1,4 +1,21 @@
 .A2manage {
+  background-color: #fcf9f5;
+  border-radius: 10px;
+  padding: 15px 24px 0;
+  position: relative;
   :global {
+    .A2top {
+      display: flex;
+      justify-content: space-between;
+      & > div {
+        display: flex;
+        #AAbtn {
+          margin-left: 10px;
+        }
+      }
+    }
+    #TopSearch {
+      margin-top: 15px;
+    }
   }
 }

+ 109 - 2
src/pages/A1check/A2manage/index.tsx

@@ -1,9 +1,116 @@
-import React from 'react'
+import React, { useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { Button } from 'antd'
+import AAbtn from '@/pages/ZcomPage/AAbtn'
+import { downloadFileByUrl, openLink } from '@/utils/history'
+import UpBtn from '@/pages/ZcomPage/UpBtn'
+import A2tab1 from './A2tab1'
+import TopSearch from '@/pages/ZcomPage/TopSearch'
+import { A2topArr } from './data'
+import { A2_APIgetList2 } from '@/store/action/A1check/A2manage'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+
+const tabArr = ['按盘点批次', '按藏品明细']
+
 function A2manage() {
+  const [tabAc, setTabAc] = useState('按盘点批次')
+
+  const tab1Ref = useRef<any>(null)
+  const tab2Ref = useRef<any>(null)
+
+  const tableInfo = useSelector((state: RootState) => state.A2manage.tableInfo2)
+
   return (
     <div className={styles.A2manage}>
-      <h1>A2manage</h1>
+      <div className='pageTitle'>盘库管理</div>
+
+      <div className='A2top'>
+        <div>
+          {tabArr.map(item => (
+            <Button
+              onClick={() => setTabAc(item)}
+              type={tabAc === item ? 'primary' : 'default'}
+              size='large'
+              key={item}
+            >
+              {item}
+            </Button>
+          ))}
+        </div>
+        <div>
+          <AAbtn
+            txt={1}
+            onClick={() => downloadFileByUrl('./myData/xlsx/实盘数据-导入.xlsx')}
+            tit='下载模板'
+          />
+          <UpBtn
+            tit='导入盘点结果'
+            url='cms/importFirm/uploadExcel'
+            width={120}
+            backFu={() => {
+              if (tabAc === '按盘点批次') tab1Ref.current.clickReset()
+              else if (tabAc === '按藏品明细') tab2Ref.current.clickReset()
+            }}
+          />
+        </div>
+      </div>
+
+      {tabAc === '按盘点批次' ? <A2tab1 ref={tab1Ref} /> : null}
+
+      {tabAc === '按藏品明细' ? (
+        <TopSearch
+          yHeight={593}
+          ref={tab2Ref}
+          leftArr={A2topArr}
+          rightBtn={
+            <>
+              <AAbtn txt={1} onClick={() => tab2Ref.current.clickSearch()} tit='查询' />
+              <AAbtn txt={2} onClick={() => tab2Ref.current.clickReset()} />
+            </>
+          }
+          waiWidth={200}
+          sonWidth='10.4%'
+          getListAPI={A2_APIgetList2}
+          tableInfo={tableInfo}
+          columnsTemp={[
+            ['index', '序号', 100],
+            ['txt2', '编号类型', 'numName', 150],
+            ['txt2', '编号', 'num', 150],
+            ['txt2', '名称', 'name', 150],
+            ['txt', '级别', 'level'],
+            ['txt', '类别', 'type'],
+            ['txt', '藏品总登记账具体数量(件)', '待完善'],
+            ['txt', '账物相符(件)', '待完善'],
+            ['txt', '账物不符(件)', '待完善'],
+            ['txt', '不符情况', '待完善'],
+            ['txt', '不符原因', '待完善'],
+            ['txt', '备注', '待完善'],
+            ['txt', '盘点名称', '待完善'],
+            ['txt', '经办人', '待完善'],
+            ['txt', '负责人', '待完善'],
+            ['txt', '生效状态', '待完善']
+          ]}
+          tableLastBtn={[
+            {
+              title: '操作',
+              fixed: 'right',
+              width: 100,
+              render: (item: any) => {
+                return (
+                  <Button
+                    size='small'
+                    type='text'
+                    onClick={() => openLink(`/goodsLook/${item.id}`)}
+                  >
+                    查看
+                  </Button>
+                )
+              }
+            }
+          ]}
+        />
+      ) : null}
     </div>
   )
 }

+ 19 - 6
src/pages/ZcomPage/TopSearch/index.tsx

@@ -12,11 +12,23 @@ type Props = {
   sonWidth: string
   columnsTemp: any[]
   tableLastBtn: any[]
+  getListAPI: any
+  tableInfo: any
   yHeight?: number
 }
 
 function TopSearch(
-  { leftArr, rightBtn, waiWidth, sonWidth, columnsTemp, tableLastBtn, yHeight = 680 }: Props,
+  {
+    leftArr,
+    rightBtn,
+    waiWidth,
+    sonWidth,
+    columnsTemp,
+    tableLastBtn,
+    getListAPI,
+    tableInfo,
+    yHeight = 670
+  }: Props,
   ref: any
 ) {
   const dispatch = useDispatch()
@@ -43,8 +55,8 @@ function TopSearch(
   // 封装发送请求的函数
   const getListFu = useCallback(() => {
     formDataOldRef.current = { ...formDataRef.current }
-    console.log('-------发送请求---------', formDataRef.current)
-  }, [])
+    dispatch(getListAPI(formDataRef.current))
+  }, [dispatch, getListAPI])
 
   useEffect(() => {
     getListFu()
@@ -84,7 +96,7 @@ function TopSearch(
   )
 
   return (
-    <div className={styles.TopSearch}>
+    <div className={styles.TopSearch} id='TopSearch'>
       <div className='TOP1'>
         <div className='TT1' style={{ width: `calc(100% - ${waiWidth}px)` }}>
           {leftArr.map(item => (
@@ -115,13 +127,14 @@ function TopSearch(
 
       <div className='TOP2'>
         <MyTable
+          scrollX={150}
           yHeight={yHeight}
-          list={[{ id: 1, name: 'xxx' }]}
+          list={tableInfo.list || []}
           columnsTemp={columnsTemp}
           lastBtn={tableLastBtn}
           pageNum={formData.pageNum}
           pageSize={formData.pageSize}
-          total={0}
+          total={tableInfo.total}
           onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
         />
       </div>

+ 75 - 0
src/pages/ZcomPage/UpBtn.tsx

@@ -0,0 +1,75 @@
+import { API_upFile } from '@/store/action/layout'
+import { fileDomInitialFu } from '@/utils/domShow'
+import { MessageFu } from '@/utils/message'
+import React, { useCallback, useRef } from 'react'
+import AAbtn from './AAbtn'
+
+type Props = {
+  url: string
+  backFu: () => void
+  tit?: string
+  width?: number
+}
+
+function UpBtn({ url, backFu, tit, width }: Props) {
+  const myInput = useRef<HTMLInputElement>(null)
+
+  // 上传文件
+  const handeUpPhoto = useCallback(
+    async (e: React.ChangeEvent<HTMLInputElement>) => {
+      if (e.target.files) {
+        // 拿到files信息
+        const filesInfo = e.target.files[0]
+
+        let fileNmae: string = filesInfo.name
+        fileNmae = fileNmae.toLowerCase()
+
+        // 校验格式
+        if (!fileNmae.endsWith('.xlsx')) {
+          e.target.value = ''
+          return MessageFu.warning(`只支持.xlsx格式!`)
+        }
+        const fd = new FormData()
+
+        fd.append('file', filesInfo)
+        fd.append('type', 'doc')
+        fd.append('dirCode', 'A1ledger')
+        fd.append('isDb', 'true')
+
+        // 开启压缩图片
+        fd.append('isCompress', 'true')
+
+        e.target.value = ''
+
+        try {
+          const res = await API_upFile(fd, url)
+          if (res.code === 0) {
+            MessageFu.success(res.msg)
+            backFu()
+          }
+          fileDomInitialFu()
+        } catch (error) {
+          fileDomInitialFu()
+        }
+      }
+    },
+    [backFu, url]
+  )
+
+  return (
+    <>
+      <AAbtn width={width} txt={1} onClick={() => myInput.current?.click()} tit={tit} />
+      <input
+        id='upInput'
+        type='file'
+        accept='.xlsx'
+        ref={myInput}
+        onChange={e => handeUpPhoto(e)}
+      />
+    </>
+  )
+}
+
+const MemoUpBtn = React.memo(UpBtn)
+
+export default MemoUpBtn

+ 48 - 26
src/pages/ZgoodsInfo/index.tsx

@@ -1,46 +1,68 @@
-import React, { useState } from 'react'
+import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
 import { Tag } from 'antd'
 import AAbtn from '../ZcomPage/AAbtn'
 import { MessageFu } from '@/utils/message'
 import classNames from 'classnames'
 import GiInfo from './GI_info'
+import { GoodsType } from '../AAnew/data'
+import { useParams } from 'react-router-dom'
+import { API_getGoodsInfo } from '@/store/action/A1check/A1ledger'
 
 const tabArr = ['藏品信息', '盘点记录', '藏品附件']
 
 function ZgoodsInfo() {
+  const { id } = useParams<any>()
+  const [info, setInfo] = useState({} as GoodsType)
+
+  const getInfoFu = useCallback(async () => {
+    const res = await API_getGoodsInfo(id)
+
+    if (res.code === 0) {
+      // 待完善
+      console.log('------', res)
+    }
+  }, [id])
+
+  useEffect(() => {
+    getInfoFu()
+  }, [getInfoFu])
+
   const [tabAc, setTabAc] = useState('藏品信息')
 
   return (
     <div className={styles.ZgoodsInfo}>
       <div className='pageTitle'>藏品详情</div>
 
-      <div className='ZGtop'>
-        <div>
-          <h3>这个藏品名称</h3>
-          <Tag className='AA1Itop1'>待处理</Tag>
-        </div>
-        <div>
-          <AAbtn txt={3} onClick={() => MessageFu.warning('功能开发中')} />
-          <AAbtn txt={1} onClick={() => MessageFu.warning('功能开发中')} tit='编辑' />
-        </div>
-      </div>
-
-      <div className='GItab'>
-        {tabArr.map(item => (
-          <div
-            className={classNames('GItab1', tabAc === item ? 'GItab1Ac' : '')}
-            key={item}
-            onClick={() => setTabAc(item)}
-          >
-            {item}
+      {info.id ? (
+        <>
+          {' '}
+          <div className='ZGtop'>
+            <div>
+              <h3>这个藏品名称</h3>
+              <Tag className='AA1Itop1'>待处理</Tag>
+            </div>
+            <div>
+              <AAbtn txt={3} onClick={() => MessageFu.warning('功能开发中')} />
+              <AAbtn txt={1} onClick={() => MessageFu.warning('功能开发中')} tit='编辑' />
+            </div>
           </div>
-        ))}
-      </div>
-
-      <div className='GImain'>
-        {tabAc === '藏品信息' ? <GiInfo info={{ id: 1 }} fileList={[]} /> : null}
-      </div>
+          <div className='GItab'>
+            {tabArr.map(item => (
+              <div
+                className={classNames('GItab1', tabAc === item ? 'GItab1Ac' : '')}
+                key={item}
+                onClick={() => setTabAc(item)}
+              >
+                {item}
+              </div>
+            ))}
+          </div>
+          <div className='GImain'>
+            {tabAc === '藏品信息' ? <GiInfo info={{ id: 1 }} fileList={[]} /> : null}
+          </div>
+        </>
+      ) : null}
     </div>
   )
 }

+ 11 - 11
src/store/action/A1check/A1ledger.ts

@@ -4,32 +4,32 @@ import http from '@/utils/http'
 /**
  * 盘库总账 - 获取分页列表
  */
-export const AA1_APIgetList = (data: any, exportFlag?: boolean): any => {
-  if (exportFlag) return http.post('cms/antique/page', data)
+export const A1_APIgetList = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/importLedger/pageList', data)
   else {
     return async (dispatch: AppDispatch) => {
-      const res = await http.post('cms/antique/page', data)
+      const res = await http.post('cms/importLedger/pageList', data)
       if (res.code === 0) {
         const obj = {
           list: res.data.records,
           total: res.data.total
         }
-        dispatch({ type: 'AA1/getList', payload: obj })
+        dispatch({ type: 'A1/getList', payload: obj })
       }
     }
   }
 }
 
 /**
- * 盘库总账-详情
+ * 盘库总账-重置所有数据
  */
-export const AA1_APIgetInfo = (id: number) => {
-  return http.get(`cms/antique/detail/${id}`)
-}
+// export const A1_APIgetInfo = (id: number) => {
+//   return http.get(`cms/antique/detail/${id}`)
+// }
 
 /**
- * 盘库总账-删除
+ * 查看藏品详情
  */
-export const AA1_APIdel = (id: number) => {
-  return http.get(`cms/antique/remove/${id}`)
+export const API_getGoodsInfo = (id: number) => {
+  return http.get(`cms/antique/detail/${id}`)
 }

+ 46 - 0
src/store/action/A1check/A2manage.ts

@@ -0,0 +1,46 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+
+/**
+ * 盘库管理-按盘点批次 - 获取分页列表
+ */
+export const A2_APIgetList1 = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/checkFirmVersion/pageList', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/checkFirmVersion/pageList', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+        dispatch({ type: 'A2/getList1', payload: obj })
+      }
+    }
+  }
+}
+/**
+ * 盘库管理-按藏品明细 - 获取分页列表
+ */
+export const A2_APIgetList2 = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/importFirm/pageList', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/importFirm/pageList', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+        dispatch({ type: 'A2/getList2', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 盘库管理-详情
+ */
+// export const A2_APIgetInfo = (id: number) => {
+//   return http.get(`cms/antique/detail/${id}`)
+// }

+ 28 - 0
src/store/reducer/A1check/A1ledger.ts

@@ -0,0 +1,28 @@
+import { GoodsType } from '@/pages/AAnew/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as GoodsType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'A1/getList'
+  payload: { list: GoodsType[]; total: number }
+}
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'A1/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 39 - 0
src/store/reducer/A1check/A2manage.ts

@@ -0,0 +1,39 @@
+import { GoodsType } from '@/pages/AAnew/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo1: {
+    list: [] as GoodsType[],
+    total: 0
+  },
+  tableInfo2: {
+    list: [] as GoodsType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props =
+  | {
+      type: 'A2/getList1'
+      payload: { list: GoodsType[]; total: number }
+    }
+  | {
+      type: 'A2/getList2'
+      payload: { list: GoodsType[]; total: number }
+    }
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'A2/getList1':
+      return { ...state, tableInfo1: action.payload }
+    case 'A2/getList2':
+      return { ...state, tableInfo2: action.payload }
+
+    default:
+      return state
+  }
+}

+ 4 - 0
src/store/reducer/index.ts

@@ -2,6 +2,8 @@
 import { combineReducers } from 'redux'
 
 // 导入 登录 模块的 reducer
+import A1ledger from './A1check/A1ledger'
+import A2manage from './A1check/A2manage'
 import AA1onePu from './AAnew/AA1onePu'
 
 import A0Layout from './layout'
@@ -12,6 +14,8 @@ import Z7log from './Z7log'
 
 // 合并 reducer
 const rootReducer = combineReducers({
+  A1ledger,
+  A2manage,
   AA1onePu,
   A0Layout,
   Z1dict,

+ 1 - 0
src/utils/http.ts

@@ -19,6 +19,7 @@ export const baseURL = envFlag ? `${baseUrlTemp}${baseFlag ? '' : '/api/'}` : ba
 declare module 'axios' {
   interface AxiosResponse {
     code: number
+    msg: string
     timestamp: string
     // 这里追加你的参数
   }