shaogen1995 3 months ago
parent
commit
e78229f47a

+ 19 - 0
src/components/ZupFileTable/index.module.scss

@@ -0,0 +1,19 @@
+.ZupFileTable {
+  padding-right: 20px;
+  :global {
+    .ZZtop {
+      margin-top: 24px;
+      display: flex;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 20px;
+      & > h3 {
+        font-size: 18px;
+        font-weight: 700;
+        padding-left: 18px;
+        margin-bottom: 17px;
+        color: var(--themeColor);
+      }
+    }
+  }
+}

+ 134 - 0
src/components/ZupFileTable/index.tsx

@@ -0,0 +1,134 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { FileListType } from '../ZupTypes'
+import { Button } from 'antd'
+import { MessageFu } from '@/utils/message'
+import { API_upFile } from '@/store/action/layout'
+import { fileDomInitialFu } from '@/utils/domShow'
+import MyTable from '../MyTable'
+import MyPopconfirm from '../MyPopconfirm'
+import { ZypFileTable } from '@/utils/tableData'
+import { baseURL } from '@/utils/http'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { API_C2dels } from '@/store/action/C2files'
+
+type Props = {
+  listTemp: FileListType[]
+  dirCode: string //文件的code码
+  myUrl: string //请求地址
+  size?: number
+  fromData?: any
+}
+
+function ZupFileTable({ listTemp, dirCode, myUrl, size = 500, fromData }: Props) {
+  const [list, setList] = useState<FileListType[]>([])
+
+  useEffect(() => {
+    setList(listTemp)
+  }, [listTemp])
+
+  // 点击上传附件按钮
+  const myInput = useRef<HTMLInputElement>(null)
+
+  // 上传附件的处理函数
+  const handeUpPhoto = useCallback(
+    async (e: React.ChangeEvent<HTMLInputElement>) => {
+      if (e.target.files) {
+        // 拿到files信息
+        const filesInfo = e.target.files[0]
+
+        // 校验大小
+        if (filesInfo.size > size * 1024 * 1024) {
+          e.target.value = ''
+          return MessageFu.warning(`最大支持${size}M!`)
+        }
+        // 创建FormData对象
+        const fd = new FormData()
+        // 把files添加进FormData对象(‘photo’为后端需要的字段)
+        fd.append('dirCode', dirCode)
+        fd.append('isDb', 'true')
+        fd.append('type', 'doc')
+        fd.append('binding', '1')
+        fd.append('file', filesInfo)
+
+        if (fromData) {
+          for (const k in fromData) {
+            if (fromData[k]) fd.append(k, fromData[k])
+          }
+        }
+
+        // 开启压缩图片
+        // fd.append('isCompress', 'true')
+
+        e.target.value = ''
+
+        const res = await API_upFile(fd, myUrl)
+
+        try {
+          if (res.code === 0) {
+            MessageFu.success('上传成功!')
+            setList([...list, res.data])
+          }
+          fileDomInitialFu()
+        } catch (error) {
+          fileDomInitialFu()
+        }
+      }
+    },
+    [dirCode, fromData, list, myUrl, size]
+  )
+
+  const userInfo = useSelector((state: RootState) => state.A0Layout.userInfo)
+
+  // 点击删除
+  const delFu = useCallback(
+    async (data: number[]) => {
+      const res = await API_C2dels(data)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        setList(list.filter(v => v.id !== data[0]))
+      }
+    },
+    [list]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: FileListType) => (
+          <>
+            <Button size='small' type='text'>
+              <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
+                下载
+              </a>
+            </Button>
+            {userInfo.id === item.creatorId ? (
+              <MyPopconfirm txtK='删除' onConfirm={() => delFu([item.id])} />
+            ) : null}
+          </>
+        )
+      }
+    ]
+  }, [delFu, userInfo.id])
+
+  return (
+    <div className={styles.ZupFileTable}>
+      <input id='upInput' type='file' accept='*' ref={myInput} onChange={e => handeUpPhoto(e)} />
+      <div className='ZZtop'>
+        <h3>归档附件</h3>
+        <Button type='primary' onClick={() => myInput.current?.click()}>
+          上传归档
+        </Button>
+      </div>
+
+      {/* 表格 */}
+      <MyTable list={list} columnsTemp={ZypFileTable} lastBtn={tableLastBtn} pagingInfo={false} />
+    </div>
+  )
+}
+
+const MemoZupFileTable = React.memo(ZupFileTable)
+
+export default MemoZupFileTable

+ 1 - 0
src/components/ZupTypes/index.tsx

