소스 검색

Merge branch 'master' of http://192.168.0.115:3000/shaogen1995/YW_Goods into master

shaogen1995 2 달 전
부모
커밋
5adc51a9be

+ 0 - 1
src/pages/C_goodsManage/C21wealth/C21edit/index.tsx

@@ -525,7 +525,6 @@ function C21edit() {
       {/* 新增弹窗 */}
       {nowSta.id ? (
         <ZGaddNow
-          httpType='get'
           nowSta={nowSta}
           closeFu={() => setNowSta({ key: '', id: '' })}
           dataResFu={data => {

+ 172 - 204
src/pages/F_exhibition/F1exhibition/F1edit/index.tsx

@@ -1,28 +1,32 @@
-import React, { useCallback, useMemo, useRef, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import style from './index.module.scss'
-import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
 import { useParams } from 'react-router-dom'
 import X3auditInfo from '@/pages/X_stock/X3auditInfo'
 import { Button, Input, Radio, Select } from 'antd'
 import { statusObj } from '@/utils/tableData'
-import ZRichTexts from '@/components/ZRichTexts'
-import MyTable from '@/components/MyTable'
-import { F1_GOOD_COLUMNS } from '../constants'
+import MyTable, { MyTableMethods } from '@/components/MyTable'
+import { F1_GOOD_COLUMNS, F1_SON_TYPE_NAME_OPTS, F1_SON_TYPE_OPTS } from '../constants'
 import ZGaddNow from '@/components/ZGaddNow'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
 import {
-  D4_APIdel,
-  D4_APIgetInfo,
-  D4_APIrevocation,
-  D4_APIsaveApply,
-  D4_APIsaveAudit,
-  D4_APIsaveCreate,
-  D4_APIsaveDraft
-} from '@/store/action/D4impStor'
+  F1_APIcreate,
+  F1_APIdel,
+  F1_APIgetInfo,
+  F1_APIrevocation,
+  F1_APIsaveApply,
+  F1_APIsaveAudit,
+  F1_APIsaveCreate,
+  F1_APIsaveDraft
+} from '@/store/action/F1exhibition'
 import { MessageFu } from '@/utils/message'
-import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
 import { EXbtnFu } from '@/utils/EXBtn'
+import { F1_SON_TYPE_ENUM, F1_SON_TYPE_NAME_ENUM, F1exhibitionItemType } from '../types'
+import ZflowTable from '@/components/ZflowTable'
+import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
+import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
+import { areAllCheckersFilled } from '@/utils/objects'
+import dayjs from 'dayjs'
 
 function F1edit() {
   const { key, id } = useParams<any>()
@@ -33,15 +37,19 @@ function F1edit() {
   // 审批意见的ref
   const ZAuditRef = useRef<any>(null)
   // 顶部数据
-  const [topInfo, setTopInfo] = useState({} as FourTableType)
-  // 富文本的ref
-  const ZRichTextRef = useRef<any>(null)
+  const [topInfo, setTopInfo] = useState({} as F1exhibitionItemType)
   // 点击新增
   const [nowSta, setNowSta] = useState({ key: '', id: '' })
   // 申请记录
   const [auditsShow, setAuditsShow] = useState(false)
-  // 上传附件的ref
-  const filesRef = useRef<any>(null)
+  // 藏品清单快照数据
+  const [snaps, setSnaps] = useState<C1GoodType[]>([])
+  const delSnapIdsRef = useRef<number[]>([])
+
+  const snapsID2ref = useRef<{ goodsId: number; id: number }[]>([])
+
+  const pageDisabled = ['3', '4'].includes(key)
+  const tableRef = useRef<MyTableMethods | null>(null)
 
   const pageTitTxt = useMemo(() => {
     return Reflect.get(pageTitTxtObj, key)
@@ -56,32 +64,50 @@ function F1edit() {
             <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
               查看
             </Button>
-            {['3', '4'].includes(key) ? null : (
+            {pageDisabled ? null : (
               <MyPopconfirm
                 txtK='删除'
-                onConfirm={() =>
-                  setTopInfo({
-                    ...topInfo,
-                    goods: topInfo.goods.filter(v => v.id !== item.id)
-                  })
-                }
+                onConfirm={() => setSnaps(snaps.filter(v => v.id !== item.id))}
               />
             )}
           </>
         )
       }
     ]
-  }, [])
+  }, [pageDisabled, snaps])
 
   // 获取详情
   const getInfoFu = useCallback(
-    async (id2?: number) => {
-      const res = await D4_APIgetInfo(id2 || id)
+    async (iid = id) => {
+      const res = await F1_APIgetInfo(iid)
       if (res.code === 0) {
-        setTopInfo(res.data)
+        const data = res.data
+        setTopInfo(data)
+        // 藏品清单快照信息id对比
+        const arrTemp: any = []
+        const snapsTemp = data.snaps || []
+
+        snapsTemp.forEach((v: any) => {
+          const { cusForm, ...obj } = JSON.parse(v.snap || '{}')
+          if (obj.id) obj.id2 = v.id
+          if (cusForm) {
+            if (cusForm[`${v.goodsId}-lendDate`]) {
+              cusForm[`${v.goodsId}-lendDate`] = dayjs(cusForm[`${v.goodsId}-lendDate`])
+            }
+            if (cusForm[`${v.goodsId}-expectedReturnDate`]) {
+              cusForm[`${v.goodsId}-expectedReturnDate`] = dayjs(
+                cusForm[`${v.goodsId}-expectedReturnDate`]
+              )
+            }
+            if (cusForm[`${v.goodsId}-returnDate`]) {
+              cusForm[`${v.goodsId}-returnDate`] = dayjs(cusForm[`${v.goodsId}-returnDate`])
+            }
+            tableRef.current?.form.setFieldsValue(cusForm)
+          }
 
-        // 设置富文本
-        ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf || '{}'))
+          arrTemp.push(obj)
+        })
+        setSnaps(arrTemp)
       }
     },
     [id]
@@ -89,10 +115,10 @@ function F1edit() {
 
   // 查看模式点击删除
   const delFu = useCallback(async () => {
-    const res = await D4_APIdel(id)
+    const res = await F1_APIdel(id)
     if (res.code === 0) {
       MessageFu.success('删除成功')
-      history.push('/impStor')
+      history.push('/exhibiton')
     }
   }, [id])
 
@@ -118,28 +144,28 @@ function F1edit() {
         }
       }
 
-      const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
-      // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
-
-      // 上传附件
-      const filesRes = filesRef.current.filesIdRes()
+      const tableValues = tableRef.current?.form.getFieldsValue()
       const obj = {
         ...topInfo,
-        fileIds: filesRes.join(','),
-        rtf: JSON.stringify(rtf1.val || ''),
-        goodsIds: topInfo.goods.map(v => v.id).join(','),
-        goods: topInfo.goods.map(v => ({
+        goodsIds: snaps.map(v => v.id).join(','),
+        delSnapIds: delSnapIdsRef.current.length ? delSnapIdsRef.current : '',
+        snaps: snaps.map(v => ({
           goodsId: v.id,
-          siteId: v.siteId
+          id: v.id2 ? v.id2 : null,
+          orderId: topInfo.id,
+          snap: JSON.stringify({
+            ...v,
+            cusForm: tableValues
+          })
         }))
       }
 
       const res =
         val === '创建'
-          ? await D4_APIsaveCreate(obj)
+          ? await F1_APIsaveCreate(obj)
           : val === '提交'
-          ? await D4_APIsaveApply(obj)
-          : await D4_APIrevocation(id)
+          ? await F1_APIsaveApply(obj)
+          : await F1_APIrevocation(id)
 
       if (res.code === 0) {
         if (sollrDom.current) sollrDom.current.scrollTop = 0
@@ -147,7 +173,7 @@ function F1edit() {
         getInfoFu()
       }
     },
-    [getInfoFu, id, topInfo]
+    [getInfoFu, id, snaps, topInfo]
   )
 
   // 查看模式下的按钮
@@ -214,21 +240,27 @@ function F1edit() {
   }, [delFu, lookBtnFu, lookJumpFu, topInfo])
 
   const checkDataFu = useCallback(() => {
-    if (!topInfo.name) {
-      MessageFu.warning('申请名称不能为空')
+    if (!topInfo.typeName) {
+      MessageFu.warning('展览名称不能为空')
       return true
     }
-    if (!topInfo.sonTypeName) {
-      MessageFu.warning('请选择业务类型')
+    if (!topInfo.sonUnit) {
+      MessageFu.warning('借展部门不能为空')
       return true
     }
-    if (!topInfo.storageId) {
-      MessageFu.warning('请选择入库库房')
+    if (!snaps.length) {
+      MessageFu.warning('请选择藏品')
+      return true
+    }
+
+    const tableInputVals = tableRef.current?.form.getFieldsValue()
+    if (!areAllCheckersFilled('lendDate', tableInputVals)) {
+      MessageFu.warning(`请选择借出日期`)
       return true
     }
 
     return false
-  }, [topInfo])
+  }, [snaps.length, topInfo.sonUnit, topInfo.typeName])
 
   // 新增的底部按钮点击
   const btnClickFu = useCallback(
@@ -253,7 +285,7 @@ function F1edit() {
         }
         const rtf2 = ZAuditRef.current?.resData()
 
-        const res = await D4_APIsaveAudit({
+        const res = await F1_APIsaveAudit({
           orderId: topInfo.id,
           rtfOpinion: rtf2,
           status: auditSta === '同意' ? 1 : 2
@@ -265,20 +297,19 @@ function F1edit() {
           history.push(`/exhibition_edit/4/${topInfo.id}`)
         }
       } else {
-        const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
-        // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
-
-        // 上传附件
-        const filesRes = filesRef.current.filesIdRes()
-
+        const tableValues = tableRef.current?.form.getFieldsValue()
         const obj = {
           ...topInfo,
-          fileIds: filesRes.join(','),
-          rtf: JSON.stringify(rtf1.val || ''),
-          goodsIds: topInfo.goods.map(v => v.id).join(','),
-          goods: topInfo.goods.map(v => ({
+          goodsIds: snaps.map(v => v.id).join(','),
+          delSnapIds: delSnapIdsRef.current.length ? delSnapIdsRef.current : '',
+          snaps: snaps.map(v => ({
             goodsId: v.id,
-            siteId: v.siteId
+            id: v.id2 ? v.id2 : null,
+            orderId: topInfo.id,
+            snap: JSON.stringify({
+              ...v,
+              cusForm: tableValues
+            })
           }))
         }
         // console.log(123, obj)
@@ -287,13 +318,13 @@ function F1edit() {
 
         if (val === '草稿') {
           // 存草稿 当前页保存 不跳转
-          const res = await D4_APIsaveDraft(obj)
+          const res = await F1_APIsaveDraft(obj)
           if (res.code === 0) {
             MessageFu.success('草稿保存成功')
             getInfoFu(topInfo.id)
           }
         } else {
-          const res = val === '创建' ? await D4_APIsaveCreate(obj) : await D4_APIsaveApply(obj)
+          const res = val === '创建' ? await F1_APIsaveCreate(obj) : await F1_APIsaveApply(obj)
           if (res.code === 0) {
             MessageFu.success(`${val}成功`)
             // 跳到详情页
@@ -302,9 +333,28 @@ function F1edit() {
         }
       }
     },
-    [auditSta, checkDataFu, getInfoFu, topInfo]
+    [auditSta, checkDataFu, getInfoFu, snaps, topInfo]
   )
 
+  // 创建订单
+  const creatFu = useCallback(async () => {
+    const res = await F1_APIcreate()
+    if (res.code === 0) {
+      setTopInfo({
+        ...res.data,
+        sonType: F1_SON_TYPE_ENUM.IN,
+        sonTypeName: F1_SON_TYPE_NAME_ENUM.TEMP
+      })
+    }
+  }, [])
+
+  useEffect(() => {
+    if (key === '1') creatFu()
+    else getInfoFu()
+
+    if (sollrDom.current) sollrDom.current.scrollTop = 0
+  }, [creatFu, getInfoFu, key])
+
   return (
     <div className={style.F1edit}>
       <div className='pageTitle'>借展管理-{pageTitTxt}</div>
@@ -312,7 +362,7 @@ function F1edit() {
       <div className='D4main' ref={sollrDom}>
         {['3'].includes(key) ? (
           <X3auditInfo
-            dirCode='D4impStor'
+            dirCode='D4exhibiton'
             myUrl='cms/orderIn/upload'
             auditSta={auditSta}
             auditStaFu={val => setAuDitSta(val)}
@@ -330,19 +380,19 @@ function F1edit() {
         <div className='D4rowAll'>
           <div className='D4row'>
             <div className='D4rowll'>业务单号:</div>
-            <div className='D4rowrr'>这是一段文本</div>
+            <div className='D4rowrr'>{topInfo.num}</div>
           </div>
           <div className='D4row'>
             <div className='D4rowll'>业务名称:</div>
-            <div className='D4rowrr'>这是一段文本</div>
+            <div className='D4rowrr'>{topInfo.name}</div>
           </div>
           <div className='D4row'>
             <div className='D4rowll'>发起人:</div>
-            <div className='D4rowrr'>这是一段文本</div>
+            <div className='D4rowrr'>{topInfo.creatorName}</div>
           </div>
           <div className='D4row'>
             <div className='D4rowll'>发起部门:</div>
-            <div className='D4rowrr'>这是一段文本</div>
+            <div className='D4rowrr'>{topInfo.deptName}</div>
           </div>
         </div>
 
@@ -354,9 +404,9 @@ function F1edit() {
             </div>
             <div className='D4rowrr'>
               <Input
-                value={topInfo.name}
-                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                readOnly={['3', '4'].includes(key)}
+                value={topInfo.typeName}
+                onChange={e => setTopInfo({ ...topInfo, typeName: e.target.value.trim() })}
+                readOnly={pageDisabled}
                 placeholder='请输入内容'
                 maxLength={30}
                 showCount
@@ -368,9 +418,16 @@ function F1edit() {
               <span> * </span>借展类型:
             </div>
             <div className='D4rowrr'>
-              <Radio.Group>
-                <Radio>馆内展览</Radio>
-                <Radio>馆外展览</Radio>
+              <Radio.Group
+                value={topInfo.sonType}
+                disabled={pageDisabled}
+                onChange={e => setTopInfo({ ...topInfo, sonType: e.target.value })}
+              >
+                {F1_SON_TYPE_OPTS.map(i => (
+                  <Radio key={i.value} value={i.value}>
+                    {i.label}
+                  </Radio>
+                ))}
               </Radio.Group>
             </div>
           </div>
@@ -380,16 +437,10 @@ function F1edit() {
             </div>
             <div className='D4rowrr'>
               <Select
-                options={[
-                  {
-                    value: 0,
-                    label: '临时展览'
-                  },
-                  {
-                    value: 1,
-                    label: '固定展览'
-                  }
-                ]}
+                disabled={pageDisabled}
+                value={topInfo.sonTypeName}
+                options={F1_SON_TYPE_NAME_OPTS}
+                onChange={e => setTopInfo({ ...topInfo, sonTypeName: e })}
               />
             </div>
           </div>
@@ -397,9 +448,9 @@ function F1edit() {
             <div className='D4rowll'>提用审批单号:</div>
             <div className='D4rowrr'>
               <Input
-                value={topInfo.name}
-                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                readOnly={['3', '4'].includes(key)}
+                value={topInfo.sonNum}
+                onChange={e => setTopInfo({ ...topInfo, sonNum: e.target.value.trim() })}
+                readOnly={pageDisabled}
                 placeholder='请输入内容'
                 maxLength={30}
                 showCount
@@ -412,9 +463,9 @@ function F1edit() {
             </div>
             <div className='D4rowrr'>
               <Input
-                value={topInfo.name}
-                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                readOnly={['3', '4'].includes(key)}
+                value={topInfo.sonUnit}
+                onChange={e => setTopInfo({ ...topInfo, sonUnit: e.target.value.trim() })}
+                readOnly={pageDisabled}
                 placeholder='请输入内容'
                 maxLength={30}
                 showCount
@@ -425,124 +476,27 @@ function F1edit() {
             <div className='D4rowll'>提退凭证号:</div>
             <div className='D4rowrr'>
               <Input
-                value={topInfo.name}
-                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                readOnly={['3', '4'].includes(key)}
+                value={topInfo.sonNum2}
+                onChange={e => setTopInfo({ ...topInfo, sonNum2: e.target.value.trim() })}
+                readOnly={pageDisabled}
                 placeholder='请输入内容'
                 maxLength={30}
                 showCount
               />
             </div>
           </div>
-          <div className='D4row'>
-            <div className='D4rowll'>出借经手人:</div>
-            <div className='D4rowrr'>
-              <div className='D4row'>
-                <div className='D4rowll' style={{ width: 50 }}>
-                  甲方:
-                </div>
-                <div className='D4rowrr'>
-                  <Input
-                    value={topInfo.name}
-                    onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                    readOnly={['3', '4'].includes(key)}
-                    placeholder='请输入内容'
-                    maxLength={30}
-                    showCount
-                  />
-                </div>
-              </div>
-              <div className='D4row' style={{ marginBottom: 0 }}>
-                <div className='D4rowll' style={{ width: 50 }}>
-                  乙方:
-                </div>
-                <div className='D4rowrr'>
-                  <Input
-                    value={topInfo.name}
-                    onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                    readOnly={['3', '4'].includes(key)}
-                    placeholder='请输入内容'
-                    maxLength={30}
-                    showCount
-                  />
-                </div>
-              </div>
-            </div>
-          </div>
-          <div className='D4row'>
-            <div className='D4rowll'>归还经手人:</div>
-            <div className='D4rowrr'>
-              <div className='D4row'>
-                <div className='D4rowll' style={{ width: 50 }}>
-                  甲方:
-                </div>
-                <div className='D4rowrr'>
-                  <Input
-                    value={topInfo.name}
-                    onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                    readOnly={['3', '4'].includes(key)}
-                    placeholder='请输入内容'
-                    maxLength={30}
-                    showCount
-                  />
-                </div>
-              </div>
-              <div className='D4row' style={{ marginBottom: 0 }}>
-                <div className='D4rowll' style={{ width: 50 }}>
-                  乙方:
-                </div>
-                <div className='D4rowrr'>
-                  <Input
-                    value={topInfo.name}
-                    onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                    readOnly={['3', '4'].includes(key)}
-                    placeholder='请输入内容'
-                    maxLength={30}
-                    showCount
-                  />
-                </div>
-              </div>
-            </div>
-          </div>
-          <div className='D4row'>
-            <div className='D4rowll'>记录人:</div>
-            <div className='D4rowrr'>
-              <Input
-                value={topInfo.name}
-                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
-                readOnly={['3', '4'].includes(key)}
-                placeholder='请输入内容'
-                maxLength={30}
-                showCount
-              />
-            </div>
-          </div>
-          <div className='D4row D4rowFull' style={{ margin: 0 }}>
-            <div className='D4rowll'>备注:</div>
-            <div className='D4rowrr'>
-              <ZRichTexts
-                check={false}
-                dirCode='impStor'
-                myUrl='cms/orderIn/upload'
-                isLook={['3', '4'].includes(key)}
-                ref={ZRichTextRef}
-                isOne={true}
-                upAudioBtnNone={true}
-              />
-            </div>
-          </div>
         </div>
 
         <div className='D4googsBox'>
           <div className='D4Tit2'>
             <div className='D4Tit2ll'>参展藏品</div>
             <div className='D4Tit2rr'>
-              {['3', '4'].includes(key) ? null : (
+              {pageDisabled ? null : (
                 <>
                   <Button
                     type='primary'
                     onClick={() => {
-                      setNowSta({ key: '5', id: 'cms/orderIn/goods/getList' })
+                      setNowSta({ key: '5', id: 'cms/orderExhibition/goods/getList' })
                     }}
                   >
                     新增
@@ -554,7 +508,8 @@ function F1edit() {
 
           {/* 表格 */}
           <MyTable
-            list={topInfo.goods || []}
+            ref={tableRef}
+            list={snaps}
             columnsTemp={F1_GOOD_COLUMNS}
             pagingInfo={false}
             lastBtn={tableLastBtn}
@@ -562,6 +517,11 @@ function F1edit() {
         </div>
       </div>
 
+      {/* 申请流程 */}
+      {auditsShow ? (
+        <ZflowTable tableArr={topInfo.audits || []} closeFu={() => setAuditsShow(false)} />
+      ) : null}
+
       {/* 底部按钮 */}
       <div className='D4btn'>
         {['3', '4'].includes(key) &&
@@ -593,7 +553,7 @@ function F1edit() {
               </Button>
             ) : null}
 
-            <MyPopconfirm txtK='取消' onConfirm={() => history.push('/impStor')} />
+            <MyPopconfirm txtK='取消' onConfirm={() => history.push('/exhibiton')} />
           </>
         )}
       </div>
@@ -603,9 +563,17 @@ function F1edit() {
         <ZGaddNow
           nowSta={nowSta}
           closeFu={() => setNowSta({ key: '', id: '' })}
-          dataResFu={data => setTopInfo({ ...topInfo, goods: data })}
-          oldCheckArr={topInfo.goods || []}
-          canObj={{ storageId: topInfo.storageId }}
+          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>

+ 105 - 17
src/pages/F_exhibition/F1exhibition/constants.ts

@@ -1,42 +1,130 @@
 import { selectObj } from '@/utils/select'
-import { F1exhibitionSearchType, IF1exhibitionParams } from './types'
-import { statusStorageObj } from '@/utils/tableData'
+import {
+  F1_SON_TYPE_ENUM,
+  F1_SON_TYPE_NAME_ENUM,
+  F1exhibitionSearchType,
+  IF1exhibitionParams
+} from './types'
+import { statusObj } from '@/utils/tableData'
 
 export const DEFAULT_F1exhibition_PARAMS: IF1exhibitionParams = {
   pageNum: 1,
-  pageSize: 10,
-  num: ''
+  pageSize: 10
 }
 
 export const F1EXHIBITION_PARAM_ROWS: F1exhibitionSearchType[] = [
   { name: '业务编号', key: 'num', type: '输入框' },
-  { name: '展览名称', key: 'num', type: '输入框' },
-  { name: '展览类型', key: 'num', type: '下拉框', data: selectObj['业务类型'] },
-  { name: '借展类型', key: 'num', type: '下拉框', data: selectObj['业务类型'] },
-  { name: '借展单位/部门', key: 'num', type: '输入框' },
-  { name: '发起人', key: 'num', type: '输入框' },
-  { name: '发起日期范围', key: 'num', type: '日期选择' },
+  { name: '展览名称', key: 'typeName', type: '输入框' },
+  { name: '展览类型', key: 'sonTypeName', type: '下拉框', data: selectObj['展览类型'] },
+  { name: '借展类型', key: 'sonType', type: '下拉框', data: selectObj['借展类型'] },
+  { name: '借展单位/部门', key: 'sonUnit', type: '输入框' },
+  { name: '发起人', key: 'creatorName', type: '输入框' },
+  { name: '发起日期范围', key: 'date', type: '日期选择' },
   { name: '申请状态', key: 'num', type: '下拉框', data: selectObj['流程申请状态'] }
 ]
 
-export const F1EXHIBITION_TABLE_COLUMNS = [['txt', '业务编号', 'num']]
+export const F1_SON_TYPE_OBJ = {
+  [F1_SON_TYPE_ENUM.IN]: '馆内展览',
+  [F1_SON_TYPE_ENUM.OUT]: '馆外展览'
+}
+export const F1_SON_TYPE_NAME_OBJ = {
+  [F1_SON_TYPE_NAME_ENUM.FIXED]: '固定展览',
+  [F1_SON_TYPE_NAME_ENUM.TEMP]: '临时展览'
+}
+
+export const F1EXHIBITION_TABLE_COLUMNS = [
+  ['txt', '业务编号', 'num'],
+  ['txt', '展览名称', 'typeName'],
+  ['txtChange', '展览类型', 'sonTypeName', F1_SON_TYPE_NAME_OBJ],
+  ['txtChange', '借展类型', 'sonType', F1_SON_TYPE_OBJ],
+  ['txt', '借展单位/部门', 'sonUnit'],
+  ['txt', '发起人', 'creatorName'],
+  ['txt', '发起日期', 'createTime'],
+  ['txtChange', '申请状态', 'status', statusObj]
+]
 
 export const F1_GOOD_COLUMNS = [
-  ['img', '封面图', 'thumb'],
   ['txt', '编号类型', 'numName'],
   ['txt', '藏品编号', 'goodsNum'],
   ['txt', '藏品名称', 'goodsName'],
   ['ping', '数量', 'pcs', 'pcsUnit'],
-  ['txtChange', '库存状态', 'statusStorage', statusStorageObj],
+  ['datePicker', '借出日期 *', 'lendDate'],
+  [
+    'input',
+    '出借经手人(甲方)',
+    'lenderA',
+    {
+      maxLength: 20,
+      placeholder: '请填写内容,不超过20字'
+    }
+  ],
+  [
+    'input',
+    '出借经手人(乙方)',
+    'lenderb',
+    {
+      maxLength: 20,
+      placeholder: '请填写内容,不超过20字'
+    }
+  ],
+  ['datePicker', '预计归还日期', 'expectedReturnDate'],
+  ['datePicker', '归还日期', 'returnDate'],
+  [
+    'input',
+    '归还经手人(甲方)',
+    'handlerA',
+    {
+      maxLength: 20,
+      placeholder: '请填写内容,不超过20字'
+    }
+  ],
+  [
+    'input',
+    '归还经手人(乙方)',
+    'handlerB',
+    {
+      maxLength: 20,
+      placeholder: '请填写内容,不超过20字'
+    }
+  ],
   [
     'input',
-    '放置位置',
-    'address',
+    '记录人',
+    'recorder',
     {
       maxLength: 20,
       placeholder: '请填写内容,不超过20字'
     }
   ],
-  ['datePicker', '借出日期 *', 'startDate'],
-  ['datePicker', '预计归还日期 *', 'endDate']
+  [
+    'input',
+    '备注',
+    'remark',
+    {
+      maxLength: 20,
+      placeholder: '请填写内容,不超过20字'
+    }
+  ]
+]
+
+export const F1_SON_TYPE_NAME_OPTS = [
+  {
+    label: '临时展览',
+    value: F1_SON_TYPE_NAME_ENUM.TEMP
+  },
+  {
+    label: '固定展览',
+    value: F1_SON_TYPE_NAME_ENUM.FIXED
+  }
+]
+
+export const F1_SON_TYPE_OPTS = [
+  {
+    label: '馆内展览',
+    value: F1_SON_TYPE_ENUM.IN
+  },
+  {
+    label: '馆外展览',
+    value: F1_SON_TYPE_ENUM.OUT
+  }
 ]

+ 71 - 11
src/pages/F_exhibition/F1exhibition/index.tsx

@@ -2,17 +2,21 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { Button, Cascader, DatePicker, Input, Select } from 'antd'
 import { useDispatch, useSelector } from 'react-redux'
-import { RootState } from '@/store'
-import { F1exhibitionSearchType, IF1exhibitionParams } from './types'
+import store, { RootState } from '@/store'
+import { F1exhibitionItemType, F1exhibitionSearchType, IF1exhibitionParams } from './types'
 import {
   DEFAULT_F1exhibition_PARAMS,
+  F1_SON_TYPE_NAME_OBJ,
+  F1_SON_TYPE_OBJ,
   F1EXHIBITION_PARAM_ROWS,
   F1EXHIBITION_TABLE_COLUMNS
 } from './constants'
 import history, { btnFlagFu } from '@/utils/history'
-import { A3_APIList } from '@/store/action/A3flow'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import MyTable from '@/components/MyTable'
+import { F1_APIdel, F1_APIList } from '@/store/action/F1exhibition'
+import { MessageFu } from '@/utils/message'
+import { statusObj } from '@/utils/tableData'
 
 const { RangePicker } = DatePicker
 
@@ -21,6 +25,7 @@ function F1exhibition() {
   const tableInfo = useSelector((state: RootState) => state.F1exhibition.tableInfo)
   const [formData, setFormData] = useState({ ...DEFAULT_F1exhibition_PARAMS })
   const formDataRef = useRef({ ...DEFAULT_F1exhibition_PARAMS })
+  const formDataOldRef = useRef({ ...DEFAULT_F1exhibition_PARAMS })
   const dispatch = useDispatch()
 
   // 输入框的改变
@@ -121,14 +126,26 @@ function F1exhibition() {
       // @ts-ignore
       rest.endTime = date[1]
     }
-    dispatch(A3_APIList(rest))
+    formDataOldRef.current = rest
+    dispatch(F1_APIList(rest))
   }, [dispatch])
 
   // 点击操作按钮
-  const tableBtnFu = useCallback((item: any, key: string) => {}, [])
+  const tableBtnFu = useCallback((id: any, key: string) => {
+    history.push(`/exhibition_edit/${key}/${id}`)
+  }, [])
 
   // 点击删除
-  const delTableFu = useCallback(async (item: any) => {}, [])
+  const delTableFu = useCallback(
+    async (id: any) => {
+      const res = await F1_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
@@ -141,23 +158,25 @@ function F1exhibition() {
           ) : (
             <>
               {obj['编辑'] ? (
-                <Button size='small' type='text' onClick={() => tableBtnFu(item, '2')}>
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '2')}>
                   编辑
                 </Button>
               ) : null}
 
               {obj['审批'] ? (
-                <Button size='small' type='text' onClick={() => tableBtnFu(item, '3')}>
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
                   审批
                 </Button>
               ) : null}
               {obj['查看'] ? (
-                <Button size='small' type='text' onClick={() => tableBtnFu(item, '4')}>
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '4')}>
                   查看
                 </Button>
               ) : null}
 
-              {obj['删除'] ? <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item)} /> : null}
+              {obj['删除'] ? (
+                <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+              ) : null}
             </>
           )
         }
@@ -165,6 +184,45 @@ function F1exhibition() {
     ]
   }, [delTableFu, tableBtnFu])
 
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    const res = await F1_APIList(
+      {
+        ...formDataOldRef.current
+      },
+      true
+    )
+
+    if (res.code === 0) {
+      if (res.data.records.length <= 0) return MessageFu.warning('当前搜索条件没有数据!')
+      store.dispatch({
+        type: 'layout/exInfo',
+        payload: {
+          name: '借展管理',
+          show: true,
+          arr: [
+            { key: 'num', txt: '业务编号' },
+            { key: 'typeName', txt: '展览名称' },
+            { key: 'sonTypeName', txt: '展览类型' },
+            { key: 'sonType', txt: '借展类型' },
+            { key: 'sonUnit', txt: '借展单位/部门' },
+            { key: 'creatorName', txt: '发起人' },
+            { key: 'createTime', txt: '发起日期' },
+            { key: 'status', txt: '申请状态' }
+          ],
+          data: res.data.records.map((v: F1exhibitionItemType) => ({
+            ...v,
+            status: statusObj[v.status as 1],
+            // @ts-ignore
+            sonType: F1_SON_TYPE_OBJ[v.sonType],
+            // @ts-ignore
+            sonTypeName: F1_SON_TYPE_NAME_OBJ[v.sonTypeName]
+          }))
+        }
+      })
+    }
+  }, [])
+
   useEffect(() => {
     getListFu()
   }, [getListFu, timeKey])
@@ -184,7 +242,9 @@ function F1exhibition() {
 
       {/* 第二行 */}
       <div className='C1top C1top2'>
-        <Button type='primary'>批量导出</Button>
+        <Button type='primary' onClick={deriveFu}>
+          批量导出
+        </Button>
         &emsp;
         <Button type='primary' onClick={() => history.push('/exhibition_edit/1/null')}>
           新增

+ 21 - 5
src/pages/F_exhibition/F1exhibition/types.ts

@@ -1,7 +1,8 @@
-export type F1exhibitionItemType = {
-  id: number
-  num: string
-  name: string
+import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
+
+export interface F1exhibitionItemType extends FourTableType {
+  sonType: string
+  sonNum: string
 }
 
 export type F1exhibitionSearchType = {
@@ -14,6 +15,21 @@ export type F1exhibitionSearchType = {
 export interface IF1exhibitionParams {
   pageSize: number
   pageNum: number
-  num: string
+  num?: string
+  typeName?: string
+  sonUnit?: string
+  sonType?: string
+  sonTypeName?: string
+  creatorName?: string
   date?: string[]
 }
+
+export enum F1_SON_TYPE_NAME_ENUM {
+  TEMP = 1,
+  FIXED = 2
+}
+
+export enum F1_SON_TYPE_ENUM {
+  IN = 'in',
+  OUT = 'out'
+}

+ 58 - 2
src/store/action/F1exhibition.ts

@@ -5,9 +5,9 @@ import { AppDispatch } from '..'
  * 借展管理-列表
  */
 export const F1_APIList = (data: any, exportFlag = false): any => {
-  if (exportFlag) return http.post('/cms/flowManage/page', data)
+  if (exportFlag) return http.post('/cms/orderExhibition/page', data)
   return async (dispatch: AppDispatch) => {
-    const res = await http.post('/cms/flowManage/page', data)
+    const res = await http.post('/cms/orderExhibition/page', data)
     if (res.code === 0) {
       const obj = {
         list: res.data.records,
@@ -18,3 +18,59 @@ export const F1_APIList = (data: any, exportFlag = false): any => {
     }
   }
 }
+
+/**
+ * 借展管理-删除
+ */
+export const F1_APIdel = (id: number) => {
+  return http.get(`cms/orderExhibition/remove/${id}`)
+}
+
+/**
+ * 借展管理-获取详情
+ */
+export const F1_APIgetInfo = (id: number) => {
+  return http.get(`cms/orderExhibition/detail/${id}`)
+}
+
+/**
+ * 借展管理-创建订单
+ */
+export const F1_APIcreate = () => {
+  return http.get('/cms/orderExhibition/create')
+}
+
+/**
+ * 借展管理-存草稿
+ */
+export const F1_APIsaveDraft = (data: any) => {
+  return http.post('cms/orderExhibition/saveDraft', data)
+}
+
+/**
+ * 借展管理-创建
+ */
+export const F1_APIsaveCreate = (data: any) => {
+  return http.post('cms/orderExhibition/saveCreate', data)
+}
+
+/**
+ * 借展管理-编辑保存
+ */
+export const F1_APIsaveApply = (data: any) => {
+  return http.post('cms/orderExhibition/saveApply', data)
+}
+
+/**
+ * 借展管理-审批
+ */
+export const F1_APIsaveAudit = (data: any) => {
+  return http.post('cms/orderExhibition/audit', data)
+}
+
+/**
+ * 借展管理-撤回
+ */
+export const F1_APIrevocation = (id: number) => {
+  return http.get(`cms/orderExhibition/revocation/${id}`)
+}

+ 2 - 2
src/utils/http.ts

@@ -7,8 +7,8 @@ import { domShowFu } from './domShow'
 
 export const envFlag = process.env.NODE_ENV === 'development'
 
-// const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
-const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
+const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
+// const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')
 

+ 9 - 0
src/utils/select.ts

@@ -1,4 +1,5 @@
 import { SON_TYPE_NAME } from '@/pages/D_storeManage/D3staff/types'
+import { F1_SON_TYPE_ENUM, F1_SON_TYPE_NAME_ENUM } from '@/pages/F_exhibition/F1exhibition/types'
 
 export const selectObj = {
   申请状态: [
@@ -111,5 +112,13 @@ export const selectObj = {
   入库人员类型: [
     { value: SON_TYPE_NAME.IN, label: '内部人员' },
     { value: SON_TYPE_NAME.OUT, label: '外部人员' }
+  ],
+  展览类型: [
+    { value: F1_SON_TYPE_NAME_ENUM.TEMP, label: '临时展览' },
+    { value: F1_SON_TYPE_NAME_ENUM.FIXED, label: '固定展览' }
+  ],
+  借展类型: [
+    { value: F1_SON_TYPE_ENUM.IN, label: '馆内展览' },
+    { value: F1_SON_TYPE_ENUM.OUT, label: '馆外展览' }
   ]
 }