Prechádzať zdrojové kódy

Merge branch 'master' of http://192.168.0.115:3000/shaogen1995/qingDao_goods

lanxin 4 dní pred
rodič
commit
a3c1b97fd8

+ 9 - 1
src/components/MyTable/form.tsx

@@ -239,7 +239,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
           custom: (item: any) => {
             return (
               <Form.Item noStyle name={`${item.id}-${v[2]}`} initialValue={item[v[2]]}>
-                {v[3].render(readOnly)}
+                {v[3].render(readOnly, item)}
               </Form.Item>
             )
           },
@@ -250,6 +250,14 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
             const endLen = v[3]?.endLen || 4
 
             return getDesensitizeTxt(txt, frontLen, endLen)
+          },
+          select: (item: any) => {
+            let txt = isNull
+            const data = v[3]
+            const id = item[v[2]]
+            const obj = data.find((v: any) => v.value === id)
+            if (obj) txt = obj.label
+            return txt
           }
         }
 

+ 1 - 1
src/components/Z3upFilesRef/index.tsx

@@ -192,7 +192,7 @@ type Props = {
   size?: number
   maxCount?: number
   oneIsCover?: boolean
-  moduleId: number
+  moduleId: number | ''
   ref: any
 }
 

+ 1 - 1
src/components/ZRichTextOne/index.tsx

@@ -24,7 +24,7 @@ type Props = {
   ref: any //当前自己的ref,给父组件调用
   myUrl: string //上传的api地址
   dirCode: string
-  moduleId: number
+  moduleId: number | ''
   titTxt?: string
 }
 

+ 2 - 2
src/pages/Fstorehouse/F1inStorage/F1edit/index.tsx

@@ -75,7 +75,7 @@ function F1editContent() {
   useEffect(() => {
     if (!info?.storageId || !allWarehouseList.length) return
     const opt = warehouseOptions.find((o: any) => o.value === info.storageId)
-    if (opt && selectStorage?.value !== info.storageId) {
+    if (opt) {
       setSelectStorage(opt)
       F1_APIgetShelfList({ storageId: info.storageId }).then(res => {
         setShelfList(
@@ -86,7 +86,7 @@ function F1editContent() {
         )
       })
     }
-  }, [info?.storageId, allWarehouseList.length, warehouseOptions, selectStorage?.value])
+  }, [info?.storageId, allWarehouseList.length, warehouseOptions])
 
   const verifyBackFu = (info: any) => {
     if (!selectStorage) return { flag: true, txt: '请选择入库库房' }

+ 10 - 6
src/pages/Fstorehouse/F3outStorage/F3edit/index.tsx

@@ -15,7 +15,7 @@ import { F1_APIgetStorageList } from '@/store/action/Fstorehouse/F1inStorage'
 const rowArr = rowArrTemp('出库')
 
 function F3editContent() {
-  const { info } = useInfo() as { info: any }
+  const { info, setSnapsFu } = useInfo() as { info: any; setSnapsFu: (snaps: any[]) => void }
   const { key } = useParams<any>()
   const canEdit = useMemo(() => ['1', '2'].includes(key), [key])
   const sonGoodsListRef = useRef<any>(null)
@@ -29,9 +29,13 @@ function F3editContent() {
     }))
   }, [allWarehouseList])
 