@@ -27,6 +27,7 @@ export type FileListType = {
   id: number
   type: 'model' | 'img' | 'audio' | 'video'
   imgName: string
+  creatorId: number
 }
 
 type Props = {

+ 6 - 0
src/pages/A3_ledger/C1ledger/type.d.ts

@@ -116,4 +116,10 @@ export type C1GoodType = {
 
   // 入藏去向
   accountType: string
+
+  // 文物修复
+  txt1: string
+  txt2: string
+  txt3: string
+  id2: number
 }

+ 1 - 1
src/pages/A_workbench/A1dataSta/index.tsx

@@ -197,7 +197,7 @@ function A1dataSta() {
               <div>124件</div>
             </div>
             <div className='A1card'>
-              <p>修复登记</p>
+              <p>文物修复</p>
               <div>124件</div>
             </div>
           </div>

+ 6 - 0
src/pages/B_enterTibet/B3_4page/type.d.ts

@@ -82,4 +82,10 @@ export type FourTableType = {
   // v1.1.1总账和分账
   accountIndoor: string
   accountType: string
+
+  // V1.1.1文物修复
+  dateStart: string
+  dateEnd: string
+  // v1.1.1附件归档
+  filing: FileImgListType[]
 }

+ 119 - 0
src/pages/E_goodsStorage/E4repair/E4edit/index.module.scss

@@ -0,0 +1,119 @@
+.E4edit {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px 0px;
+  :global {
+    .E4Tit {
+      font-size: 18px;
+      font-weight: 700;
+      padding-bottom: 10px;
+      padding-left: 18px;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 17px;
+      color: var(--themeColor);
+      .ant-btn {
+        margin-left: 15px;
+        pointer-events: none;
+      }
+    }
+
+    .E4Tit2 {
+      margin-top: 24px;
+      display: flex;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 20px;
+      .E4Tit2ll {
+        font-size: 18px;
+        font-weight: 700;
+        padding-left: 18px;
+        margin-bottom: 17px;
+        color: var(--themeColor);
+      }
+      .E4Tit2rr {
+        position: relative;
+        z-index: 2;
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+
+    .E4main {
+      width: 100%;
+      height: calc(100% - 70px);
+      overflow-y: auto;
+      padding-bottom: 40px;
+
+      .E4rowAll {
+        display: flex;
+        justify-content: space-between;
+        align-items: self-start;
+        font-size: 16px;
+        flex-wrap: wrap;
+        .E4row {
+          width: 48%;
+          display: flex;
+          align-items: center;
+          margin-bottom: 20px;
+          min-height: 32px;
+          .E4rowll {
+            width: 110px;
+            text-align: right;
+            font-weight: 700;
+            & > span {
+              color: #ff4e4f;
+            }
+          }
+          .E4rowrr {
+            width: calc(100% - 110px);
+            .ant-input-affix-wrapper {
+              width: 300px;
+            }
+            .ant-select {
+              width: 300px;
+            }
+          }
+        }
+        .E4row2 {
+          align-items: self-start;
+          .E4rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+        .E4row3 {
+          position: relative;
+          top: 4px;
+        }
+
+        .E4rowFull {
+          width: 100%;
+          align-items: self-start;
+          margin-bottom: 0;
+          .E4rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+      }
+
+      // 藏品清单
+      .E4googsBox {
+        padding-right: 20px;
+      }
+    }
+
+    .E4btn {
+      position: absolute;
+      bottom: 20px;
+      left: 134px;
+      .ant-btn {
+        margin-right: 20px;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
+  }
+}

+ 627 - 0
src/pages/E_goodsStorage/E4repair/E4edit/index.tsx

@@ -0,0 +1,627 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useParams } from 'react-router-dom'
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+import {
+  E4_APIcreate,
+  E4_APIdel,
+  E4_APIgetInfo,
+  E4_APIrevocation,
+  E4_APIsaveApply,
+  E4_APIsaveAudit,
+  E4_APIsaveCreate,
+  E4_APIsaveDraft
+} from '@/store/action/E4repair'
+import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
+import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
+import classNames from 'classnames'
+import { Button, DatePicker, Input } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import TextArea from 'antd/es/input/TextArea'
+import { EXbtnFu } from '@/utils/EXBtn'
+import X3auditInfo from '@/pages/X_stock/X3auditInfo'
+import { E4tableCgoods, statusObj } from '@/utils/tableData'
+import Z3upFiles from '@/components/Z3upFiles'
+import ZRichTexts from '@/components/ZRichTexts'
+import MyTable from '@/components/MyTable'
+import B3flowTable from '@/pages/B_enterTibet/B3flowTable'
+import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
+import B3GaddNow from '@/pages/B_enterTibet/B3goodsTable/B3GaddNow'
+import ZupFileTable from '@/components/ZupFileTable'
+
+function E4edit() {
+  const { key, id } = useParams<any>()
+  // key:1 新增 2编辑 3审批 4查看
+  // 滚到顶部
+  const sollrDom = useRef<HTMLDivElement>(null)
+  // 顶部数据
+  const [topInfo, setTopInfo] = useState({} as FourTableType)
+
+  // 藏品清单快照数据
+  const [snaps, setSnaps] = useState<C1GoodType[]>([])
+
+  const snapsID2ref = useRef<{ goodsId: number; id: number }[]>([])
+
+  // 创建订单
+  const creatFu = useCallback(async () => {
+    const res = await E4_APIcreate()
+    if (res.code === 0) {
+      setTopInfo(res.data)
+    }
+  }, [])
+
+  // 获取详情
+  const getInfoFu = useCallback(async () => {
+    const res = await E4_APIgetInfo(id)
+    if (res.code === 0) {
+      const data = res.data
+
+      setTopInfo(data)
+      // 设置富文本
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf || '{}'))
+
+      // 藏品清单快照信息id对比
+      const arrTemp: any = []
+      const snapsTemp = data.snaps || []
+
+      snapsTemp.forEach((v: any) => {
+        snapsID2ref.current.push({ goodsId: v.goodsId, id: v.id })
+
+        const obj = JSON.parse(v.snap || '{}')
+        if (obj.id) obj.id2 = v.id
+
+        arrTemp.push(obj)
+      })
+      setSnaps(arrTemp)
+    }
+  }, [id])
+
+  useEffect(() => {
+    if (key === '1') creatFu()
+    else getInfoFu()
+
+    if (sollrDom.current) sollrDom.current.scrollTop = 0
+  }, [creatFu, getInfoFu, key])
+
+  const pageTitTxt = useMemo(() => {
+    return Reflect.get(pageTitTxtObj, key)
+  }, [key])
+
+  const timeChange = useCallback(
+    (e: any, key: 'dateStart' | 'dateEnd') => {
+      setTopInfo({ ...topInfo, [key]: dayjs(e).format('YYYY-MM-DD') })
+    },
+    [topInfo]
+  )
+
+  // 上传附件的ref
+  const filesRef = useRef<any>(null)
+
+  // 备注的ref
+  const ZRichTextRef = useRef<any>(null)
+
+  // 审批意见的ref
+  const ZAuditRef = useRef<any>(null)
+
+  // 审批的sta
+  const [auditSta, setAuDitSta] = useState('')
+
+  // 字段的校验
+  const checkFu = useCallback(() => {
+    if (!topInfo.authUnit) {
+      MessageFu.warning('请输入交修部门')
+      return true
+    }
+    if (!topInfo.dateStart) {
+      MessageFu.warning('请选择交修日期')
+      return true
+    }
+  }, [topInfo])
+
+  // 新增的底部按钮点击
+  const btnClickFu = useCallback(
+    async (val: '草稿' | '创建' | '保存' | '审批') => {
+      if (checkFu()) {
+        if (sollrDom.current) sollrDom.current.scrollTop = 0
+        return
+      }
+
+      if (val !== '草稿') {
+        if (snaps.length === 0) return MessageFu.warning('请添加藏品')
+      }
+
+      if (val === '审批') {
+        // console.log('审批信息富文本', rtf2)
+        if (!auditSta) {
+          if (sollrDom.current) sollrDom.current.scrollTop = 0
+          return MessageFu.warning('请选择审批结果')
+        }
+        const rtf2 = ZAuditRef.current?.resData()
+
+        const res = await E4_APIsaveAudit({
+          orderId: topInfo.id,
+          rtfOpinion: rtf2,
+          status: auditSta === '同意' ? 1 : 2
+        })
+
+        if (res.code === 0) {
+          MessageFu.success('审批成功')
+          // 跳详情页
+          history.push(`/repair_edit/4/${topInfo.id}`)
+        }
+      } else {
+        // 多个富文本
+        const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
+
+        // 上传附件
+        const filesRes = filesRef.current.filesIdRes()
+
+        const obj = {
+          ...topInfo,
+          rtf: JSON.stringify(rtf1.val || ''),
+          fileIds: filesRes.join(','),
+          goodsIds: snaps.map(v => v.id).join(','),
+          snaps: snaps.map(v => ({
+            goodsId: v.id,
+            id: v.id2 ? v.id2 : null,
+            orderId: topInfo.id,
+            snap: JSON.stringify(v)
+          }))
+        }
+        // console.log(123, obj.snaps)
+
+        // if (1 + 1 === 2) return
+
+        if (val === '草稿') {
+          // 存草稿 当前页保存 不跳转
+          const res = await E4_APIsaveDraft(obj)
+          if (res.code === 0) {
+            MessageFu.success('草稿保存成功')
+          }
+        } else {
+          const res = val === '创建' ? await E4_APIsaveCreate(obj) : await E4_APIsaveApply(obj)
+          if (res.code === 0) {
+            MessageFu.success(`${val}成功`)
+            // 跳到详情页
+            history.push(`/repair_edit/4/${topInfo.id}`)
+          }
+        }
+      }
+    },
+    [auditSta, checkFu, snaps, topInfo]
+  )
+
+  // 打开侧边栏
+  const [cathet, setCathet] = useState(0)
+
+  const startBtn = useMemo(() => {
+    return [
+      {
+        title: '藏品编号',
+        render: (item: C1GoodType) => {
+          return (
+            <span
+              onClick={() => setCathet(item.id)}
+              className={classNames('D1GtNum', item.id === cathet ? 'D1GtNumAc' : '')}
+            >
+              {item.num}
+            </span>
+          )
+        }
+      }
+    ]
+  }, [cathet])
+
+  // 表格的输入框改变
+  const tableInputChange = useCallback(
+    (id: number, val: string, key: 'txt1') => {
+      setSnaps(
+        snaps.map(v => ({
+          ...v,
+          [key]: v.id === id ? val : v[key]
+        }))
+      )
+    },
+    [snaps]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    const arrTemp = [
+      { name: '损坏情况', key: 'txt1' },
+      { name: '修复意见', key: 'txt2' },
+      { name: '批准文号', key: 'txt3' }
+    ]
+
+    const arr: any = []
+
+    arrTemp.forEach(v => {
+      arr.push({
+        title: v.name,
+        width: 200,
+        render: (item: C1GoodType) => {
+          return (
+            <TextArea
+              readOnly={['3', '4'].includes(key)}
+              placeholder={
+                ['3', '4'].includes(key) && !item[v.key as 'txt1']
+                  ? '(空)'
+                  : '请输入内容,不超过200字'
+              }
+              maxLength={200}
+              value={item[v.key as 'txt1']}
+              onChange={e => tableInputChange(item.id, e.target.value, v.key as 'txt1')}
+            />
+          )
+        }
+      })
+    })
+
+    arr.push({
+      title: '操作',
+      render: (item: C1GoodType) => {
+        return (
+          <>
+            <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
+              查看
+            </Button>
+            {['3', '4'].includes(key) ? null : (
+              <MyPopconfirm
+                txtK='删除'
+                onConfirm={() => setSnaps(snaps.filter(v => v.id !== item.id))}
+              />
+            )}
+          </>
+        )
+      }
+    })
+
+    return arr
+  }, [key, snaps, tableInputChange])
+
+  // 点击添加按钮
+  const [nowSta, setNowSta] = useState({ key: '', id: '' })
+
+  // 查看的按钮创建-提交-撤回
+  const lookBtnFu = useCallback(
+    async (val: '创建' | '提交' | '撤回') => {
+      if (val !== '撤回') {
+        if (snaps.length === 0) return MessageFu.warning('请添加藏品')
+      }
+
+      // 富文本
+      const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
+
+      // 上传附件
+      const filesRes = filesRef.current.filesIdRes()
+      const obj = {
+        ...topInfo,
+        rtf: JSON.stringify(rtf1.val || ''),
+        fileIds: filesRes.join(','),
+        goodsIds: snaps.map(v => v.id).join(','),
+        snaps: snaps.map(v => ({
+          goodsId: v.id,
+          id: v.id2 ? v.id2 : null,
+          orderId: topInfo.id,
+          snap: JSON.stringify(v)
+        }))
+      }
+
+      // console.log(123, obj.snaps)
+
+      // if (1 + 1 === 2) return
+
+      const res =
+        val === '创建'
+          ? await E4_APIsaveCreate(obj)
+          : val === '提交'
+          ? await E4_APIsaveApply(obj)
+          : await E4_APIrevocation(id)
+
+      if (res.code === 0) {
+        if (sollrDom.current) sollrDom.current.scrollTop = 0
+        MessageFu.success(val + '成功')
+        getInfoFu()
+      }
+    },
+    [getInfoFu, id, snaps, topInfo]
+  )
+
+  // 查看模式点击删除
+  const delFu = useCallback(async () => {
+    const res = await E4_APIdel(id)
+    if (res.code === 0) {
+      MessageFu.success('删除成功')
+      history.push('/repair')
+    }
+  }, [id])
+
+  // 查看模式点击审批 编辑
+  const lookJumpFu = useCallback(
+    (val: '审批' | '编辑') => {
+      history.push(`/repair_edit/${val === '审批' ? 3 : 2}/${id}`)
+      MessageFu.success(`已跳转至${val}页面`)
+    },
+    [id]
+  )
+
+  // 查看模式下的按钮
+  const lookBtn = useMemo(() => {
+    return (
+      <>
+        {btnFlagFu2(topInfo)['创建'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('创建')}>
+            创建
+          </Button>
+        ) : null}
+        {btnFlagFu2(topInfo)['提交'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('提交')}>
+            提交
+          </Button>
+        ) : null}
+
+        {btnFlagFu2(topInfo)['撤回'] ? (
+          <MyPopconfirm
+            txtK='撤回'
+            onConfirm={() => lookBtnFu('撤回')}
+            Dom={
+              <Button type='primary' danger>
+                撤回
+              </Button>
+            }
+          />
+        ) : null}
+
+        {btnFlagFu2(topInfo)['审批'] ? (
+          <Button type='primary' onClick={() => lookJumpFu('审批')}>
+            审批
+          </Button>
+        ) : null}
+        {btnFlagFu2(topInfo)['编辑'] ? (
+          <Button type='primary' onClick={() => lookJumpFu('编辑')}>
+            编辑
+          </Button>
+        ) : null}
+
+        {btnFlagFu2(topInfo)['重新提交'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('提交')}>
+            重新提交
+          </Button>
+        ) : null}
+
+        {EXbtnFu(topInfo)}
+
+        {btnFlagFu2(topInfo)['删除'] ? (
+          <MyPopconfirm
+            txtK='删除'
+            onConfirm={() => delFu()}
+            Dom={
+              <Button type='primary' danger>
+                删除
+              </Button>
+            }
+          />
+        ) : null}
+
+        <Button onClick={() => history.push('/repair')}>返回</Button>
+      </>
+    )
+  }, [delFu, lookBtnFu, lookJumpFu, topInfo])
+
+  // 申请记录
+  const [auditsShow, setAuditsShow] = useState(false)
+
+  return (
+    <div className={styles.E4edit}>
+      <div className='pageTitle'>文物修复-{pageTitTxt}</div>
+
+      <div className='E4main'>
+        {['3'].includes(key) ? (
+          <X3auditInfo
+            dirCode='E4repair'
+            myUrl='cms/orderPreserveFix/upload'
+            auditSta={auditSta}
+            auditStaFu={val => setAuDitSta(val)}
+            ref={ZAuditRef}
+          />
+        ) : null}
+
+        {/* 表单字段、附件等 */}
+        <div className='E4Tit'>
+          申请信息
+          {key === '1' ? null : (
+            <Button type='dashed'>{Reflect.get(statusObj, topInfo.status)}</Button>
+          )}
+        </div>
+
+        <div className='E4rowAll'>
+          <div className='E4row'>
+            <div className='E4rowll'>申请类型:</div>
+            <div className='E4rowrr'>{topInfo.name}</div>
+          </div>
+
+          <div className='E4row'>
+            <div className='E4rowll'>
+              <span> * </span>交修部门:
+            </div>
+            <div className='E4rowrr'>
+              <Input
+                value={topInfo.authUnit}
+                onChange={e => setTopInfo({ ...topInfo, authUnit: e.target.value.trim() })}
+                readOnly={['3', '4'].includes(key)}
+                placeholder='请输入内容'
+                maxLength={30}
+                showCount
+              />
+            </div>
+          </div>
+
+          <div className='E4row'>
+            <div className='E4rowll'>
+              <span> * </span>交修日期:
+            </div>
+            <div className='E4rowrr'>
+              <DatePicker
+                disabled={['3', '4'].includes(key)}
+                allowClear={false}
+                value={topInfo.dateStart ? dayjs(topInfo.dateStart) : null}
+                onChange={e => timeChange(e, 'dateStart')}
+              />
+            </div>
+          </div>
+
+          <div className='E4row'>
+            <div className='E4rowll'>退还日期:</div>
+            <div className='E4rowrr'>
+              <DatePicker
+                placeholder={['3', '4'].includes(key) && !topInfo.dateEnd ? '(空)' : '请选择日期'}
+                disabled={['3', '4'].includes(key)}
+                allowClear={false}
+                value={topInfo.dateEnd ? dayjs(topInfo.dateEnd) : null}
+                onChange={e => timeChange(e, 'dateEnd')}
+              />
+            </div>
+          </div>
+
+          <div className='E4row E4row2'>
+            <div className='E4rowll'>附件:</div>
+            <div className='E4rowrr'>
+              <Z3upFiles
+                max={10}
+                isLook={['3', '4'].includes(key)}
+                ref={filesRef}
+                fileCheck={false}
+                dirCode='E4repair'
+                myUrl='cms/orderPreserveFix/upload'
+                lookData={topInfo.files || []}
+                size={500}
+                fromData={{ moduleId: topInfo.id }}
+              />
+            </div>
+          </div>
+
+          <div className='E4row E4rowFull'>
+            <div className='E4rowll'>备注:</div>
+            <div className='E4rowrr'>
+              <ZRichTexts
+                check={false}
+                dirCode='E4repair'
+                myUrl='cms/orderPreserveFix/upload'
+                isLook={['3', '4'].includes(key)}
+                ref={ZRichTextRef}
+                isOne={true}
+                upAudioBtnNone={true}
+              />
+            </div>
+          </div>
+        </div>
+
+        {/* 藏品清单 */}
+        <div className='E4googsBox'>
+          <div className='E4Tit2'>
+            <div className='E4Tit2ll'>藏品清单</div>
+            <div className='E4Tit2rr'>
+              {['3', '4'].includes(key) ? null : (
+                <Button
+                  type='primary'
+                  onClick={() =>
+                    setNowSta({
+                      key: 'E4',
+                      id: 'cms/orderPreserveFix/goods/getList'
+                    })
+                  }
+                >
+                  添加
+                </Button>
+              )}
+            </div>
+          </div>
+
+          {/* 表格 */}
+          <MyTable
+            list={snaps}
+            columnsTemp={E4tableCgoods}
+            startBtn={startBtn}
+            lastBtn={tableLastBtn}
+            pagingInfo={false}
+          />
+        </div>
+
+        {/* 申请流程 */}
+        {auditsShow ? (
+          <B3flowTable tableArr={topInfo.audits || []} closeFu={() => setAuditsShow(false)} />
+        ) : null}
+
+        {/* 底部按钮 */}
+        <div className='E4btn'>
+          {['3', '4'].includes(key) && topInfo.audits && topInfo.audits.length ? (
+            <Button type='primary' onClick={() => setAuditsShow(true)}>
+              申请记录
+            </Button>
+          ) : null}
+
+          {key === '4' ? (
+            lookBtn
+          ) : (
+            <>
+              {key === '3' ? (
+                <Button type='primary' onClick={() => btnClickFu('审批')}>
+                  审批
+                </Button>
+              ) : (
+                <Button type='primary' onClick={() => btnClickFu(key === '1' ? '创建' : '保存')}>
+                  {key === '1' ? '创建' : '保存'}
+                </Button>
+              )}
+
+              {key === '1' ? (
+                <Button type='primary' onClick={() => btnClickFu('草稿')}>
+                  存草稿
+                </Button>
+              ) : null}
+
+              <MyPopconfirm txtK='取消' onConfirm={() => history.push('/repair')} />
+            </>
+          )}
+        </div>
+
+        {/* 附件归档 */}
+        {topInfo.status === 4 ? (
+          <ZupFileTable
+            listTemp={topInfo.filing || []}
+            dirCode='E4repair'
+            myUrl='cms/orderPreserveFix/upload'
+            fromData={{ moduleId: topInfo.id }}
+          />
+        ) : null}
+      </div>
+
+      {/* 打开侧边栏 */}
+      <Y1cathet sId={cathet} closeFu={() => setCathet(0)} />
+
+      {nowSta.id ? (
+        <B3GaddNow
+          nowSta={nowSta}
+          closeFu={() => setNowSta({ key: '', id: '' })}
+          dataResFu={data => {
+            const dataTemp = [...data]
+            dataTemp.forEach(v => {
+              // id2表示的是自己这条数据的id id才是goodsId
+              const obj = snapsID2ref.current.find(c => c.goodsId === v.id)
+
+              if (obj) v.id2 = obj.id
+            })
+            setSnaps(dataTemp)
+          }}
+          oldCheckArr={snaps}
+        />
+      ) : null}
+    </div>
+  )
+}
+
+const MemoE4edit = React.memo(E4edit)
+
+export default MemoE4edit

+ 28 - 1
src/pages/E_goodsStorage/E4repair/index.module.scss

@@ -1,4 +1,31 @@
-.E3actuality {
+.E4repair {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px 24px 0;
   :global {
+    .E4top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      .E4top1 {
+        display: flex;
+        width: calc(100% - 325px);
+        & > div {
+          position: relative;
+          margin-right: 15px;
+          & > span {
+            position: absolute;
+            top: -20px;
+            left: 0;
+          }
+        }
+      }
+      .ant-select-selection-placeholder {
+        color: black;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 270 - 3
src/pages/E_goodsStorage/E4repair/index.tsx

@@ -1,10 +1,277 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { Button, DatePicker, Input, Select } from 'antd'
+import { E4FormType } from './type'
+import { useDispatch, useSelector } from 'react-redux'
+import { E4_APIdel, E4_APIgetList } from '@/store/action/E4repair'
+import { E1InputKeyType } from '../E1accident/type'
+import { MessageFu } from '@/utils/message'
+import history, { btnFlagFu } from '@/utils/history'
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { RootState } from '@/store'
+import dayjs from 'dayjs'
+import { E4tableC, statusObj } from '@/utils/tableData'
+import ExportJsonExcel from 'js-export-excel'
+import { selectObj } from '@/utils/select'
+import MyTable from '@/components/MyTable'
+const { RangePicker } = DatePicker
+
+const E4baseFormData: E4FormType = {
+  pageSize: 10,
+  pageNum: 1,
+  num: '',
+  dateStart: '',
+  dateEnd: '',
+  userName: '',
+  userType: ''
+}
+
 function E4repair() {
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState(E4baseFormData)
+  const formDataRef = useRef(E4baseFormData)
+  const formDataOldRef = useRef(E4baseFormData)
+
+  useEffect(() => {
+    formDataRef.current = formData
+  }, [formData])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, pageNum: 1 })
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 时间选择器改变
+  const timeChange = useCallback(
+    (date: any, dateString: any) => {
+      let dateStart = ''
+      let dateEnd = ''
+      if (dateString[0] && dateString[1]) {
+        dateStart = dateString[0] + ' 00:00:00'
+        dateEnd = dateString[1] + ' 23:59:59'
+      }
+      setFormData({ ...formData, dateStart, dateEnd })
+    },
+    [formData]
+  )
+
+  // 封装发送请求的函数
+  const getListFu = useCallback(() => {
+    formDataOldRef.current = { ...formDataRef.current }
+    dispatch(E4_APIgetList(formDataRef.current))
+  }, [dispatch])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu, timeKey])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: E1InputKeyType) => {
+      setFormData({
+        ...formData,
+        [key]: txt
+      })
+    },
+    [formData]
+  )
+
+  // 点击重置
+  const resetSelectFu = useCallback(() => {
+    setFormData(E4baseFormData)
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await E4_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  // 点击操作按钮
+  const tableBtnFu = useCallback((id: number, key: string) => {
+    history.push(`/repair_edit/${key}/${id}`)
+  }, [])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: FourTableType) => {
+          let obj = btnFlagFu(item)
+          return !Object.values(obj).some(Boolean) ? (
+            '-'
+          ) : (
+            <>
+              {obj['编辑'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '2')}>
+                  编辑
+                </Button>
+              ) : null}
+
+              {obj['审批'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
+                  审批
+                </Button>
+              ) : null}
+              {obj['查看'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '4')}>
+                  查看
+                </Button>
+              ) : null}
+
+              {obj['删除'] ? (
+                <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+              ) : null}
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu, tableBtnFu])
+
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.E4repair.tableInfo)
+
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    const name = '文物修复' + dayjs(new Date()).format('YYYY-MM-DD HH:mm')
+
+    const res = await E4_APIgetList(
+      {
+        ...formDataOldRef.current,
+        pageNum: 1,
+        pageSize: 99999
+      },
+      true
+    )
+
+    if (res.code === 0) {
+      if (res.data.records.length <= 0) return MessageFu.warning('当前搜索条件没有数据!')
+
+      const option = {
+        fileName: name,
+        datas: [
+          {
+            sheetData: res.data.records.map((v: FourTableType) => ({
+              ...v,
+              status: statusObj[v.status as 1]
+            })),
+            sheetName: name,
+            sheetFilter: ['num', 'dateStart', 'authUnit', 'creatorName', 'createTime', 'status'],
+            sheetHeader: ['申请编号', '交修日期', '交修部门', '发起人', '发送日期', '申请状态'],
+            columnWidths: [10, 10, 10, 10, 10, 10]
+          }
+        ]
+      }
+
+      const toExcel = new ExportJsonExcel(option) //new
+      toExcel.saveExcel() //保存
+    }
+  }, [])
+
   return (
     <div className={styles.E4repair}>
-      <div className='pageTitle'>修复登记</div>
-      <p>待开发</p>
+      <div className='pageTitle'>文物修复</div>
+      <div className='E4top'>
+        <div className='E4top1'>
+          <div>
+            <span>申请编号:</span>
+            <Input
+              placeholder='请输入申请编号'
+              maxLength={30}
+              value={formData.num}
+              onChange={e => txtChangeFu(e.target.value, 'num')}
+            />
+          </div>
+
+          <div>
+            <span>交修日期范围:</span>
+            <RangePicker
+              value={
+                formData.dateStart ? [dayjs(formData.dateStart), dayjs(formData.dateEnd)] : null
+              }
+              onChange={timeChange}
+            />
+          </div>
+
+          <div>
+            <span>发起人:</span>
+            <Input
+              placeholder='请输入发起人'
+              maxLength={30}
+              value={formData.userName}
+              onChange={e => txtChangeFu(e.target.value, 'userName')}
+            />
+          </div>
+
+          <div>
+            <span>选择角色:</span>
+            <Select
+              allowClear={true}
+              style={{ width: 150 }}
+              placeholder='全部'
+              options={selectObj['角色']}
+              // fieldNames={{ value: 'id', label: 'roleName' }}
+              value={formData.userType ? formData.userType : null}
+              onChange={e => setFormData({ ...formData, userType: e })}
+            />
+          </div>
+        </div>
+        <div className='E4top2'>
+          <Button type='primary' onClick={deriveFu}>
+            批量导出
+          </Button>
+          &emsp;
+          <Button type='primary' onClick={() => history.push('/repair_edit/1/null')}>
+            新增
+          </Button>
+          &emsp;
+          <Button type='primary' onClick={clickSearch}>
+            查询
+          </Button>
+          &emsp;<Button onClick={resetSelectFu}>重置</Button>
+        </div>
+      </div>
+
+      {/* 表格 */}
+      <MyTable
+        yHeight={650}
+        list={tableInfo.list}
+        columnsTemp={E4tableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
     </div>
   )
 }

