Browse Source

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

shaogen1995 3 months ago
parent
commit
cc654b2cb1

+ 117 - 129
src/pages/C_goodsManage/C21wealth/C21edit/index.tsx

@@ -1,10 +1,10 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { useParams } from 'react-router-dom'
-import { Button, Input, Select } from 'antd'
+import { Button, Cascader, Checkbox, Input } from 'antd'
 import ZRichTexts from '@/components/ZRichTexts'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
+import history, { btnFlagFu2, cascaderObjFu, openGoodsInfoFu } from '@/utils/history'
 import { MessageFu } from '@/utils/message'
 import MyTable from '@/components/MyTable'
 import classNames from 'classnames'
@@ -12,23 +12,19 @@ import { D4goodsTableC, statusObj } from '@/utils/tableData'
 import ZGaddNow from '@/components/ZGaddNow'
 import X3auditInfo from '@/pages/X_stock/X3auditInfo'
 import ZflowTable from '@/components/ZflowTable'
-import {
-  D4_APIcreate,
-  D4_APIdel,
-  D4_APIgetInfo,
-  D4_APIrevocation,
-  D4_APIsaveApply,
-  D4_APIsaveAudit,
-  D4_APIsaveCreate,
-  D4_APIsaveDraft
-} from '@/store/action/D4impStor'
-import { useDispatch, useSelector } from 'react-redux'
-import { RootState } from '@/store'
-import { D2_APIgetList } from '@/store/action/D2storSet'
 import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
 import { EXbtnFu } from '@/utils/EXBtn'
-import { D6_APIgetList } from '@/store/action/D6putsStor'
-import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
+import {
+  C21_APIcreate,
+  C21_APIdel,
+  C21_APIgetInfo,
+  C21_APIsaveApply,
+  C21_APIsaveAudit,
+  C21_APIsaveCreate,
+  C21_APIsaveDraft
+} from '@/store/action/C21wealth'
+import { MEDIA_TYPES } from '../constants'
+import { IC21Detail } from '../types'
 
 export const pageTitTxtObj = {
   1: '新增',
@@ -44,39 +40,48 @@ function C21edit() {
   // 滚到顶部
   const sollrDom = useRef<HTMLDivElement>(null)
 
-  // 获取出库列表,下拉 - 相关出库单用
-  const dispatch = useDispatch()
-
-  useEffect(() => {
-    dispatch(D6_APIgetList({ pageNum: 1, pageSize: 99999 }))
-  }, [dispatch])
-
-  const putsList = useSelector((state: RootState) => state.D6putsStor.tableInfo.list)
-
   // 顶部数据
-  const [topInfo, setTopInfo] = useState({} as FourTableType)
+  const [topInfo, setTopInfo] = useState({
+    sonTypeName: '',
+    effect: ''
+  } as IC21Detail)
 
-  // 入库库房数组信息
-  useEffect(() => {
-    dispatch(D2_APIgetList({ pageNum: 1, pageSize: 99999 }))
-  }, [dispatch])
+  // 藏品清单快照数据
+  const [snaps, setSnaps] = useState<C1GoodType[]>([])
+  const delSnapIdsRef = useRef<number[]>([])
+
+  const snapsID2ref = useRef<{ goodsId: number; id: number }[]>([])
 
   // 创建订单
   const creatFu = useCallback(async () => {
-    const res = await D4_APIcreate()
+    const res = await C21_APIcreate()
     if (res.code === 0) {
-      setTopInfo(res.data)
+      setTopInfo({ ...res.data, sonTypeName: MEDIA_TYPES.map(i => i.value).join(',') })
     }
   }, [])
 
   // 获取详情
   const getInfoFu = useCallback(async () => {
-    const res = await D4_APIgetInfo(id)
+    const res = await C21_APIgetInfo(id)
     if (res.code === 0) {
       setTopInfo(res.data)
 
       // 设置富文本
       ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf || '{}'))
+
+      // 藏品清单快照信息id对比
+      const arrTemp: any = []
+      const snapsTemp = res.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])
 
@@ -87,10 +92,6 @@ function C21edit() {
     if (sollrDom.current) sollrDom.current.scrollTop = 0
   }, [creatFu, getInfoFu, key])
 
-  // 上传附件的ref
-  const filesRef = useRef<any>(null)
-  // const filesRes = filesRef.current.filesIdRes();
-
   // 富文本的ref
   const ZRichTextRef = useRef<any>(null)
 