-  const handleStorageChange = useCallback(async (value: string, option: any) => {
-    setSelectStorage(option)
-  }, [])
+  const handleStorageChange = useCallback(
+    async (value: string, option: any) => {
+      setSelectStorage(option)
+      setSnapsFu([])
+    },
+    [setSnapsFu]
+  )
 
   const getStorageList = useCallback(async () => {
     const res = await F1_APIgetStorageList()
@@ -45,10 +49,10 @@ function F3editContent() {
   useEffect(() => {
     if (!info?.storageId || !allWarehouseList.length) return
     const opt = warehouseOptions.find((o: any) => o.value === info.storageId)
-    if (opt && selectStorage?.value !== info.storageId) {
+    if (opt) {
       setSelectStorage(opt)
     }
-  }, [info?.storageId, allWarehouseList.length, warehouseOptions, selectStorage?.value])
+  }, [info?.storageId, allWarehouseList.length, warehouseOptions])
 
   const getExtraData = (info: any, snaps: any[]) => {
     return {

+ 5 - 0
src/pages/Fstorehouse/F4check/F4edit/components/index.module.scss

@@ -0,0 +1,5 @@
+.newPcsInconsistent {
+  :global(.ant-input-number-input) {
+    color: #ff4d4f !important;
+  }
+}

+ 112 - 0
src/pages/Fstorehouse/F4check/F4edit/components/index.tsx

@@ -0,0 +1,112 @@
+import { Modal, Input, Button, InputNumber } from 'antd'
+import { useState, useEffect } from 'react'
+import classNames from 'classnames'
+import styles from './index.module.scss'
+
+export function NewPcsCell({
+  value,
+  onChange,
+  item,
+  readOnly
+}: {
+  value?: number
+  onChange?: (v: number | null) => void
+  item: any
+  readOnly: boolean
+}) {
+  const beforePcs = item?.pcs ?? ''
+  const afterPcs = value ?? item?.newPcs ?? ''
+  const isInconsistent = String(afterPcs) !== String(beforePcs)
+  return (
+    <InputNumber
+      min={0}
+      placeholder='非负整数'
+      className={classNames(isInconsistent && styles.newPcsInconsistent)}
+      style={{ width: '100%' }}
+      value={value}
+      onChange={onChange}
+      disabled={readOnly}
+    />
+  )
+}
+
+export function PdRemarkCell({
+  value,
+  onChange,
+  item,
+  readOnly,
+  onOpen
+}: {
+  value?: string
+  onChange?: (v: string) => void
+  item: any
+  readOnly: boolean
+  onOpen: (val: string, onChange: (v: string) => void) => void
+}) {
+  const val = value ?? item?.pdRemark ?? ''
+  const displayTxt = readOnly ? '查看' : '填写'
+  return (
+    <div>
+      <input type='hidden' value={val} onChange={e => onChange?.(e.target.value)} />
+
+      {!val && readOnly ? (
+        '(空)'
+      ) : (
+        <Button type='text' size='small' onClick={() => item && onOpen(val, v => onChange?.(v))}>
+          {displayTxt}
+        </Button>
+      )}
+    </div>
+  )
+}
+
+export function PdRemarkModal({
+  open,
+  value,
+  readOnly,
+  onOk,
+  onCancel
+}: {
+  open: boolean
+  value: string
+  readOnly: boolean
+  onOk: (val: string) => void
+  onCancel: () => void
+}) {
+  const [inputVal, setInputVal] = useState('')
+  useEffect(() => {
+    if (open) setInputVal(value)
+  }, [open, value])
+  return (
+    <Modal
+      title='盘点备注'
+      open={open}
+      onOk={() => onOk(inputVal)}
+      onCancel={onCancel}
+      destroyOnClose
+      footer={
+        readOnly
+          ? null
+          : [
+              <Button key='cancel' onClick={onCancel}>
+                取消
+              </Button>,
+              <Button key='ok' type='primary' onClick={() => onOk(inputVal)}>
+                确定
+              </Button>
+            ]
+      }
+    >
+      <Input.TextArea
+        value={inputVal}
+        disabled={readOnly}
+        onChange={e => setInputVal(e.target.value)}
+        placeholder='请填写内容'
+        maxLength={500}
+        rows={4}
+        showCount
+        style={{ marginBottom: 20 }}
+      />
+    </Modal>
+  )
+}

+ 16 - 0
src/pages/Fstorehouse/F4check/F4edit/index.module.scss

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

+ 316 - 0
src/pages/Fstorehouse/F4check/F4edit/index.tsx

@@ -0,0 +1,316 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { useHistory, useParams } from 'react-router-dom'
+import styles from './index.module.scss'
+import EditTop from '@/pages/Zother/EditTop'
+import EditBtn from '@/pages/Zother/EditBtn'
+import { InfoProvider, useInfo } from '@/pages/Zother/InfoContext'
+import { rowArrTemp } from '@/pages/Zother/data'
+import SonGoodsList from '@/pages/Zother/SonGoodsList'
+import { F1_APIgetStorageList, F1API_obj } from '@/store/action/Fstorehouse/F1inStorage'
+import { Button, Dropdown, MenuProps, Select } from 'antd'
+import { selectObj } from '@/utils/dataChange'
+import FileArchive from '@/pages/Zother/FileArchive'
+import {
+  F4_APIgetClueList,
+  F4_APIgetRelatedOrderList,
+  F4API_obj
+} from '@/store/action/Fstorehouse/F4check'
+import { NewPcsCell, PdRemarkCell, PdRemarkModal } from './components'
+import MyTable from '@/components/MyTable'
+import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+import { openLink } from '@/utils/history'
+
+const rowArr = rowArrTemp('入库')
+const registerMenu: MenuProps['items'] = [
+  {
+    key: 'accident',
+    label: '事故登记'
+  },
+  {
+    key: 'actuality',
+    label: '现状登记'
+  },
+  {
+    key: 'repair',
+    label: '修复登记'
+  }
+]
+
+function F1editContent() {
+  const history = useHistory()
+  const { info, setSnapsFu } = useInfo() as { info: any; setSnapsFu: (snaps: any[]) => void }
+  const { key } = useParams<any>()
+  const canEdit = useMemo(() => ['1', '2'].includes(key), [key])
+  const isLook = useMemo(() => ['4'].includes(key), [key])
+  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 [remarkModal, setRemarkModal] = useState<{
+    open: boolean
+    item: any
+    value: string
+    onChange: (v: string) => void
+  } | null>(null)
+  const [relatedOrderList, setRelatedOrderList] = useState<any[]>([])
+
+  const handleStorageChange = useCallback(
+    async (value: string, option: any) => {
+      setSelectStorage(option)
+      setSnapsFu([])
+    },
+    [setSnapsFu]
+  )
+
+  const getStorageList = useCallback(async () => {
+    const res = await F1_APIgetStorageList()
+    setAllWarehouseList(res.data.records)
+  }, [])
+
+  useEffect(() => {
+    getStorageList()
+  }, [getStorageList])
+
+  useEffect(() => {
+    if (!info?.storageId || !allWarehouseList.length) return
+    const opt = warehouseOptions.find((o: any) => o.value === info.storageId)
+    if (opt) {
+      setSelectStorage(opt)
+    }
+  }, [info?.storageId, allWarehouseList.length, warehouseOptions])
+
+  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) => typeof values[`${snap.id}-newPcs`] !== 'number'
+    )
+    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
+      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,
+          newPcs: values[`${v.id}-newPcs`] ?? v.newPcs,
+          pdRemark: values[`${v.id}-pdRemark`] ?? v.pdRemark
+        })
+      }
+    })
+    return {
+      storageId: selectStorage?.value ?? undefined,
+      snaps: snapsArr
+    }
+  }
+
+  const customTableLastBtn = (item: GoodsType) => {
+    return info.status === 4 ? (
+      <Dropdown
+        menu={{
+          items: registerMenu,
+          style: { width: 100 },
+          onClick: ({ key }) => {
+            history.push(`/${key}_edit/1/null?pNum=${`${info.num},${item.id}`}`)
+          }
+        }}
+        placement='bottom'
+      >
+        <Button size='small' type='text'>
+          盘点登记
+        </Button>
+      </Dropdown>
+    ) : null
+  }
+
+  useEffect(() => {
+    if (!isLook || !info.num) return
+    F4_APIgetRelatedOrderList(info.num).then((res: any) => {
+      if (res.code === 0) {
+        setRelatedOrderList(res.data.records)
+      }
+    })
+  }, [info.num, isLook])
+
+  return (
+    <div className={styles.F4edit} id='editBox'>
+      <div className='editMain'>
+        {/* 顶部 */}
+        <EditTop
+          pageTxt='藏品盘点'
+          rowArr={rowArr}
+          APIobj={F1API_obj}
+          fileUpInfo={{ myUrl: 'cms/orderSite/check/upload', dirCode: 'check' }}
+        />
+
+        <div className='F4editStorage'>
+          <p className='F4editStorageTitle'>*盘点库房</p>
+          <Select
+            style={{ width: 200 }}
+            options={warehouseOptions}
+            placeholder='请选择'
+            value={selectStorage?.value}
+            onChange={handleStorageChange}
+            disabled={!canEdit}
+          />
+          {selectStorage?.managerUser && (
+            <p className='F4editStorageManager'>库房负责人:{selectStorage.managerUser}</p>
+          )}
+        </div>
+
+        {/* 藏品清单 */}
+        <SonGoodsList
+          ref={sonGoodsListRef}
+          label={canEdit ? '盘点计划' : '盘点结果'}
+          needEdit={true}
+          btnTxt='选择藏品'
+          addShow={false}
+          goodsSonTable={[
+            ['txt', '库房位置', 'siteLoc'],
+            ['txt', '藏品登记号', 'num'],
+            ['img', '封面', 'thumb'],
+            ['txtCTag', '藏品标签', 'tagDictId'],
+            ['txt', '藏品名称', 'name'],
+            ['select', '级别', 'level', selectObj['藏品级别']],
+            ['txtC', '类别', 'typeDictId'],
+            ['txtC', '年代', 'ageDictId'],
+            ['txtC', '质地', 'textureDictId'],
+            ['select', '完残程度', 'tornLevel', selectObj['完残程度']],
+            ['ping', '盘点前数量', 'pcs', 'pcsUnitDictId'],
+            [
+              'custom',
+              '*盘点后数量',
+              'newPcs',
+              {
+                render(readOnly?: boolean, item?: any) {
+                  return <NewPcsCell item={item} readOnly={!!readOnly} />
+                }
+              }
+            ],
+            [
+              'custom',
+              '盘点备注',
+              'pdRemark',
+              {
+                render(readOnly?: boolean, item?: any) {
+                  return (
+                    <PdRemarkCell
+                      item={item}
+                      readOnly={!!readOnly}
+                      onOpen={(val, onChange) => {
+                        setRemarkModal({
+                          open: true,
+                          item,
+                          value: val,
+                          onChange
+                        })
+                      }}
+                    />
+                  )
+                }
+              }
+            ]
+          ]}
+          fileUpInfo={{ myUrl: 'cms/orderSite/check/upload', dirCode: 'checkGoods' }}
+          selectApi={F4_APIgetClueList}
+          isClueSelect={false}
+          clueShowBtnDisabled={!selectStorage?.value}
+          selectGoodsParams={{
+            storageId: selectStorage?.value
+          }}
+          tableLastWidth={150}
+          customTableLastBtn={customTableLastBtn}
+        />
+
+        <div
+          className='F4editStorage'
+          style={{ flexDirection: 'column', alignItems: 'flex-start' }}
+        >
+          <p className='F4editStorageTitle'>盘点登记</p>
+          <MyTable
+            classKey='SonGoodsList'
+            list={relatedOrderList}
+            columnsTemp={[
+              ['select', '业务类型', 'type', selectObj['维护类型']],
+              ['txt', '申请编号', 'num'],
+              ['txt', '发起部门', 'deptName'],
+              ['txt', '发起人', 'creatorName'],
+              ['txt', '发起日期', 'date'],
+              ['select', '申请状态', 'status', selectObj['藏品入库申请状态']]
+            ]}
+            lastBtn={[
+              {
+                title: '操作',
+                render: (item: GoodsType) => {
+                  return (
+                    <Button
+                      size='small'
+                      type='text'
+                      onClick={() => openLink(`/goodsLook/${item.id}`)}
+                    >
+                      查看
+                    </Button>
+                  )
+                }
+              }
+            ]}
+            pagingInfo={false}
+          />
+        </div>
+
+        {/* 附件归档 */}
+        <FileArchive />
+
+        {/* 盘点备注弹窗 */}
+        <PdRemarkModal
+          readOnly={!canEdit}
+          open={!!remarkModal}
+          value={remarkModal?.value ?? ''}
+          onOk={val => {
+            remarkModal?.onChange(val)
+            setRemarkModal(null)
+          }}
+          onCancel={() => setRemarkModal(null)}
+        />
+
+        {/* 底部按钮 */}
+        <EditBtn
+          path='/check'
+          APIobj={F4API_obj}
+          checkListTxt='请添加藏品'
+          verifyBackFu={verifyBackFu}
+          getExtraData={getExtraData}
+        />
+      </div>
+    </div>
+  )
+}
+
+function F1edit() {
+  return (
+    <InfoProvider>
+      <F1editContent />
+    </InfoProvider>
+  )
+}
+
+const MemoF1edit = React.memo(F1edit)
+
+export default MemoF1edit