+ 9 - 0
src/pages/E_goodsStorage/E4repair/type.d.ts

@@ -0,0 +1,9 @@
+export type E4FormType = {
+  pageSize: number
+  pageNum: number
+  num: string
+  dateStart: string
+  dateEnd: string
+  userName: string
+  userType: string
+}

+ 1 - 1
src/pages/F_exhibition/F1exhibition/index.tsx

@@ -3,7 +3,7 @@ import styles from './index.module.scss'
 function F1exhibition() {
   return (
     <div className={styles.F1exhibition}>
-      <div className='pageTitle'>展管理</div>
+      <div className='pageTitle'>展管理</div>
       <p>待开发</p>
     </div>
   )

+ 24 - 16
src/pages/Layout/data.ts

@@ -228,12 +228,13 @@ const tabLeftArr: RouterType = [
         path: '/accident',
         Com: React.lazy(() => import('../E_goodsStorage/E1accident'))
       },
-      {
-        id: 520,
-        name: '残损登记',
-        path: '/damaged',
-        Com: React.lazy(() => import('../E_goodsStorage/E2damaged'))
-      },
+      // 甲方说先隐藏
+      // {
+      //   id: 520,
+      //   name: '残损登记',
+      //   path: '/damaged',
+      //   Com: React.lazy(() => import('../E_goodsStorage/E2damaged'))
+      // },
       {
         id: 530,
         name: '现状登记',
@@ -242,13 +243,13 @@ const tabLeftArr: RouterType = [
       },
       {
         id: 540,
-        name: '修复登记',
+        name: '文物修复',
         path: '/repair',
         Com: React.lazy(() => import('../E_goodsStorage/E4repair'))
       }
     ]
   },