@@ -102,16 +103,12 @@ function C21edit() {
   }, [key])
 
   const checkDataFu = useCallback(() => {
-    if (!topInfo.name) {
-      MessageFu.warning('申请名称不能为空')
+    if (!topInfo.effect) {
+      MessageFu.warning('请选择使用途径')
       return true
     }
     if (!topInfo.sonTypeName) {
-      MessageFu.warning('请选择业务类型')
-      return true
-    }
-    if (!topInfo.storageId) {
-      MessageFu.warning('请选择入库库房')
+      MessageFu.warning('请选择资源类型')
       return true
     }
 
@@ -127,13 +124,7 @@ function C21edit() {
       if (checkDataFu()) return
 
       if (val !== '草稿') {
-        if (!topInfo.goods || (topInfo.goods && topInfo.goods.length === 0)) {
-          return MessageFu.warning('请添加藏品')
-        } else {
-          if (topInfo.goods.some(v => !v.siteStr || !v.siteId)) {
-            return MessageFu.warning('请选择存放位置')
-          }
-        }
+        if (snaps.length === 0) return MessageFu.warning('请添加藏品')
       }
 
       if (val === '审批') {
@@ -144,7 +135,7 @@ function C21edit() {
         }
         const rtf2 = ZAuditRef.current?.resData()
 
-        const res = await D4_APIsaveAudit({
+        const res = await C21_APIsaveAudit({
           orderId: topInfo.id,
           rtfOpinion: rtf2,
           status: auditSta === '同意' ? 1 : 2
@@ -159,17 +150,16 @@ function C21edit() {
         const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
         // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
 
-        // 上传附件
-        const filesRes = filesRef.current.filesIdRes()
-
         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)
           }))
         }
         // console.log(123, obj)
@@ -178,21 +168,21 @@ function C21edit() {
 
         if (val === '草稿') {
           // 存草稿 当前页保存 不跳转
-          const res = await D4_APIsaveDraft(obj)
+          const res = await C21_APIsaveDraft(obj)
           if (res.code === 0) {
             MessageFu.success('草稿保存成功')
           }
         } else {
-          const res = val === '创建' ? await D4_APIsaveCreate(obj) : await D4_APIsaveApply(obj)
+          const res = val === '创建' ? await C21_APIsaveCreate(obj) : await C21_APIsaveApply(obj)
           if (res.code === 0) {
             MessageFu.success(`${val}成功`)
             // 跳到详情页
-            history.push(`/impStor_edit/4/${topInfo.id}`)
+            history.push(`/wealth_edit/4/${topInfo.id}`)
           }
         }
       }
     },
-    [auditSta, checkDataFu, topInfo]
+    [auditSta, checkDataFu, topInfo, snaps]
   )
 
   // 打开侧边栏
@@ -249,39 +239,24 @@ function C21edit() {
 
   // 查看的按钮创建-提交-撤回
   const lookBtnFu = useCallback(
-    async (val: '创建' | '提交' | '撤回') => {
-      if (val !== '撤回') {
-        if (!topInfo.goods || (topInfo.goods && topInfo.goods.length === 0)) {
-          return MessageFu.warning('请添加藏品')
-        } else {
-          if (topInfo.goods.some(v => !v.siteStr || !v.siteId)) {
-            return MessageFu.warning('请选择存放位置')
-          }
-        }
-      }
-
+    async (val: '创建' | '提交') => {
       const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
       // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
 
-      // 上传附件
-      const filesRes = filesRef.current.filesIdRes()
       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)
         }))
       }
 
-      const res =
-        val === '创建'
-          ? await D4_APIsaveCreate(obj)
-          : val === '提交'
-          ? await D4_APIsaveApply(obj)
-          : await D4_APIrevocation(id)
+      const res = val === '创建' ? await C21_APIsaveCreate(obj) : await C21_APIsaveApply(obj)
 
       if (res.code === 0) {
         if (sollrDom.current) sollrDom.current.scrollTop = 0
@@ -289,22 +264,22 @@ function C21edit() {
         getInfoFu()
       }
     },
-    [getInfoFu, id, topInfo]
+    [getInfoFu, topInfo, snaps]
   )
 
   // 查看模式点击删除
   const delFu = useCallback(async () => {
-    const res = await D4_APIdel(id)
+    const res = await C21_APIdel(id)
     if (res.code === 0) {
       MessageFu.success('删除成功')
-      history.push('/impStor')
+      history.push('/wealth')
     }
   }, [id])
 
   // 查看模式点击审批 编辑
   const lookJumpFu = useCallback(
     (val: '审批' | '编辑') => {
-      history.push(`/impStor_edit/${val === '审批' ? 3 : 2}/${id}`)
+      history.push(`/wealth_edit/${val === '审批' ? 3 : 2}/${id}`)
       MessageFu.success(`已跳转至${val}页面`)
     },
     [id]
@@ -325,18 +300,6 @@ function C21edit() {
           </Button>
         ) : null}
 
-        {btnFlagFu2(topInfo)['撤回'] ? (
-          <MyPopconfirm
-            txtK='撤回'
-            onConfirm={() => lookBtnFu('撤回')}
-            Dom={
-              <Button type='primary' danger>
-                撤回
-              </Button>
-            }
-          />
-        ) : null}
-
         {btnFlagFu2(topInfo)['审批'] ? (
           <Button type='primary' onClick={() => lookJumpFu('审批')}>
             审批
@@ -368,7 +331,7 @@ function C21edit() {
           />
         ) : null}
 
-        <Button onClick={() => history.push('/impStor')}>返回</Button>
+        <Button onClick={() => history.push('/wealth')}>返回</Button>
       </>
     )
   }, [delFu, lookBtnFu, lookJumpFu, topInfo])