+ 118 - 1
src/pages/Fstorehouse/F4check/index.tsx

@@ -1,9 +1,126 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { RootState } from '@/store'
+import { F1_APIgetStorageList } from '@/store/action/Fstorehouse/F1inStorage'
+import { useSelector } from 'react-redux'
+import { useHistory } from 'react-router-dom'
+import TableList from '@/pages/Zother/TableList'
+import { tableListAuditBtnFu } from '@/utils/authority'
+import { selectObj } from '@/utils/dataChange'
+import { checkTableC } from '@/utils/tableData'
+import { Button } from 'antd'
+import { baseFormData } from '@/pages/Zother/data'
+import { F4_APIgetList } from '@/store/action/Fstorehouse/F4check'
+
+const F4baseFormData = baseFormData()
+
 function F4check() {
+  const tableListRef = useRef<any>(null)
+  const history = useHistory()
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.F4check.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)
+  }
+
+  const tableBtnFu = useCallback(
+    (id: number | null, key: string) => {
+      history.push(`/check_edit/${key}/${id}`)
+    },
+    [history]
+  )
+
+  useEffect(() => {
+    getStorageList()
+  }, [])
+
   return (
     <div className={styles.F4check}>
       <div className='pageTitle'>藏品盘点</div>
+
+      <TableList
+        ref={tableListRef}
+        baseFormData={F4baseFormData}
+        getListAPI={F4_APIgetList}
+        pageKey='position'
+        tableInfo={tableInfo}
+        columnsTemp={checkTableC}
+        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={() => tableBtnFu(null, '1')}>
+              发起申请
+            </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' onClick={() => tableBtnFu(item.id, '4')}>
+                  查看
+                </Button>
+                {tableListAuditBtnFu(item) ? (
+                  <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
+                    审批
+                  </Button>
+                ) : null}
+              </>
+            )
+          }
+        ]}
+      />
     </div>
   )
 }

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