-  // 待完善-展管理
+  // 待完善-展管理
   {
     id: 6,
     name: '展品管理',
@@ -256,7 +257,7 @@ const tabLeftArr: RouterType = [
       {
         // 待完善
         id: 9800,
-        name: '展管理',
+        name: '展管理',
         path: '/exhibition',
         Com: React.lazy(() => import('../F_exhibition/F1exhibition'))
       }
@@ -404,13 +405,13 @@ export const routerSon: RouterTypeRow[] = [
     path: '/accident_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E1accident/E1edit'))
   },
-  // ------------残损登记------------------
-  {
-    id: 11,
-    name: '残损登记-新增/编辑/审批/查看',
-    path: '/damaged_edit/:key/:id',
-    Com: React.lazy(() => import('../E_goodsStorage/E2damaged/E2edit'))
-  },
+  // ------------残损登记 甲方说先隐藏------------------
+  // {
+  //   id: 11,
+  //   name: '残损登记-新增/编辑/审批/查看',
+  //   path: '/damaged_edit/:key/:id',
+  //   Com: React.lazy(() => import('../E_goodsStorage/E2damaged/E2edit'))
+  // },
 
   // ------------现状登记------------------
   {
@@ -418,5 +419,12 @@ export const routerSon: RouterTypeRow[] = [
     name: '现状登记-新增/编辑/审批/查看',
     path: '/actuality_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E3actuality/E3edit'))