@@ -383,7 +346,7 @@ function C21edit() {
       <div className='D4main' ref={sollrDom}>
         {['3'].includes(key) ? (
           <X3auditInfo
-            dirCode='D4impStor'
+            dirCode='D4wealth'
             myUrl='cms/orderIn/upload'
             auditSta={auditSta}
             auditStaFu={val => setAuDitSta(val)}
@@ -401,37 +364,39 @@ function C21edit() {
         <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 className='D4row'>
-            <div className='D4rowll'>使用途径:</div>
+            <div className='D4rowll'>
+              <span> * </span>使用途径:
+            </div>
             <div className='D4rowrr'>
-              <Select
-                disabled={['3', '4'].includes(key)}
-                placeholder={['3', '4'].includes(key) ? '(空)' : '请搜索出库单编码'}
-                showSearch
-                options={putsList}
-                fieldNames={{ label: 'num', value: 'num' }}
-                allowClear={true}
-                value={topInfo.relatedOrderNum || null}
-                onChange={e => setTopInfo({ ...topInfo, relatedOrderNum: e ? e : '' })}
-              />
+              {topInfo.num && (
+                <Cascader
+                  defaultValue={topInfo.effect.split(',')}
+                  disabled={['3', '4'].includes(key)}
+                  options={cascaderObjFu()['附件用途']}
+                  onChange={e => setTopInfo({ ...topInfo, effect: e ? e.join(',') : '' })}
+                  placeholder='请选择'
+                  fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+                />
+              )}
             </div>
           </div>
 
@@ -449,12 +414,28 @@ function C21edit() {
             </div>
           </div>
 
-          <div className='D4row D4rowFull'>
+          <div className='D4row D4rowFull' style={{ margin: '0 0 20px' }}>
+            <div className='D4rowll'>
+              <span> * </span>资源类型:
+            </div>
+            <div className='D4rowrr'>
+              {topInfo.num && (
+                <Checkbox.Group
+                  defaultValue={topInfo.sonTypeName.split(',')}
+                  disabled={['3', '4'].includes(key)}
+                  options={MEDIA_TYPES}
+                  onChange={e => setTopInfo({ ...topInfo, sonTypeName: e.join(',') })}
+                />
+              )}
+            </div>
+          </div>
+
+          <div className='D4row D4rowFull' style={{ margin: 0 }}>
             <div className='D4rowll'>备注:</div>
             <div className='D4rowrr'>
               <ZRichTexts
                 check={false}
-                dirCode='impStor'
+                dirCode='wealth'
                 myUrl='cms/orderIn/upload'
                 isLook={['3', '4'].includes(key)}
                 ref={ZRichTextRef}
@@ -475,8 +456,7 @@ function C21edit() {
                   <Button
                     type='primary'
                     onClick={() => {
-                      if (!topInfo.storageId) return MessageFu.warning('请先选择入库库房')
-                      setNowSta({ key: '5', id: 'cms/orderIn/goods/getList' })
+                      setNowSta({ key: '5', id: 'cms/orderZy/goods/getList' })
                     }}
                   >
                     新增
@@ -488,7 +468,7 @@ function C21edit() {
 
           {/* 表格 */}
           <MyTable
-            list={topInfo.goods || []}
+            list={snaps}
             columnsTemp={D4goodsTableC}
             startBtn={startBtn}
             lastBtn={tableLastBtn}
@@ -530,7 +510,7 @@ function C21edit() {
               </Button>
             ) : null}
 
-            <MyPopconfirm txtK='取消' onConfirm={() => history.push('/impStor')} />
+            <MyPopconfirm txtK='取消' onConfirm={() => history.push('/wealth')} />
           </>
         )}
       </div>
@@ -540,9 +520,17 @@ function C21edit() {
         <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>

+ 53 - 15
src/pages/C_goodsManage/C21wealth/constants.ts

@@ -1,25 +1,25 @@
 import { selectObj } from '@/utils/select'
 import { C21WealthSearchType, IC21WealthParams } from './types'
-import { statusStorageObj } from '@/utils/tableData'
-
-export const DEFAULT_C21WEALTH_PARAMS: IC21WealthParams = {
-  pageNum: 1,
-  pageSize: 10,
-  num: ''
-}
+import { statusObj, statusStorageObj } from '@/utils/tableData'
 
 export const C21WEALTH_PARAM_ROWS: C21WealthSearchType[] = [
   { 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: 'num', type: '下拉框', data: selectObj['流程申请状态'] }
+  { name: '申请名称', key: 'name', type: '输入框' },
+  { name: '发起部门', key: 'deptName', type: '输入框' },
+  { name: '发起人', key: 'userName', type: '输入框' },
+  { name: '发起日期范围', key: 'date', type: '日期选择' },
+  { name: '申请状态', key: 'status', type: '下拉框', data: selectObj['流程申请状态'] },
+  { name: '选择角色', key: 'userType', type: '下拉框', data: selectObj['角色'] }
 ]
 
-export const C21WEALTH_TABLE_COLUMNS = [['txt', '业务编号', 'num']]
+export const C21WEALTH_TABLE_COLUMNS = [
+  ['txt', '业务编号', 'num'],
+  ['txt', '申请名称', 'name'],
+  ['txt', '发起部门', 'deptName'],
+  ['txt', '发起人', 'userName'],
+  ['txt', '发起日期', 'createTime'],
+  ['txtChange', '申请状态', 'status', statusObj]
+]
 
 export const C21WEALTH_COLUMNS = [
   ['img', '封面图', 'thumb'],
@@ -40,3 +40,41 @@ export const C21WEALTH_COLUMNS = [
   ['datePicker', '借出日期 *', 'startDate'],
   ['datePicker', '预计归还日期 *', 'endDate']
 ]
+
+export const MEDIA_TYPES = [
+  {
+    label: '图像',
+    value: 'img'
+  },
+  {
+    label: '3D',
+    value: 'model'
+  },
+  {
+    label: '音频',
+    value: 'audio'
+  },
+  {
+    label: '视频',
+    value: 'video'
+  },
+  {
+    label: '文档',
+    value: 'doc'
+  },
+  {
+    label: '其他',
+    value: 'other'
+  }
+]
+
+export const DEFAULT_C21WEALTH_PARAMS: IC21WealthParams = {
+  pageNum: 1,
+  pageSize: 10,
+  num: '',
+  userName: '',
+  deptName: '',
+  name: '',
+  status: '',
+  userType: ''
+}

+ 69 - 11
src/pages/C_goodsManage/C21wealth/index.tsx

@@ -3,7 +3,6 @@ import styles from './index.module.scss'
 import { useDispatch, useSelector } from 'react-redux'
 import { RootState } from '@/store'
 import { Button, Cascader, DatePicker, Input, Select } from 'antd'
-import { A3_APIList } from '@/store/action/A3flow'
 import history, { btnFlagFu } from '@/utils/history'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import MyTable from '@/components/MyTable'
@@ -12,15 +11,21 @@ import {
   C21WEALTH_TABLE_COLUMNS,
   DEFAULT_C21WEALTH_PARAMS
 } from './constants'
-import { C21WealthSearchType, IC21WealthParams } from './types'
+import { C21WealthSearchType, IC21WealthItem, IC21WealthParams } from './types'
+import { C21_APIdel, C21_APIList } from '@/store/action/C21wealth'
+import { MessageFu } from '@/utils/message'
+import dayjs from 'dayjs'
+import { statusObj } from '@/utils/tableData'
+import ExportJsonExcel from 'js-export-excel'
 
 const { RangePicker } = DatePicker
 
 function C21wealth() {
   // 从仓库拿数据
-  const tableInfo = useSelector((state: RootState) => state.F1exhibition.tableInfo)
+  const tableInfo = useSelector((state: RootState) => state.C21wealth.tableInfo)
   const [formData, setFormData] = useState({ ...DEFAULT_C21WEALTH_PARAMS })
   const formDataRef = useRef({ ...DEFAULT_C21WEALTH_PARAMS })
+  const formDataOldRef = useRef({ ...DEFAULT_C21WEALTH_PARAMS })
   const dispatch = useDispatch()
 
   // 输入框的改变
@@ -121,14 +126,26 @@ function C21wealth() {
       // @ts-ignore
       rest.endTime = date[1]
     }
-    dispatch(A3_APIList(rest))
+    formDataOldRef.current = rest
+    dispatch(C21_APIList(rest))
   }, [dispatch])
 
   // 点击操作按钮
-  const tableBtnFu = useCallback((item: any, key: string) => {}, [])
+  const tableBtnFu = useCallback((id: any, key: string) => {
+    history.push(`/wealth_edit/${key}/${id}`)
+  }, [])
 
   // 点击删除
-  const delTableFu = useCallback(async (item: any) => {}, [])
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await C21_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
@@ -141,23 +158,25 @@ function C21wealth() {
           ) : (
             <>
               {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,43 @@ function C21wealth() {
     ]
   }, [delTableFu, tableBtnFu])
 
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    const name = '资源使用' + dayjs(new Date()).format('YYYY-MM-DD HH:mm')
+
+    const res = await C21_APIList(
+      {
+        ...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: IC21WealthItem) => ({
+              ...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() //保存
+    }
+  }, [])
+
   useEffect(() => {
     getListFu()
   }, [getListFu, timeKey])
@@ -184,7 +240,9 @@ function C21wealth() {
 
       {/* 第二行 */}
       <div className='C1top C1top2'>
-        <Button type='primary'>批量导出</Button>
+        <Button type='primary' onClick={deriveFu}>
+          批量导出
+        </Button>
         &emsp;
         <Button type='primary' onClick={() => history.push('/wealth_edit/1/null')}>
           新增

+ 12 - 1
src/pages/C_goodsManage/C21wealth/types.ts

@@ -1,4 +1,6 @@
-export type C21WealthItemType = {
+import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
+
+export interface IC21WealthItem extends FourTableType {
   id: number
   num: string
   name: string
@@ -16,4 +18,13 @@ export interface IC21WealthParams {
   pageNum: number
   num: string
   date?: string[]
+  userName: string
+  deptName: string
+  name: string
+  status: string
+  userType: string
+}
+
+export interface IC21Detail extends FourTableType {
+  effect: string
 }

+ 1 - 1
src/store/action/C1ledger.ts

@@ -21,7 +21,7 @@ export const API_goodsInfo = (id: number) => {
  * 藏品-弹窗-选择藏品
  */
 export const API_goodsNowAdd = (url: string, data: any) => {
-  return http.post(url, data)
+  return http.get(url, data)
 }
 
 /**

+ 69 - 0
src/store/action/C21wealth.ts

@@ -0,0 +1,69 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ * 资源管理-列表
+ */
+export const C21_APIList = (data: any, exportFlag = false): any => {
+  if (exportFlag) return http.post('/cms/orderZy/page', data)
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('/cms/orderZy/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'C21/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 入库-删除
+ */
+export const C21_APIdel = (id: number) => {
+  return http.get(`cms/orderZy/remove/${id}`)
+}
+
+/**
+ * 入库-获取详情
+ */
+export const C21_APIgetInfo = (id: number) => {
+  return http.get(`cms/orderZy/detail/${id}`)
+}
+
+/**
+ * 资源管理-创建订单
+ */
+export const C21_APIcreate = () => {
+  return http.get('/cms/orderZy/create')
+}
+
+/**
+ * 资源管理-存草稿
+ */
+export const C21_APIsaveDraft = (data: any) => {
+  return http.post('cms/orderZy/saveDraft', data)
+}
+
+/**
+ * 资源管理-创建
+ */
+export const C21_APIsaveCreate = (data: any) => {
+  return http.post('cms/orderZy/saveCreate', data)
+}
+
+/**
+ * 资源管理-编辑保存
+ */
+export const C21_APIsaveApply = (data: any) => {
+  return http.post('cms/orderZy/saveApply', data)
+}
+
+/**
+ * 资源管理-审批
+ */
+export const C21_APIsaveAudit = (data: any) => {
+  return http.post('cms/orderZy/audit', data)
+}

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

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

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

@@ -29,6 +29,7 @@ import Z6user from './Z6user'
 import Z7log from './Z7log'
 import A3flow from './A3flow'
 import F1exhibition from './F1exhibition'
+import C21wealth from './C21wealth'
 
 // 合并 reducer
 const rootReducer = combineReducers({
@@ -58,7 +59,8 @@ const rootReducer = combineReducers({
   Z6user,
   Z7log,
   A3flow,
-  F1exhibition
+  F1exhibition,
+  C21wealth
 })
 
 // 默认导出