@@ -376,5 +376,11 @@ export const routerSon: RouterTypeRow[] = [
     name: '藏品出库-详情页',
     path: '/outStorage_edit/:key/:id',
     Com: React.lazy(() => import('../Fstorehouse/F3outStorage/F3edit'))
+  },
+  {
+    id: 1040,
+    name: '藏品盘点-详情页',
+    path: '/check_edit/:key/:id',
+    Com: React.lazy(() => import('../Fstorehouse/F4check/F4edit'))
   }
 ]

+ 1 - 1
src/pages/ZgoodsInfo/GItab2/index.tsx

@@ -20,7 +20,7 @@ function GItab2({ info }: Props) {
   return (
     <div className={styles.GItab2}>
       {/* 待完善sg -等陈磊/伟浩写完库房相关*/}
-      <h2>库存状态:{goodsStatus}</h2>
+      <h2>库存状态(开发中):{goodsStatus}</h2>
 
       {!info.siteStatus || [1, 2, 5].includes(info.siteStatus) || !info.storageId ? (
         <div className='GImainNone'>当前状态无库存信息</div>

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

@@ -10,5 +10,8 @@
         }
       }
     }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 2 - 1
src/pages/ZgoodsInfo/GItab3/index.tsx

@@ -165,7 +165,7 @@ function GItab3({ info, fileList }: Props) {
             >
               下载
             </Button>
-            <Button size='small' type='text'>
+            <Button size='small' type='text' onClick={() => MessageFu.warning('开发中')}>
               设置
             </Button>
             <Button size='small' type='text' onClick={() => setDownLogId(item.id)}>
@@ -205,6 +205,7 @@ function GItab3({ info, fileList }: Props) {
       {/* 表格 */}
       <MyTable
         classKey='GItab3'
+        yHeight={550}
         list={tableObj[btnAc] || []}
         columnsTemp={GI3tableC}
         lastBtn={tableLastBtn}

+ 13 - 3
src/pages/ZgoodsInfo/GItab4/index.module.scss

@@ -1,7 +1,17 @@
 .GItab4 {
-  width: 100%;
-  height: 100%;
-  overflow-y: auto;
   :global {
+    .GI4top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      & > div {
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 162 - 34
src/pages/ZgoodsInfo/GItab4/index.tsx

@@ -1,43 +1,171 @@
-import React, { useEffect } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
-function GItab4() {
+import { Button, Input } from 'antd'
+import { E2_APIgetList } from '@/store/action/Eculture/E2story'
+import MyTable from '@/components/MyTable'
+import { GI4tableC } from '@/utils/tableData'
+import { GuShiType } from '@/pages/Zother/GuShi/data'
+import GuShiMo from '@/pages/Zother/GuShi/GuShiMo'
+import history from '@/utils/history'
+
+const baseFormData = {
+  searchKey: '',
+  pageNum: 1,
+  pageSize: 10
+}
+
+type Props = {
+  goodId: number
+}
+
+function GItab4({ goodId }: Props) {
+  const [tableObj, setTableObj] = useState<{ list: GuShiType[]; total: number }>({
+    list: [],
+    total: 0
+  })
+
+  const [formData, setFormData] = useState({ ...baseFormData })
+
+  const formDataRef = useRef({ ...baseFormData })
+
   useEffect(() => {
-    console.log('GItab4')
+    formDataRef.current = formData
+  }, [formData])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, pageNum: 1 })
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 封装发送请求的函数
+  const getListFu = useCallback(async () => {
+    if (goodId) {
+      const params = {
+        ...formDataRef.current,
+        goodId
+      }
+
+      const res = await E2_APIgetList(params, true)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records || [],
+          total: res.data.total
+        }
+        setTableObj(obj)
+      }
+    }
+  }, [goodId])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu, timeKey])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: any) => {
+      setFormData({
+        ...formData,
+        [key]: txt
+      })
+    },
+    [formData]
+  )
+  // 点击重置
+  const resetSelectFu = useCallback(() => {
+    setFormData({ ...baseFormData })
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
   }, [])
 
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: GuShiType) => (
+          <>
+            <Button size='small' type='text' onClick={() => setAddInfo(item)}>
+              编辑
+            </Button>
+            <Button
+              size='small'
+              type='text'
+              onClick={() => history.push(`/story_edit/4/${item.id}`)}
+            >
+              查看
+            </Button>
+          </>
+        )
+      }
+    ]
+  }, [])
+
+  // 打开弹窗
+  const [addInfo, setAddInfo] = useState({} as GuShiType)
+
   return (
     <div className={styles.GItab4}>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
-      <h1>GItab4</h1>
+      <div className='GI4top'>
+        <div>
+          <Input
+            style={{ width: 300 }}
+            placeholder='请输入故事名称'
+            maxLength={30}
+            value={formData.searchKey}
+            onChange={e => txtChangeFu(e.target.value, 'searchKey')}
+          />
+          <Button type='primary' onClick={clickSearch}>
+            查询
+          </Button>
+          <Button onClick={resetSelectFu}>重置</Button>
+        </div>
+        <Button type='primary' onClick={() => setAddInfo({ id: -1 } as GuShiType)}>
+          新增故事
+        </Button>
+      </div>
+
+      <MyTable
+        classKey='GItab4'
+        yHeight={510}
+        list={tableObj.list}
+        columnsTemp={GI4tableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableObj.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+        widthSet={{ remark: 800 }}
+      />
+
+      {addInfo.id ? (
+        <GuShiMo
+          goodIds={goodId}
+          moduleId=''
+          guShiInfo={addInfo}
+          closeFu={() => setAddInfo({} as GuShiType)}
+          succFu={(val, info) => {
+            if (val === '新增') resetSelectFu()
+            else clickSearch()
+          }}
+        />
+      ) : null}
     </div>
   )
 }

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