+  },
+  // ------------文物修复------------------
+  {
+    id: 14,
+    name: '文物修复-新增/编辑/审批/查看',
+    path: '/repair_edit/:key/:id',
+    Com: React.lazy(() => import('../E_goodsStorage/E4repair/E4edit'))
   }
 ]

+ 1 - 1
src/pages/Y_goodsDetails/Y2look/index.tsx

@@ -107,7 +107,7 @@ function Y2look() {
       },
       {
         key: '4',
-        label: <span className='Y2xia'>修复登记</span>
+        label: <span className='Y2xia'>文物修复</span>
       }
     ]
     return arr

+ 77 - 0
src/store/action/E4repair.ts

@@ -0,0 +1,77 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 文物修复 - 获取分页列表
+ */
+export const E4_APIgetList = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/orderPreserveFix/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/orderPreserveFix/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'E4/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 文物修复-删除
+ */
+export const E4_APIdel = (id: number) => {
+  return http.get(`cms/orderPreserveFix/remove/${id}`)
+}
+
+/**
+ * 文物修复-创建订单
+ */
+export const E4_APIcreate = () => {
+  return http.get('cms/orderPreserveFix/create')
+}
+
+/**
+ * 文物修复-获取详情
+ */
+export const E4_APIgetInfo = (id: number) => {
+  return http.get(`cms/orderPreserveFix/detail/${id}`)
+}
+
+/**
+ * 文物修复-存草稿
+ */
+export const E4_APIsaveDraft = (data: any) => {
+  return http.post('cms/orderPreserveFix/saveDraft', data)
+}
+
+/**
+ * 文物修复-创建
+ */
+export const E4_APIsaveCreate = (data: any) => {
+  return http.post('cms/orderPreserveFix/saveCreate', data)
+}
+
+/**
+ * 文物修复-编辑保存
+ */
+export const E4_APIsaveApply = (data: any) => {
+  return http.post('cms/orderPreserveFix/saveApply', data)
+}
+
+/**
+ * 文物修复-审批
+ */
+export const E4_APIsaveAudit = (data: any) => {
+  return http.post('cms/orderPreserveFix/audit', data)
+}
+
+/**
+ * 文物修复-撤回订单
+ */
+export const E4_APIrevocation = (id: number) => {
+  return http.get(`cms/orderPreserveFix/revocation/${id}`)
+}

