chenlei 1 неделя назад
Родитель
Сommit
20f66c224f

+ 305 - 0
src/components/MyTable/form.tsx

@@ -0,0 +1,305 @@
+import React, {
+  forwardRef,
+  useCallback,
+  useEffect,
+  useImperativeHandle,
+  useMemo,
+  useState
+} from 'react'
+import styles from './index.module.scss'
+import { DatePicker, Form, FormInstance, Input, Table, TableProps } from 'antd'
+import ImageLazy from '../ImageLazy'
+import classNames from 'classnames'
+import dayjs from 'dayjs'
+import { resJiLianFu } from '@/utils/dataChange'
+
+interface MyTableProps extends Omit<TableProps, 'onChange'> {
+  yHeight?: number //设置表格的高度
+  list: any //表格数据
+  columnsTemp: any[][] //表格展示
+  total?: number //总数
+  pageNum?: number
+  pageSize?: number
+  pagingInfo?: any | boolean
+  onChange?: (pageNum: number, pageSize: number) => void
+  lastBtn?: any //后面的操作按钮
+  startBtn?: any
+  classKey?: string //一个组件多次使用的时候要传递,分别设置style
+  // 表格简单的合并
+  merge?: { type: string; num: number; loc: 'rowSpan' | 'colSpan' }
+  // 定制化表头
+  myTitle?: { name: string; Com: React.ReactNode }
+  // 为空的定制字段
+  isNull?: string
+  // 设置宽度
+  widthSet?: any
+  rowKey?: string
+  readOnly?: boolean
+  // 没有数据的时候展示
+  emptyText?: boolean
+}
+
+export interface MyTableMethods {
+  form: FormInstance<any>
+}
+
+export const getDesensitizeTxt = (txt: string, frontLen = 3, endLen = 4) => {
+  if (!txt) return txt
+  const totalVisible = frontLen + endLen
+  if (txt.length <= totalVisible) {
+    return txt
+  }
+  const frontStr = txt.substring(0, frontLen)
+  const endStr = endLen > 0 ? txt.substring(txt.length - endLen) : ''
+  const maskStr = '*'.repeat(txt.length - frontLen - endLen)
+
+  return frontStr + maskStr + endStr
+}
+
+const MyTable = forwardRef<MyTableMethods, MyTableProps>(
+  (
+    {
+      yHeight,
+      list,
+      columnsTemp,
+      total,
+      pageNum = 1,
+      pageSize = 10,
+      pagingInfo = {
+        showQuickJumper: true,
+        position: ['bottomCenter'],
+        showSizeChanger: true
+      },
+      onChange,
+      lastBtn = [],
+      startBtn = [],
+      classKey = '',
+      merge,
+      myTitle,
+      isNull = '(空)',
+      widthSet,
+      rowKey = 'id',
+      readOnly,
+      emptyText,
+      ...rest
+    },
+    ref
+  ) => {
+    // 点击操作高亮
+    const [clickAc, setClickAc] = useState(0)
+    const [form] = Form.useForm()
+
+    // 表格内容定制化
+    const tableComObj = useCallback(
+      (key: string, val: string[], id?: any, backFu?: (id: number) => void) => {
+        const obj = {
+          // 超链接打开
+          A: (
+            <a href={val[1]} target='_blank' title={val[1]} rel='noreferrer'>
+              {val[0]}
+            </a>
+          ),
+          // 点击触发事件
+          S: (
+            <span
+              className={classNames('MTclick', clickAc === id ? 'MTclickAc' : '')}
+              onClick={() => {
+                if (id && backFu) {
+                  backFu(id)
+                  setClickAc(id)
+                }
+              }}
+            >
+              {val[1]}
+            </span>
+          )
+        }
+        return Reflect.get(obj, key)
+      },
+      [clickAc]
+    )
+
+    useEffect(() => {
+      const dom = document.querySelector(`.MyTable${classKey} .ant-table-body`) as HTMLDivElement
+
+      if (dom && yHeight) dom.style.height = yHeight + 'px'
+    }, [classKey, yHeight])
+
+    // 页码变化
+    const paginationChange = useCallback(
+      () => (pageNum: number, pageSize: number) => {
+        if (onChange) {
+          onChange(pageNum, pageSize)
+        }
+      },
+      [onChange]
+    )
+
+    const dataChangeFu = useCallback(
+      (v: any) => {
+        /**
+         * index:序号
+         * txt:正常数据
+         * img:图片
+         * txtChange:判断显示不同字段
+         * text:文字比较多的情况
+         */
+        const obj = {
+          index: (_: any, __: any, index: number) => index + 1 + (pageNum - 1) * pageSize,
+          txt: (item: any) =>
+            v[3] && !item[v[2]] ? (
+              <div dangerouslySetInnerHTML={{ __html: v[3] }}></div>
+            ) : item[v[2]] && item[v[2]] !== '0' ? (
+              item[v[2]]
+            ) : (
+              isNull
+            ),
+          txtArr: (item: any) => (
+            <div dangerouslySetInnerHTML={{ __html: (item[v[2]] || []).join('<br/>') }}></div>
+          ),
+          // 日期去掉00:00:00
+          dateRes: (item: any) => {
+            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]]),
+          img: (item: any) =>
+            v[3] && !item[v[2]] ? (
+              <div dangerouslySetInnerHTML={{ __html: v[3] }}></div>
+            ) : (
+              <div className='tableImgAuto'>
+                <ImageLazy
+                  width={60}
+                  height={60}
+                  srcBig={item.thumbPc || item.filePath}
+                  src={item[v[2]] || item.thumb}
+                  offline={(item[v[2]] || item.thumb).includes('http')}
+                />
+              </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
+
+            if (tempCom.length >= v[3]) {
+              tempCom = tempCom.substring(0, v[3]) + '...'
+            }
+
+            if (v[4]) {
+              tempCom = tableComObj(v[4], [tempCom, item[v[2]]], item.id, v[5])
+            } else if ((item[v[2]] || '').length >= v[3]) {
+              tempCom = (
+                <span style={{ cursor: 'pointer' }} title={item[v[2]]}>
+                  {tempCom}
+                </span>
+              )
+            }
+
+            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)
+          }
+        }
+
+        return Reflect.get(obj, v[0])
+      },
+      [isNull, pageNum, pageSize, readOnly, tableComObj]
+    )
+
+    const columns = useMemo(() => {
+      const arr: any = columnsTemp.map((v: any) => ({
+        title: myTitle && v.includes(myTitle.name) ? myTitle.Com : v[1],
+        render: dataChangeFu(v),
+        width: widthSet && Reflect.get(widthSet, v[2]) ? Reflect.get(widthSet, v[2]) : 'auto',
+        onCell:
+          merge && v.includes(merge.type)
+            ? // {rowSpan:3}
+              (item: any, index: number) => ({
+                rowSpan: index === 0 ? merge.num : 0
+              })
+            : ''
+      }))
+
+      return arr
+    }, [columnsTemp, dataChangeFu, merge, myTitle, widthSet])
+
+    useImperativeHandle(ref, () => ({
+      form
+    }))
+
+    return (
+      <Form form={form} component={false}>
+        <Table
+          className={classNames(
+            `${styles.MyTable} MyTable${classKey}`,
+            emptyText ? styles.MyTableNull : ''
+          )}
+          scroll={{ y: yHeight ? yHeight : '' }}
+          dataSource={list}
+          columns={[...startBtn, ...columns, ...lastBtn]}
+          rowKey={rowKey}
+          pagination={
+            pagingInfo
+              ? {
+                  ...pagingInfo,
+                  current: pageNum,
+                  pageSize: pageSize,
+                  total: total,
+                  onChange: paginationChange()
+                }
+              : false
+          }
+          {...rest}
+        />
+      </Form>
+    )
+  }
+)
+
+const MemoMyTable = React.memo(MyTable)
+
+export default MemoMyTable