@@ -19,6 +19,7 @@ import GItab5 from './GItab5'
 import { MessageFu } from '@/utils/message'
 import { FileListType } from '@/components/Z3upFiles/data'
 import { API_getFileListByIds } from '@/store/action/Cledger/C4file'
+import { infoPageIDGet, infoPageIDSet } from '@/utils/storage'
 
 type tabArr1Type = {
   id: number
@@ -70,7 +71,7 @@ function ZgoodsInfo() {
         show: false,
         Dom: <GItab3 info={info} fileList={fileList} />
       },
-      { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
+      { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 goodId={info.id} /> },
       { id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
     ]
   }, [fileList, info])
@@ -201,7 +202,13 @@ function ZgoodsInfo() {
   useEffect(() => {
     const newArr1 = tabArr1Temp.filter(v => authorityIds.includes(v.id))
     if (newArr1.length) {
-      newArr1[0].done = newArr1[0].show = true
+      let index = 0
+      const acId = infoPageIDGet()
+      if (acId) {
+        const index22 = newArr1.findIndex(c => c.id === acId)
+        if (index22 >= 0) index = index22
+      }
+      newArr1[index].done = newArr1[index].show = true
     }
     setTimeout(() => {
       setLoding(true)
@@ -228,6 +235,7 @@ function ZgoodsInfo() {
   // 切换左侧tab
   const cutTabFu = useCallback(
     (id: number) => {
+      infoPageIDSet(id)
       setTabArr1(
         tabArr1.map(v => ({
           ...v,
@@ -295,7 +303,7 @@ function ZgoodsInfo() {
           </>
         ) : (
           <div className='GImainNone' hidden={!loding}>
-            该页面请联系管理员!
+            您没有该页面权限,请联系管理员!
           </div>
         )}
       </div>

+ 3 - 2
src/pages/Zother/EditTop/index.tsx

@@ -120,10 +120,11 @@ function EditTop({ rowArr, pageTxt, APIobj, fileUpInfo, moreDom }: Props) {
 
           arrTemp.push(obj)
 
+          let obj2: any = {}
+          // 回显盘点
+
           // 第二个模块的信息回显
           if (moreDom && moreDom.domList && moreDom.domList.length && i === 0) {
-            let obj2: any = {}
-
             moreDom.domList.forEach((item: any) => {
               obj2[item.key] = obj[item.key]
             })

+ 7 - 3
src/pages/Zother/GuShi/GuShiMo/index.tsx

@@ -14,9 +14,11 @@ type Props = {
   guShiInfo: GuShiType
   closeFu: () => void
   succFu: (val: '新增' | '编辑', info: GuShiType) => void
-  moduleId: number
+  moduleId: number | ''
+  isLook?: boolean
+  goodIds?: number
 }
-function GuShiMo({ guShiInfo, closeFu, succFu, moduleId }: Props) {
+function GuShiMo({ guShiInfo, closeFu, succFu, moduleId, isLook = false, goodIds }: Props) {
   const [info, setInfo] = useState<GuShiType>({
     id: -1,
     name: '',
@@ -67,6 +69,8 @@ function GuShiMo({ guShiInfo, closeFu, succFu, moduleId }: Props) {
       rtf: rtf.val
     }
 
+    if (goodIds) obj.goodIds = goodIds
+
     const res = await guShiAPI_add(obj)
 
     if (res.code === 0) {
@@ -74,7 +78,7 @@ function GuShiMo({ guShiInfo, closeFu, succFu, moduleId }: Props) {
       succFu(info.id > 0 ? '编辑' : '新增', res.data)
       closeFu()
     }
-  }, [closeFu, info.id, info.name, info.remark, succFu])
+  }, [closeFu, goodIds, info.id, info.name, info.remark, succFu])
 
   return (
     <Modal

+ 12 - 3
src/pages/Zother/SonGoodsList/index.tsx

@@ -39,6 +39,9 @@ type Props = {
   // 选择列表按钮是否禁用
   clueShowBtnDisabled?: boolean
   selectGoodsParams?: any
+  label?: string
+  customTableLastBtn?: (item: GoodsType) => React.ReactNode
+  tableLastWidth?: number
 }
 
 function SonGoodsList(
@@ -53,7 +56,10 @@ function SonGoodsList(
     goodsSonTable,
     customRightBtn,
     clueShowBtnDisabled,
-    selectGoodsParams
+    selectGoodsParams,
+    label = '藏品清单',
+    customTableLastBtn,
+    tableLastWidth
   }: Props,
   ref: any
 ) {
@@ -73,6 +79,7 @@ function SonGoodsList(
     return [
       {
         title: '操作',
+        width: tableLastWidth,
         render: (item: GoodsType) => {
           return (
             <>
@@ -96,12 +103,13 @@ function SonGoodsList(
                   />
                 </>
               )}
+              {customTableLastBtn ? customTableLastBtn(item) : null}
             </>
           )
         }
       }
     ]
-  }, [addShow, isLook, setSnapsFu, snaps])
+  }, [tableLastWidth, isLook, addShow, customTableLastBtn, setSnapsFu, snaps])
 
   // 从征集线索中添加
   const [clueShow, setClueShow] = useState(false)
@@ -114,7 +122,7 @@ function SonGoodsList(
   return (
     <div className={styles.SonGoodsList}>
       <div className='EdTit'>
-        <div>藏品清单</div>
+        <div>{label}</div>
         {isLook ? (
           <div></div>
         ) : (
@@ -141,6 +149,7 @@ function SonGoodsList(
             columnsTemp={goodsSonTable || goodsSonTableC()}
             lastBtn={tableLastBtn}
             pagingInfo={false}
+            readOnly={isLook}
           />
         ) : (
           <MyTable

+ 12 - 9
src/store/action/Eculture/E2story.ts

@@ -4,16 +4,19 @@ import http from '@/utils/http'
 /**
  * 故事 - 获取分页列表
  */
-export const E2_APIgetList = (data: any): any => {
-  return async (dispatch: AppDispatch) => {
-    const res = await http.post('cms/story/page', data)
-    if (res.code === 0) {
-      const obj = {
-        list: res.data.records,
-        total: res.data.total
-      }
+export const E2_APIgetList = (data: any, res?: boolean): any => {
+  if (res) return http.post('cms/story/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/story/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
 
-      dispatch({ type: 'E2/getList', payload: obj })
+        dispatch({ type: 'E2/getList', payload: obj })
+      }
     }
   }
 }

+ 50 - 0
src/store/action/Fstorehouse/F4check.ts

@@ -0,0 +1,50 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+import { APIbase } from '../layout'
+
+/**
+ * 藏品盘点 - 分页列表
+ */
+export const F4_APIgetList = (data: any, res?: boolean): any => {
+  if (res) {
+    return http.post('cms/orderSite/check/page', { pageNum: 1, pageSize: 99999, status: 4 })
+  } else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/orderSite/check/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'F4/getList', payload: obj })
+      }
+    }
+  }
+}
+
+export const F4API_obj = {
+  创建订单: () => APIbase('get', 'cms/orderSite/check/create'),
+  获取详情: (id: number) => APIbase('get', `cms/orderSite/check/detail/${id}`),
+  草稿: (data: any) => APIbase('post', `cms/orderSite/check/saveDraft`, data),
+  发起: (data: any) => APIbase('post', `cms/orderSite/check/saveApply`, data),
+  重新发起: (id: number) => APIbase('get', `cms/orderSite/check/reissue/${id}`),
+  审批: (data: any) => APIbase('post', `cms/orderSite/check/audit`, data),
+  撤回: (id: number) => APIbase('get', `cms/orderSite/check/revocation/${id}`),
+  删除: (id: number) => APIbase('get', `cms/orderSite/check/remove/${id}`)
+}
+
+/**
+ * 藏品总账列表-分页
+ */
+export const F4_APIgetClueList = (data: any) => {
+  return http.post('cms/orderSite/check/goodPage', data)
+}
+
+/**
+ * 盘点登记-列表
+ * type: SG-事故登记 XZ-现状登记 XF-修复登记
+ */
+export const F4_APIgetRelatedOrderList = (num: string, type?: 'SG' | 'XZ' | 'XF') => {
+  return http.get(`cms/orderSite/check/relatedOrderByNum/${num}`, { params: { type } })
+}

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

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

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

@@ -16,6 +16,7 @@ import E2story from './Eculture/E2story'
 import G1accident from './Gmaintain/G1accident'
 import F1inStorage from './Fstorehouse/F1inStorage'
 import F3outStorage from './Fstorehouse/F3outStorage'
+import F4check from './Fstorehouse/F4check'
 import I1storageSet from './Isystem/I1storageSet'
 import I2dict from './Isystem/I2dict'
 import I3numSet from './Isystem/I3numSet'
@@ -43,7 +44,7 @@ const rootReducer = combineReducers({
 
   F1inStorage,
   F3outStorage,
-
+  F4check,
   I1storageSet,
   I2dict,
   I3numSet,

+ 5 - 0
src/utils/dataChange.tsx

@@ -151,6 +151,11 @@ export const selectObj = {
     { value: 'video', label: '视频' },
     { value: 'doc', label: '文档' },
     { value: 'other', label: '其他' }
+  ],
+  维护类型: [
+    { value: 'SG', label: '事故登记' },
+    { value: 'XZ', label: '现状登记' },
+    { value: 'XF', label: '修复登记' }
   ]
 }
 

+ 4 - 0
src/utils/history.ts

@@ -1,4 +1,5 @@
 import { createHashHistory } from 'history'
+import { infoPageIDSet } from './storage'
 const history = createHashHistory()
 export default history
 
@@ -16,6 +17,9 @@ export const loginOutFu = () => {
 
 // 新窗口打开藏品详情页面
 export const openLink = (path: string) => {
+  // 清空藏品详情页的id存储
+  infoPageIDSet(0)
+
   const urlAll = window.location.href
   const qian = urlAll.split('/#/')[0]
   window.open(`${qian}/#${path}`, '_blank')

+ 16 - 0
src/utils/storage.ts

@@ -64,3 +64,19 @@ export const changSetFu = (info: RouterTypeRow): void => {
 export const changGetFu = (): RouterTypeRow[] => {
   return JSON.parse(localStorage.getItem(CHANG_KEY) || '[]')
 }
+
+// ------------------藏品详情id,回跳需要
+const GOODPAGE_KEY = 'QING_DAO_PI_JIU_GOODPAGE_KEY'
+
+// 存
+export const infoPageIDSet = (id: number) => {
+  localStorage.setItem(GOODPAGE_KEY, id + '')
+}
+
+// 取
+export const infoPageIDGet = () => {
+  let res = 0
+  let txt = localStorage.getItem(GOODPAGE_KEY) || ''
+  if (txt) res = Number(txt)
+  return res
+}

+ 17 - 0
src/utils/tableData.ts

@@ -185,3 +185,20 @@ export const GI3tableC = [
   ['txtC', '上传人', 'creatorName'],
   ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
 ]
+
+export const GI4tableC = [
+  ['txt', '故事名称', 'name'],
+  ['text', '备注', 'remark', 50],
+  ['txt', '编辑人', 'creatorName']
+]
+
+// 藏品盘点
+export const checkTableC = [
+  ['txt', '盘点日期', 'createTime'],
+  ['txt', '盘点库房', 'storageName'],
+  ['txt', '申请编号', 'num'],
+  ['txt', '发起部门', 'deptName'],
+  ['txt', '发起人', 'creatorName'],
+  ['txt', '发起日期', 'date'],
+  ['select', '申请状态', 'status', selectObj['藏品入库申请状态']]
+]