+ 28 - 0
src/store/reducer/E4repair.ts

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

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

@@ -17,6 +17,7 @@ import D6putsStor from './D6putsStor'
 import E1accident from './E1accident'
 import E2damaged from './E2damaged'
 import E3actuality from './E3actuality'
+import E4repair from './E4repair'
 import Z1dict from './Z1dict'
 import Z2numRule from './Z2numRule'
 import Z3flowSet from './Z3flowSet'
@@ -42,6 +43,7 @@ const rootReducer = combineReducers({
   E1accident,
   E2damaged,
   E3actuality,
+  E4repair,
   Z1dict,
   Z2numRule,
   Z3flowSet,

+ 3 - 3
src/utils/select.ts

@@ -48,10 +48,10 @@ export const selectObj = {
     { value: 'other', label: '其他' }
   ],
   流程类型: [
-    { value: '入藏管理', label: '入藏管理' },
     { value: '藏品管理', label: '藏品管理' },
-    { value: '库存管理', label: '库存管理' },
-    { value: '藏品保管', label: '藏品保管' },
+    { value: '入藏管理', label: '入藏管理' },
+    { value: '库房管理', label: '库房管理' },
+    { value: '藏品维护', label: '藏品维护' },
     { value: '展品管理', label: '展品管理' }
   ],
   启用状态: [

+ 25 - 0
src/utils/tableData.ts

@@ -16,6 +16,13 @@
 
 import { selectObj } from './select'
 
+// 附件归档
+export const ZypFileTable = [
+  ['txt', '附件名称', 'fileName'],
+  ['txt', '归档人', 'creatorName'],
+  ['txt', '归档时间', 'createTime']
+]
+
 // 库存状态obj
 export const statusStorageObj: any = {}
 selectObj['库存状态'].forEach(v => {
@@ -195,6 +202,24 @@ export const E2tableC = [
   ['txt', '相关盘点', '待完善']
 ]
 
+//
+export const E4tableC = [
+  ['txt', '申请编号', 'num'],
+  ['txt', '交修日期', 'dateStart'],
+  ['txt', '交修部门', 'authUnit'],
+  ['txt', '发起人', 'creatorName'],
+  ['txt', '发送日期', 'createTime'],
+  ['txtChange', '申请状态', 'status', statusObj]
+]
+
+export const E4tableCgoods = [
+  ['img', '封面图', 'thumb'],
+  ['txt', '编号类型', 'numName'],
+  ['txt', '藏品名称', 'name'],
+  ['txt', '等级', 'dictLevel'],
+  ['ping', '数量', 'pcs', 'pcsUnit']
+]
+
 export const Y33tableC = [
   ['text', '附件名称', 'fileName', 50],
   ['txt', '附件大小', 'fileSize'],