+ 16 - 0
src/pages/Fstorehouse/F1inStorage/F1edit/index.module.scss

@@ -0,0 +1,16 @@
+.F1edit {
+  :global {
+    .F1editStorage {
+      width: 100%;
+      border-top: 1px solid #ccc;
+      padding: 15px;
+      display: flex;
+      align-items: center;
+      gap: 15px;
+    }
+    .F1editStorageTitle {
+      font-weight: 700;
+      font-size: 18px;
+    }
+  }
+}

+ 199 - 0
src/pages/Fstorehouse/F1inStorage/F1edit/index.tsx

@@ -0,0 +1,199 @@
+import React, { useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import EditTop from '@/pages/Zother/EditTop'
+import EditBtn from '@/pages/Zother/EditBtn'
+import { InfoProvider } from '@/pages/Zother/InfoContext'
+import { rowArrTemp } from '@/pages/Zother/data'
+import SonGoodsList from '@/pages/Zother/SonGoodsList'
+import {
+  F1_APIgetClueList,
+  F1_APIgetShelfEmptyList,
+  F1_APIgetShelfList,
+  F1_APIgetStorageList,
+  F1API_obj
+} from '@/store/action/Fstorehouse/F1inStorage'
+import { Button, Select } from 'antd'
+import { selectObj } from '@/utils/dataChange'
+
+const rowArr = rowArrTemp('入库')
+
+function F1edit() {
+  const sonGoodsListRef = useRef<any>(null)
+  const [selectStorage, setSelectStorage] = useState<any>(null)
+  const [allWarehouseList, setAllWarehouseList] = useState<any[]>([])
+  const warehouseOptions = useMemo(() => {
+    return allWarehouseList.map((i: any) => ({
+      label: i.name,
+      value: i.id,
+      managerUser: i.managerUser
+    }))
+  }, [allWarehouseList])
+  const [shelfList, setShelfList] = useState<any[]>([])
+
+  const handleStorageChange = async (value: string, option: any) => {
+    setSelectStorage(option)
+    const res = await F1_APIgetShelfList({ storageId: value })
+    setShelfList(
+      res.data.map((i: any) => ({
+        label: [i.layer1, i.layer2, i.layer3, i.layer4].filter(i => Boolean(i)).join('-'),
+        value: i.id
+      }))
+    )
+  }
+
+  const handleAutoAssignShelf = async () => {
+    const snaps = sonGoodsListRef.current?.snaps ?? []
+    if (!snaps.length) return
+    const res = await F1_APIgetShelfEmptyList({
+      storageId: selectStorage?.value,
+      limit: snaps.length
+    })
+    const idList: { id: number }[] = Array.isArray(res) ? res : (res?.data ?? [])
+    const form = sonGoodsListRef.current?.tableRef?.current?.form
+    if (!form) return
+    const values: Record<string, number | undefined> = {}
+    snaps.forEach((snap: any, i: number) => {
+      values[`${snap.id}-storageInId`] = idList[i]?.id
+    })
+    form.setFieldsValue(values)
+  }
+
+  const getStorageList = async () => {
+    const res = await F1_APIgetStorageList()
+    setAllWarehouseList(res.data.records)
+  }
+
+  useEffect(() => {
+    getStorageList()
+  }, [])
+
+  const verifyBackFu = (info: any) => {
+    if (!selectStorage) return { flag: true, txt: '请选择入库库房' }
+    const form = sonGoodsListRef.current?.tableRef?.current?.form
+    if (!form) return { flag: true, txt: '请添加藏品' }
+    const values = form.getFieldsValue()
+    const snaps = sonGoodsListRef.current?.snaps ?? []
+    const hasEmptyStorage = snaps.some((snap: any) => !values[`${snap.id}-storageInId`])
+    if (hasEmptyStorage) return { flag: true, txt: '请为藏品选择库房位置' }
+    return { flag: false, txt: '' }
+  }
+
+  const getExtraData = (info: any, snaps: any[]) => {
+    const form = sonGoodsListRef.current?.tableRef?.current?.form
+    const values = form?.getFieldsValue() ?? {}
+    const snapsArr = snaps.map((v: any) => {
+      const flag = v.pageType === 'clue' && !v.clueId
+      const storageInId = values[`${v.id}-storageInId`] ?? null
+      const siteLoc = shelfList.find((s: any) => s.value === storageInId)?.label ?? null
+      return {
+        goodId: v.isNew || flag ? null : v.id,
+        orderId: info.id,
+        storageInId: selectStorage?.value ?? null,
+        snap: JSON.stringify({
+          ...v,
+          id: v.isNew || flag ? null : v.id,
+          siteLoc,
+          siteId: storageInId
+        })
+      }
+    })
+    return {
+      storageId: selectStorage?.value ?? undefined,
+      snaps: snapsArr
+    }
+  }
+
+  return (
+    <InfoProvider>
+      <div className={styles.F1edit} id='editBox'>
+        <div className='editMain'>
+          {/* 顶部 */}
+          {/* TODO: 借展归还待完善 */}
+          <EditTop
+            pageTxt='藏品入库'
+            rowArr={rowArr}
+            APIobj={F1API_obj}
+            fileUpInfo={{ myUrl: 'cms/orderSite/in/upload', dirCode: 'inStorage' }}
+          />
+
+          <div className='F1editStorage'>
+            <p className='F1editStorageTitle'>*入库库房</p>
+            <Select
+              style={{ width: 200 }}
+              options={warehouseOptions}
+              placeholder='请选择'
+              value={selectStorage?.value}
+              onChange={handleStorageChange}
+            />
+            {selectStorage?.managerUser && (
+              <p className='F1editStorageManager'>库房负责人:{selectStorage.managerUser}</p>
+            )}
+          </div>
+
+          {/* 藏品清单 */}
+          <SonGoodsList
+            ref={sonGoodsListRef}
+            needEdit={true}
+            btnTxt='选择藏品'
+            addShow={false}
+            customRightBtn={
+              <Button
+                disabled={!selectStorage?.value}
+                type='primary'
+                ghost
+                onClick={handleAutoAssignShelf}
+              >
+                自动分配空置位置
+              </Button>
+            }
+            goodsSonTable={[
+              ['txt', '藏品登记号', 'num'],
+              ['img', '封面', 'thumb'],
+              ['txtCTag', '藏品标签', 'tagDictId'],
+              ['txt', '藏品名称', 'name'],
+              ['select', '级别', 'level', selectObj['藏品级别']],
+              ['txtC', '类别', 'typeDictId'],
+              ['txtC', '年代', 'ageDictId'],
+              ['txtC', '质地', 'textureDictId'],
+              ['select', '完残程度', 'tornLevel', selectObj['完残程度']],
+              ['ping', '数量', 'pcs', 'pcsUnitDictId'],
+              [
+                'custom',
+                '库房位置',
+                'storageInId',
+                {
+                  render(readOnly?: boolean) {
+                    return (
+                      <Select
+                        allowClear
+                        options={shelfList}
+                        disabled={readOnly}
+                        placeholder='请选择'
+                      />
+                    )
+                  }
+                }
+              ]
+            ]}
+            fileUpInfo={{ myUrl: 'cms/orderSite/in/upload', dirCode: 'inStorageGoods' }}
+            selectApi={F1_APIgetClueList}
+            isClueSelect={false}
+          />
+
+          {/* 底部按钮 */}
+          <EditBtn
+            path='/inStorage'
+            APIobj={F1API_obj}
+            checkListTxt='请添加藏品'
+            verifyBackFu={verifyBackFu}
+            getExtraData={getExtraData}
+          />
+        </div>
+      </div>
+    </InfoProvider>
+  )
+}
+
+const MemoF1edit = React.memo(F1edit)
+
+export default MemoF1edit

+ 3 - 0
src/pages/Fstorehouse/F1inStorage/index.module.scss

@@ -1,4 +1,7 @@
 .F1inStorage {
   :global {
+    .table-list-table {
+      height: calc(100% - 119px);
+    }
   }
 }

+ 102 - 1
src/pages/Fstorehouse/F1inStorage/index.tsx

@@ -1,9 +1,110 @@
-import React from 'react'
+import React, { useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import TableList from '@/pages/Zother/TableList'
+import { baseFormData } from '@/pages/Zother/data'
+import { F1_APIgetList, F1_APIgetStorageList } from '@/store/action/Fstorehouse/F1inStorage'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { Button } from 'antd'
+import { inStorageTableC } from '@/utils/tableData'
+import { selectObj } from '@/utils/dataChange'
+import { useHistory } from 'react-router-dom'
+
+const F1baseFormData = baseFormData()
+
 function F1inStorage() {
+  const tableListRef = useRef<any>(null)
+  const history = useHistory()
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.F1inStorage.tableInfo)
+  const [allWarehouseList, setAllWarehouseList] = useState<any[]>([])
+  const warehouseOptions = useMemo(() => {
+    return allWarehouseList.map((i: any) => ({
+      label: i.name,
+      value: i.id
+    }))
+  }, [allWarehouseList])
+
+  const dataExport = () => {
+    console.log('数据导出了')
+  }
+
+  const getStorageList = async () => {
+    const res = await F1_APIgetStorageList()
+    setAllWarehouseList(res.data.records)
+  }
+
+  useEffect(() => {
+    getStorageList()
+  }, [])
+
   return (
     <div className={styles.F1inStorage}>
       <div className='pageTitle'>藏品入库</div>
+
+      <TableList
+        ref={tableListRef}
+        baseFormData={F1baseFormData}
+        getListAPI={F1_APIgetList}
+        pageKey='position'
+        tableInfo={tableInfo}
+        columnsTemp={inStorageTableC}
+        rightBtnWidth={340}
+        yHeight={585}
+        searchDom={[
+          {
+            type: 'time',
+            key: ['startTime', 'endTime'],
+            placeholder: `入库日期`
+          },
+          {
+            type: 'select',
+            key: 'storageId',
+            placeholder: `库房名称`,
+            options: warehouseOptions
+          },
+          {
+            type: 'input',
+            key: 'searchKey',
+            placeholder: `请输入申请编号、发起人或藏品编号`
+          },
+          {
+            type: 'time',
+            key: ['businessStartTime', 'businessEndTime'],
+            placeholder: `发起日期`
+          },
+          {
+            type: 'select',
+            key: 'status',
+            placeholder: `申请状态`,
+            options: selectObj['藏品入库申请状态']
+          }
+        ]}
+        storyTableListToprr={({ clickSearch, resetSelectFu }) => (
+          <>
+            <Button type='primary' ghost onClick={() => history.push('/inStorage_edit/1/null')}>
+              发起申请
+            </Button>
+            <Button type='primary' onClick={dataExport}>
+              数据导出
+            </Button>
+            <Button type='primary' onClick={clickSearch}>
+              查询
+            </Button>
+            <Button onClick={resetSelectFu}>重置</Button>
+          </>
+        )}
+        storyTableLastBtn={[
+          {
+            title: '操作',
+            render: (item: any) => (
+              <>
+                <Button type='text'>查看</Button>
+              </>
+            )
+          }
+        ]}
+      />
     </div>
   )
 }

+ 6 - 0
src/pages/Layout/data.ts

@@ -359,5 +359,11 @@ export const routerSon: RouterTypeRow[] = [
     name: '故事管理-详情页',
     path: '/story_edit/:key/:id',
     Com: React.lazy(() => import('../Eculture/E2story/E2edit'))
+  },
+  {
+    id: 1010,
+    name: '藏品入库-详情页',
+    path: '/inStorage_edit/:key/:id',
+    Com: React.lazy(() => import('../Fstorehouse/F1inStorage/F1edit'))
   }
 ]

+ 12 - 2
src/pages/Zother/EditBtn/index.tsx

@@ -22,6 +22,8 @@ type Props = {
   verifyArr?: { key: string; txt: string }[]
   // 其他需要校验的回调函数,返回 flag为true 表示校验不通过,txt为提示语
   verifyBackFu?: (info: Typetable) => { flag: boolean; txt: string; info?: any }
+  // 页面特有数据,如 storageId、带 storageInId 的 snaps 等,会合并到提交的 obj 中
+  getExtraData?: (info: Typetable, snaps: GoodsType[]) => { storageId?: number; snaps?: any[] }
 }
 
 function EditBtn({
@@ -29,7 +31,8 @@ function EditBtn({
   APIobj,
   checkListTxt = '',
   verifyArr = [{ key: 'num', txt: '请输入申请编号' }],
-  verifyBackFu
+  verifyBackFu,
+  getExtraData
 }: Props) {
   const { info, snaps, setTimeKeyFu, auditInfo } = useInfo()
 
@@ -105,7 +108,7 @@ function EditBtn({
           })
         })
 
-        const obj = {
+        let obj = {
           ...info,
           fileIds: fileIdsResFu(info.files),
           goodIds: goodIdArr.join(','),
@@ -113,6 +116,12 @@ function EditBtn({
           snaps: snapsArr
         }
 
+        if (getExtraData) {
+          const extra = getExtraData(info, snaps)
+          if (extra.storageId != null) obj = { ...obj, storageId: extra.storageId } as typeof obj
+          if (extra.snaps) obj = { ...obj, snaps: extra.snaps } as typeof obj
+        }
+
         // if (1 + 1 === 2) {
         //   console.log('xxxxxxxxx', obj.snaps)
         //   return
@@ -232,6 +241,7 @@ function EditBtn({
       APIobj,
       auditInfo,
       checkListTxt,
+      getExtraData,
       info,
       isLook,
       key,

+ 48 - 18
src/pages/Zother/SonGoodsList/index.tsx

@@ -1,4 +1,4 @@
-import React, { useMemo, useState } from 'react'
+import React, { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { Button } from 'antd'
 import MyTable from '@/components/MyTable'
@@ -17,6 +17,7 @@ import { useParams } from 'react-router-dom'
 import { openLink } from '@/utils/history'
 import { FileUpInfoType } from '../data'
 import SelectGoods from '../SelectGoods'
+import MyTableForm, { MyTableMethods } from '@/components/MyTable/form'
 
 type Props = {
   // 上传附件的信息(不需要新增藏品的不用传)
@@ -31,16 +32,27 @@ type Props = {
   btnTxt?: string
   // 是否有新增和编辑可以操作藏品,默认true
   addShow?: boolean
+  // 是否需要编辑藏品
+  needEdit?: boolean
+  goodsSonTable?: any[]
+  customRightBtn?: React.ReactNode
 }
 
-function SonGoodsList({
-  fileUpInfo,
-  selectApi,
-  addGoodsApi,
-  isClueSelect,
-  btnTxt,
-  addShow = true
-}: Props) {
+function SonGoodsList(
+  {
+    fileUpInfo,
+    selectApi,
+    addGoodsApi,
+    isClueSelect,
+    btnTxt,
+    addShow = true,
+    needEdit,
+    goodsSonTable,
+    customRightBtn
+  }: Props,
+  ref: any
+) {
+  const tableRef = useRef<MyTableMethods | null>(null)
   const { info, snaps, setSnapsFu } = useInfo()
 
   const { key } = useParams<any>()
@@ -89,6 +101,11 @@ function SonGoodsList({
   // 从征集线索中添加
   const [clueShow, setClueShow] = useState(false)
 
+  useImperativeHandle(ref, () => ({
+    tableRef,
+    snaps
+  }))
+
   return (
     <div className={styles.SonGoodsList}>
       <div className='EdTit'>
@@ -97,6 +114,7 @@ function SonGoodsList({
           <div></div>
         ) : (
           <div>
+            {customRightBtn ? customRightBtn : null}
             <Button type='primary' onClick={() => setClueShow(true)}>
               {btnTxt ? btnTxt : '从征集线索中添加'}
             </Button>
@@ -109,14 +127,26 @@ function SonGoodsList({
         )}
       </div>
       <div className='SonGoodsListTable'>
-        <MyTable
-          rowKey='idTemp'
-          classKey='SonGoodsList'
-          list={snaps}
-          columnsTemp={goodsSonTableC()}
-          lastBtn={tableLastBtn}
-          pagingInfo={false}
-        />
+        {needEdit ? (
+          <MyTableForm
+            ref={tableRef}
+            rowKey='idTemp'
+            classKey='SonGoodsList'
+            list={snaps}
+            columnsTemp={goodsSonTable || goodsSonTableC()}
+            lastBtn={tableLastBtn}
+            pagingInfo={false}
+          />
+        ) : (
+          <MyTable
+            rowKey='idTemp'
+            classKey='SonGoodsList'
+            list={snaps}
+            columnsTemp={goodsSonTableC()}
+            lastBtn={tableLastBtn}
+            pagingInfo={false}
+          />
+        )}
       </div>
       {openInfo.id ? (
         <AddGoods
@@ -174,6 +204,6 @@ function SonGoodsList({
   )
 }
 
-const MemoSonGoodsList = React.memo(SonGoodsList)
+const MemoSonGoodsList = React.memo(forwardRef(SonGoodsList))
 
 export default MemoSonGoodsList

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

@@ -228,7 +228,7 @@ const TableList = forwardRef<any, Props>(function TableList(props, ref) {
           )}
         </div>
       </div>
-      <div className={styles.TableListTable}>
+      <div className={`${styles.TableListTable} table-list-table`}>
         <MyTable
           yHeight={yHeight}
           list={tableInfo.list}

+ 62 - 0
src/store/action/Fstorehouse/F1inStorage.ts

@@ -0,0 +1,62 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+import { APIbase } from '../layout'
+
+/**
+ * 藏品入库 - 分页列表
+ */
+export const F1_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/orderSite/in/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'F1/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 库房-分页
+ */
+export const F1_APIgetStorageList = () => {
+  return http.post('cms/orderSite/in/storage/pageList', {
+    pageNum: 1,
+    pageSize: 999
+  })
+}
+
+/**
+ * 藏品总账列表-分页
+ */
+export const F1_APIgetClueList = (data: any) => {
+  return http.post('cms/orderSite/in/good/page', data)
+}
+
+/**
+ * 库位-列表
+ */
+export const F1_APIgetShelfList = (params: any) => {
+  return http.get('cms/orderSite/in/getSiteList', { params })
+}
+
+/**
+ * 自动分配空置仓位
+ */
+export const F1_APIgetShelfEmptyList = (params: any) => {
+  return http.get('cms/orderSite/in/getStorageEmpty', { params })
+}
+
+export const F1API_obj = {
+  创建订单: () => APIbase('get', 'cms/orderSite/in/create'),
+  获取详情: (id: number) => APIbase('get', `cms/orderSite/in/detail/${id}`),
+  草稿: (data: any) => APIbase('post', `cms/orderSite/in/saveDraft`, data),
+  发起: (data: any) => APIbase('post', `cms/orderSite/in/saveApply`, data),
+  重新发起: (id: number) => APIbase('get', `cms/orderSite/in/reissue/${id}`),
+  审批: (data: any) => APIbase('post', `cms/orderSite/in/audit`, data),
+  撤回: (id: number) => APIbase('get', `cms/orderSite/in/revocation/${id}`),
+  删除: (id: number) => APIbase('get', `cms/orderSite/in/remove/${id}`)
+}

+ 9 - 0
src/store/action/Isystem/I1storageSet.ts

@@ -23,6 +23,15 @@ export const I1_APIgetList = (data: any): any => {
   }
 }
 
+export const I1_APIgetListPure = (data: { searchKey?: string; storageId: unknown }) => {
+  return http.get('cms/site/getList', {
+    params: {
+      searchKey: data.searchKey,
+      storageId: data.storageId
+    }
+  })
+}
+
 /**
  * 库房设置 - 仓格删除
  */

+ 28 - 0
src/store/reducer/Fstorehouse/F1inStorage.ts

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

+ 2 - 2
src/store/reducer/index.ts

@@ -13,7 +13,7 @@ import D1register from './Dmanage/D1register'
 import D3writeOff from './Dmanage/D3writeOff'
 import E1tag from './Eculture/E1tag'
 import E2story from './Eculture/E2story'
-
+import F1inStorage from './Fstorehouse/F1inStorage'
 import I1storageSet from './Isystem/I1storageSet'
 import I2dict from './Isystem/I2dict'
 import I3numSet from './Isystem/I3numSet'
@@ -36,7 +36,7 @@ const rootReducer = combineReducers({
   D3writeOff,
   E1tag,
   E2story,
-
+  F1inStorage,
   I1storageSet,
   I2dict,
   I3numSet,

+ 8 - 0
src/utils/dataChange.ts

@@ -55,6 +55,14 @@ export const selectObj = {
     { value: 3, label: '审批不通过' },
     { value: 4, label: '已完成' }
   ],
+  藏品入库申请状态: [
+    { value: 1, label: '草稿' },
+    { value: 2, label: '待审批' },
+    { value: 3, label: '申请不通过' },
+    { value: 4, label: '已完成' },
+    { value: 5, label: '待盘点' },
+    { value: 6, label: '待提交' }
+  ],
   藏品入藏状态: [
     { value: 1, label: '入馆中' },
     { value: 2, label: '待入馆' },

+ 11 - 0
src/utils/tableData.ts

@@ -154,3 +154,14 @@ export const goodsFileTableC = [
   ['txtC', '上传人', 'creatorName'],
   ['txt', '文件大小', 'fileSize']
 ]
+
+// 藏品入库
+export const inStorageTableC = [
+  ['txt', '入库日期', 'createTime'],
+  ['txt', '入库库房', 'tagName'],
+  ['txt', '申请编号', 'num'],
+  ['txt', '发起部门', 'deptName'],
+  ['txt', '发起人', 'creatorName'],
+  ['txt', '发起日期', 'date'],
+  ['select', '申请状态', 'status', selectObj['藏品入库申请状态']]
+]