Selaa lähdekoodia

藏品登记接口很多问题 等后端回来沟通

shaogen1995 1 kuukausi sitten
vanhempi
commit
3ee501c82f

+ 43 - 22
后台管理/src/pages/A0addGoods/index.tsx

@@ -14,16 +14,18 @@ import TextArea from 'antd/es/input/TextArea'
 import ZupOne from '@/components/ZupOne'
 import Z3upFiles from '@/components/Z3upFiles'
 import dayjs from 'dayjs'
-import { API_addGoods } from '@/store/action/B1ledger'
+import { API_addGoods, API_getGoodsInfo } from '@/store/action/B1ledger'
 import { MessageFu } from '@/utils/message'
 import history from '@/utils/history'
+import { B2_APIresubmit } from '@/store/action/B2register'
 
 type Props = {
   sId: number
   closeFu: () => void
+  isEdit?: boolean
 }
 
-function A0addGoods({ sId, closeFu }: Props) {
+function A0addGoods({ sId, closeFu, isEdit }: Props) {
   // 设置表单ref
   const FormBoxRef = useRef<FormInstance>(null)
 
@@ -35,18 +37,26 @@ function A0addGoods({ sId, closeFu }: Props) {
 
   // FormBoxRef.current?.setFieldsValue(res.data.role)
 
-  const getInfoFu = useCallback((id: number) => {
-    // 设置封面图
-    // ZupThumbRef.current?.setFileComFileFu({
-    //   fileName: '',
-    //   filePath: obj.thumbPc,
-    //   thumb: obj.thumb
-    // })
-    // 设置附件
-    // filesRef.current?.showList(list)
-    // inHouseTime registerTime 2个日期需要格式处理一下
-    // if (obj.inHouseTime) obj.inHouseTime = dayjs(obj.inHouseTime)
-    // if (obj.registerTime) obj.registerTime = dayjs(obj.registerTime)
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await API_getGoodsInfo(id)
+
+    if (res.code === 0) {
+      const info = res.data
+
+      // 设置封面图
+      ZupThumbRef.current?.setFileComFileFu({
+        fileName: '',
+        filePath: info.thumbPc,
+        thumb: info.thumb
+      })
+      // 设置附件
+      filesRef.current?.showList(info.file)
+      // inHouseTime registerTime 2个日期需要格式处理一下
+      if (info.inHouseTime) info.inHouseTime = dayjs(info.inHouseTime)
+      if (info.registerTime) info.registerTime = dayjs(info.registerTime)
+
+      FormBoxRef.current?.setFieldsValue(info)
+    }
   }, [])
 
   useEffect(() => {
@@ -77,6 +87,7 @@ function A0addGoods({ sId, closeFu }: Props) {
 
       const obj = {
         ...values,
+        id: sId > 0 ? sId : null,
         inHouseTime,
         registerTime,
         fileIds,
@@ -88,22 +99,32 @@ function A0addGoods({ sId, closeFu }: Props) {
         if (obj[k] === null || obj[k] === undefined) obj[k] = ''
       }
 
-      const res = await API_addGoods(obj)
-      if (res.code === 0) {
-        MessageFu.success(sId > 0 ? '修改成功' : '登记成功')
-        if (sId > 0) {
-          // 待完善
-        } else history.push(`/register_look/1/${res.data.id}`)
+      if (sId > 0) {
+        // 藏品登记页面点击重新提交
+        const res = await B2_APIresubmit(sId, obj)
+        if (res.code === 0) {
+          MessageFu.success('重新提交成功')
+          history.push(`/register_look/1/${res.data.id}`)
+        }
+      } else if (isEdit) {
+        // 藏品修改模块
+      } else {
+        // 藏品登记新增
+        const res = await API_addGoods(obj)
+        if (res.code === 0) {
+          MessageFu.success('登记成功')
+          history.push(`/register_look/1/${res.data.id}`)
+        }
       }
     },
-    [sId]
+    [isEdit, sId]
   )
 
   return (
     <Modal
       wrapClassName={styles.A0addGoods}
       open={true}
-      title={sId > 0 ? '藏品修改' : '藏品登记'}
+      title={isEdit ? '藏品修改' : sId > 0 ? '藏品重新提交' : '藏品登记'}
       footer={
         [] // 设置footer为空,去掉 取消 确定默认按钮
       }

+ 3 - 2
后台管理/src/pages/A0goodsInfo/Tab1info/index.tsx

@@ -8,9 +8,10 @@ import Z3upFiles from '@/components/Z3upFiles'
 
 type Props = {
   info: B1listType
+  auto?: boolean
 }
 
-function Tab1info({ info }: Props) {
+function Tab1info({ info, auto }: Props) {
   // 上传附件的ref
   const filesRef = useRef<any>(null)
 
@@ -19,7 +20,7 @@ function Tab1info({ info }: Props) {
   }, [info.file])
 
   return (
-    <div className={styles.Tab1info}>
+    <div className={styles.Tab1info} style={{ height: auto ? 'auto' : '100%' }}>
       {info.id ? (
         <>
           <div className='T1_1'>

+ 1 - 1
后台管理/src/pages/B1ledger/index.tsx

@@ -10,7 +10,7 @@ import { RootState } from '@/store'
 import A0addGoods from '../A0addGoods'
 import { B1tableC } from '@/utils/tableData'
 import { B1devFu } from '@/utils/deriveFu'
-import history, { openLink } from '@/utils/history'
+import { openLink } from '@/utils/history'
 
 function B1ledger() {
   // 待完善 表格/导出 入库时间 出库时间 当前位置相关

+ 81 - 0
后台管理/src/pages/B2register/B2look/index.module.scss

@@ -1,4 +1,85 @@
 .B2look {
+  background-color: #fff;
+  border-radius: 10px;
+  font-size: 16px;
+  overflow: auto;
+  padding: 20px;
   :global {
+    .B2lTit {
+      font-weight: 700;
+      font-size: 18px;
+      color: var(--themeColor);
+      margin-right: 20px;
+    }
+
+    .B2lTop {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      padding-bottom: 15px;
+
+      .B2lTopll {
+        display: flex;
+        align-items: center;
+      }
+      .B2lToprr {
+        position: absolute;
+        top: 20px;
+        right: 20px;
+      }
+      .B2lTopllBtn {
+        pointer-events: none;
+      }
+    }
+    .B2lTxt {
+      display: flex;
+      flex-wrap: wrap;
+      display: flex;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      padding: 15px 0;
+      margin-bottom: 15px;
+      .B2lTrow {
+        width: 33%;
+        display: flex;
+        margin-bottom: 15px;
+        .B2lTrow1 {
+          width: 100px;
+          font-weight: 700;
+          text-align: right;
+          & > span {
+            color: #ff4d4f;
+          }
+        }
+        .B2lTrow2 {
+          width: calc(100% - 100px);
+        }
+      }
+      .B2lTrowAll {
+        width: 80%;
+        .B2lTrow1 {
+          position: relative;
+          top: 4px;
+        }
+        .B2lTrow2 {
+          .ant-btn {
+            margin-right: 15px;
+          }
+        }
+      }
+    }
+
+    .B2lGood {
+      border-bottom: 1px solid #ccc;
+      margin: 15px 0 15px;
+    }
+
+    .ant-table-wrapper {
+      margin-top: 15px;
+      .ant-table-cell {
+        padding: 8px !important;
+      }
+    }
   }
 }

+ 153 - 4
后台管理/src/pages/B2register/B2look/index.tsx

@@ -1,17 +1,166 @@
-import React, { useEffect } from 'react'
+import React, { useCallback, useEffect, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { useParams } from 'react-router-dom'
+import { API_getGoodsInfo } from '@/store/action/B1ledger'
+import { B1listType } from '@/pages/B1ledger/data'
+import { Button } from 'antd'
+import { statusSelect } from '@/utils/select'
+import history, { backPageFu } from '@/utils/history'
+import Tab1info from '@/pages/A0goodsInfo/Tab1info'
+import MyTable from '@/components/MyTable'
+import TextArea from 'antd/es/input/TextArea'
+import { MessageFu } from '@/utils/message'
+import { B2_APIaduit } from '@/store/action/B2register'
 
 function B2look() {
   const { key, id } = useParams<any>()
 
+  const [info, setInfo] = useState({} as B1listType)
+
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await API_getGoodsInfo(id)
+    if (res.code === 0) {
+      setInfo(res.data)
+    }
+  }, [])
+
   useEffect(() => {
-    console.log(key, id)
-  }, [id, key])
+    if (id) getInfoFu(id)
+  }, [getInfoFu, id, key])
+
+  // 审批的sta
+  const [auditSta, setAuDitSta] = useState('')
+  const [rtfOpinion, setRtfOpinion] = useState('')
+
+  const boxRef = useRef<HTMLDivElement>(null)
+
+  // 点击提交
+  const btnOk = useCallback(async () => {
+    if (!auditSta) {
+      MessageFu.warning('请选择审批结果')
+      boxRef.current?.scrollTo({ top: 0, behavior: 'smooth' })
+      return
+    }
+
+    const res = await B2_APIaduit({
+      orderId: id,
+      rtfOpinion,
+      status: auditSta === '同意' ? 1 : 2
+    })
+
+    if (res.code === 0) {
+      MessageFu.success('审批成功')
+      history.replace(`/register_look/1/${id}`)
+    }
+  }, [auditSta, id, rtfOpinion])
 
   return (
-    <div className={styles.B2look}>
+    <div className={styles.B2look} ref={boxRef}>
       <div className='pageTitle'>藏品登记 - {key === '1' ? '查看' : '审批'}</div>
+
+      {info.id ? (
+        <>
+          <div className='B2lTop'>
+            <div className='B2lTopll'>
+              <div className='B2lTit'>申请信息</div>
+              <div className='B2lTopllBtn'>
+                <Button type='dashed'>
+                  {statusSelect.find(v => v.value === info.status)?.label}
+                </Button>
+              </div>
+            </div>
+            <div className='B2lToprr'>
+              {key === '2' ? (
+                <>
+                  <Button type='primary' onClick={btnOk}>
+                    提交
+                  </Button>
+                  &emsp;
+                </>
+              ) : null}
+              <Button onClick={() => backPageFu('/register')}>返回</Button>
+            </div>
+          </div>
+
+          <div className='B2lTxt'>
+            <div className='B2lTrow'>
+              {/* 待完善 返回数据确实参数 */}
+              <div className='B2lTrow1'>订单编号:</div>
+              <div className='B2lTrow2'>{info.num}</div>
+            </div>
+            <div className='B2lTrow'>
+              <div className='B2lTrow1'>订单名称:</div>
+              <div className='B2lTrow2'>藏品登记</div>
+            </div>
+            <div className='B2lTrow'>
+              <div className='B2lTrow1'>发起人:</div>
+              <div className='B2lTrow2'>待完善</div>
+            </div>
+
+            {/* 审批相关 */}
+            {key === '2' ? (
+              <>
+                <div className='B2lTrow B2lTrowAll'>
+                  <div className='B2lTrow1'>
+                    <span>* </span>审批结果:
+                  </div>
+                  <div className='B2lTrow2'>
+                    {['同意', '不同意'].map(v => (
+                      <Button
+                        key={v}
+                        onClick={() => setAuDitSta(v)}
+                        type={auditSta === v ? 'primary' : 'default'}
+                      >
+                        {v}
+                      </Button>
+                    ))}
+                  </div>
+                </div>
+                <div className='B2lTrow B2lTrowAll'>
+                  <div className='B2lTrow1'>审批意见:</div>
+                  <div className='B2lTrow2'>
+                    <TextArea
+                      value={rtfOpinion}
+                      onChange={e => setRtfOpinion(e.target.value)}
+                      placeholder='请输入内容'
+                      maxLength={200}
+                      showCount
+                    />
+                  </div>
+                </div>
+              </>
+            ) : null}
+          </div>
+
+          <div className='B2lTit'>藏品详情</div>
+
+          <div className='B2lGood'>
+            <Tab1info info={info} auto />
+          </div>
+
+          <div className='B2lTit'>申请流程</div>
+
+          {/* 待完善 */}
+          <MyTable
+            list={[
+              { id: 1, name: '11' },
+              { id: 2, name: '22' },
+              { id: 3, name: '33' },
+              { id: 4, name: '44' },
+              { id: 5, name: '55' }
+            ]}
+            columnsTemp={[
+              ['txt', '节点名称', 'name'],
+              ['txt', '提交日期', 'name'],
+              ['txt', '处理人', 'name'],
+              ['txt', '审批结果', 'name'],
+              ['text', '审批意见', 'xxxxx', 100]
+            ]}
+            pagingInfo={false}
+            widthSet={{ xxxxx: 800 }}
+          />
+        </>
+      ) : null}
     </div>
   )
 }

+ 21 - 0
后台管理/src/pages/B2register/data.ts

@@ -0,0 +1,21 @@
+export type B2fromDataType = {
+  num: string
+  snapNum: string
+  snapName: string
+  startTime: string
+  endTime: string
+  status: null | string
+  pageNum: number
+  pageSize: number
+}
+
+export const B2fromDataBase: B2fromDataType = {
+  num: '',
+  snapNum: '',
+  snapName: '',
+  startTime: '',
+  endTime: '',
+  status: null,
+  pageNum: 1,
+  pageSize: 10
+}

+ 14 - 0
后台管理/src/pages/B2register/index.module.scss

@@ -1,4 +1,18 @@
 .B2register {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 20px;
   :global {
+    .B2top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      .B2topll {
+        display: flex;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 180 - 1
后台管理/src/pages/B2register/index.tsx

@@ -1,9 +1,188 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { B2fromDataBase } from './data'
+import { B2_APIgetlist } from '@/store/action/B2register'
+import { RootState } from '@/store'
+import { B1listType } from '../B1ledger/data'
+import { Button, DatePicker, Input, Select } from 'antd'
+import history from '@/utils/history'
+import { statusSelect } from '@/utils/select'
+import MyTable from '@/components/MyTable'
+import { B2tableC } from '@/utils/tableData'
+import { B2devFu } from '@/utils/deriveFu'
+import A0addGoods from '../A0addGoods'
+
+const { RangePicker } = DatePicker
+
 function B2register() {
+  const dispatch = useDispatch()
+  const [formData, setFormData] = useState({ ...B2fromDataBase, type: 'DJ' })
+
+  const getListFu = useCallback(() => {
+    dispatch(B2_APIgetlist(formData))
+  }, [dispatch, formData])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  // 输入框改变
+  const timeRef = useRef(-1)
+  const txtChangeFu = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'num' | 'snapNum' | 'snapName') => {
+      clearTimeout(timeRef.current)
+      timeRef.current = window.setTimeout(() => {
+        setFormData({
+          ...formData,
+          [key]: e.target.value,
+          pageNum: 1
+        })
+      }, 500)
+    },
+    [formData]
+  )
+
+  // 时间选择器改变
+  const timeChange = useCallback(
+    (date: any, dateString: any) => {
+      let startTime = ''
+      let endTime = ''
+      if (dateString[0] && dateString[1]) {
+        startTime = dateString[0] + ' 00:00:00'
+        endTime = dateString[1] + ' 23:59:59'
+      }
+      setFormData({ ...formData, startTime, endTime, pageNum: 1 })
+    },
+    [formData]
+  )
+
+  // 点击重置
+  const [inputKey, setInputKey] = useState(1)
+  const resetSelectFu = useCallback(() => {
+    // 把2个输入框和时间选择器清空
+    setInputKey(Date.now())
+    setFormData({ ...B2fromDataBase, type: 'DJ' })
+  }, [])
+
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.B2register.tableInfo)
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: B1listType) => {
+          return (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => history.push(`/register_look/1/${item.id}`)}
+              >
+                查看
+              </Button>
+
+              {/* 待完善 下面2个按钮权限 */}
+              <Button
+                size='small'
+                type='text'
+                onClick={() => history.push(`/register_look/2/${item.id}`)}
+              >
+                审批
+              </Button>
+              <Button size='small' type='text' onClick={() => setEditId(item.id)}>
+                重新提交
+              </Button>
+            </>
+          )
+        }
+      }
+    ]
+  }, [])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+    },
+    [formData]
+  )
+
+  // 点击重新提交
+  const [editId, setEditId] = useState(0)
+
   return (
     <div className={styles.B2register}>
       <div className='pageTitle'>藏品登记</div>
+
+      <div className='B2top'>
+        <div className='B2topll' key={inputKey}>
+          <Input
+            placeholder='申请编号'
+            maxLength={30}
+            showCount
+            allowClear
+            onChange={e => txtChangeFu(e, 'num')}
+            style={{ width: 200 }}
+          />
+          &emsp;
+          <Input
+            placeholder='藏品编号'
+            maxLength={30}
+            showCount
+            allowClear
+            onChange={e => txtChangeFu(e, 'snapNum')}
+            style={{ width: 200 }}
+          />
+          &emsp;
+          <Input
+            placeholder='藏品名称'
+            maxLength={30}
+            showCount
+            allowClear
+            onChange={e => txtChangeFu(e, 'snapName')}
+            style={{ width: 200 }}
+          />
+          &emsp;
+          <RangePicker
+            placeholder={['发起日期起', '发起日期终']}
+            style={{ width: 240 }}
+            onChange={timeChange}
+          />
+          &emsp;
+          <Select
+            allowClear
+            style={{ width: 200 }}
+            placeholder='类型'
+            options={statusSelect}
+            value={formData.status}
+            onChange={e => setFormData({ ...formData, status: e })}
+          />
+          &emsp;
+        </div>
+        <div className='B2toprr'>
+          <Button onClick={resetSelectFu}>重置</Button>&emsp;
+          <Button type='primary' onClick={() => B2devFu(formData)}>
+            数据导出
+          </Button>
+        </div>
+      </div>
+
+      {/* 表格 */}
+      <MyTable
+        yHeight={655}
+        list={tableInfo.list}
+        columnsTemp={B2tableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
+
+      {/* 点击重新提交*/}
+      {editId ? <A0addGoods sId={editId} closeFu={() => setEditId(0)} /> : null}
     </div>
   )
 }

+ 2 - 0
后台管理/src/pages/B3edit/index.tsx

@@ -1,9 +1,11 @@
 import React from 'react'
 import styles from './index.module.scss'
+import history from '@/utils/history'
 function B3edit() {
   return (
     <div className={styles.B3edit}>
       <div className='pageTitle'>藏品修改</div>
+      <div onClick={() => history.push('/register_look/1/4')}>1231</div>
     </div>
   )
 }

+ 42 - 0
后台管理/src/store/action/B2register.ts

@@ -0,0 +1,42 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 藏品登记-获取列表
+ */
+export const B2_APIgetlist = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/order/register/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/order/register/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'B2/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 藏品登记-重新提交
+ */
+export const B2_APIresubmit = (orderId: number, data: any) => {
+  return http.post(`cms/order/register/edit/${orderId}`, data)
+}
+
+/**
+ * 藏品登记-获取详情
+ */
+export const B2_APIgetInfo = (id: number) => {
+  return http.get(`cms/order/register/detail/${id}`)
+}
+
+/**
+ * 藏品登记-审批
+ */
+export const B2_APIaduit = (data: any) => {
+  return http.post('cms/order/register/audit', data)
+}

+ 28 - 0
后台管理/src/store/reducer/B2register.ts

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

+ 2 - 0
后台管理/src/store/reducer/index.ts

@@ -4,6 +4,7 @@ import { combineReducers } from 'redux'
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
 import B1ledger from './B1ledger'
+import B2register from './B2register'
 
 import D1dict from './D1dict'
 import D2approval from './D2approval'
@@ -15,6 +16,7 @@ import Z2log from './Z2log'
 const rootReducer = combineReducers({
   A0Layout,
   B1ledger,
+  B2register,
   D1dict,
   D2approval,
   D3role,

+ 31 - 33
后台管理/src/store/reducer/layout.ts

@@ -1,65 +1,63 @@
-import { LookDomType } from "@/types";
-import { MessageType } from "@/utils/message";
+import { LookDomType } from '@/types'
+import { MessageType } from '@/utils/message'
 
 // 初始化状态
 const initState = {
   // 所有图片点击预览查看大图
   lookBigImg: {
-    url: "",
-    show: false,
+    url: '',
+    show: false
   },
   // 查看视频、音频、模型
   lookDom: {
-    src: "",
-    type: "",
+    src: '',
+    type: ''
   } as LookDomType,
 
   // antd轻提示(兼容360浏览器)
   message: {
-    txt: "",
-    type: "info",
-    duration: 3,
+    txt: '',
+    type: 'info',
+    duration: 3
   } as MessageType,
   // 上传文件点击取消
   closeUpFile: {
     fu: () => {},
-    state: false,
-  },
-};
+    state: false
+  }
+}
 
 // 定义 action 类型
 type LayoutActionType =
-  | { type: "layout/lookBigImg"; payload: { url: string; show: boolean } }
-  | { type: "layout/lookDom"; payload: LookDomType }
-  | { type: "layout/message"; payload: MessageType }
+  | { type: 'layout/lookBigImg'; payload: { url: string; show: boolean } }
+  | { type: 'layout/lookDom'; payload: LookDomType }
+  | { type: 'layout/message'; payload: MessageType }
   | {
-      type: "layout/closeUpFile";
+      type: 'layout/closeUpFile'
       payload: {
-        fu: () => void;
-        state: boolean;
-      };
-    };
+        fu: () => void
+        state: boolean
+      }
+    }
 
 // 频道 reducer
-export default function layoutReducer(
-  state = initState,
-  action: LayoutActionType
-) {
+export default function layoutReducer(state = initState, action: LayoutActionType) {
   switch (action.type) {
     // 所有图片点击预览查看大图
-    case "layout/lookBigImg":
-      return { ...state, lookBigImg: action.payload };
+    case 'layout/lookBigImg':
+      return { ...state, lookBigImg: action.payload }
     // 查看视频
-    case "layout/lookDom":
-      return { ...state, lookDom: action.payload };
+    case 'layout/lookDom':
+      return { ...state, lookDom: action.payload }
 
     // antd轻提示(兼容360浏览器)
-    case "layout/message":
-      return { ...state, message: action.payload };
+    case 'layout/message':
+      return { ...state, message: action.payload }
     // 上传文件点击取消
-    case "layout/closeUpFile":
-      return { ...state, closeUpFile: action.payload };
+    case 'layout/closeUpFile':
+      return { ...state, closeUpFile: action.payload }
+
     default:
-      return state;
+      return state
   }
 }

+ 29 - 3
后台管理/src/utils/deriveFu.ts

@@ -3,7 +3,8 @@ import ExportJsonExcel from 'js-export-excel'
 import { B1_APIgetlist } from '@/store/action/B1ledger'
 import { MessageFu } from './message'
 import dayjs from 'dayjs'
-import { dictSelect } from './select'
+import { dictSelect, statusSelect } from './select'
+import { B2_APIgetlist } from '@/store/action/B2register'
 
 // 入口
 const devDownFu = (
@@ -79,14 +80,15 @@ export const sizeChange = (val1?: number, val2?: number, val3?: number, val4?: s
 }
 
 const dataChange = (key: string, val: any, val2?: any) => {
-  if (['inHouseTime', 'registerTime'].includes(key)) return timeChange(val)
+  if (['inHouseTime', 'registerTime', 'createTime'].includes(key)) return timeChange(val)
   else if (['typeDictId'].includes(key)) return selectChange(dictSelect('藏品类型'), val)
   else if (['textureDictId'].includes(key)) return selectChange(dictSelect('藏品材质'), val)
   else if (['pcs'].includes(key)) return pcsPingFu(dictSelect('数量单位'), val, val2)
+  else if (['status'].includes(key)) return selectChange(statusSelect, val)
   else return val
 }
 
-// ------------------藏品登记
+// ------------------藏品总账
 export const B1devFu = async (formData: any) => {
   const res = await B1_APIgetlist({ ...formData, pageNum: 1, pageSize: 99999 }, true)
   if (res.code === 0) {
@@ -137,3 +139,27 @@ export const B1devFu = async (formData: any) => {
     devDownFu(data, '藏品总账', arr1, arr2)
   }
 }
+
+// ------------------藏品登记
+export const B2devFu = async (formData: any) => {
+  const res = await B2_APIgetlist({ ...formData, pageNum: 1, pageSize: 99999 }, true)
+  if (res.code === 0) {
+    let data: any[] = res.data.records || []
+
+    if (data.length <= 0) return MessageFu.warning('当前搜索条件没有数据')
+
+    const arr1 = ['num', 'snapNum', 'snapName', 'creatorName', 'createTime', 'status']
+
+    const arr2 = ['申请编号', '藏品编号', '藏品名称', '发起人', '发起日期', '申请状态']
+
+    data.forEach(v => {
+      arr1.forEach(c => {
+        if (v[c]) {
+          v[c] = dataChange(c, v[c])
+        } else v[c] = '(空)'
+      })
+    })
+
+    devDownFu(data, '藏品登记', arr1, arr2)
+  }
+}

+ 16 - 0
后台管理/src/utils/history.ts

@@ -8,3 +8,19 @@ export const openLink = (path: string) => {
   const qian = urlAll.split('/#/')[0]
   window.open(`${qian}/#${path}`, '_blank')
 }
+
+// 监听路由
+let routerLength = 0
+history.listen((_: any, listener: any) => {
+  if (listener === 'PUSH') {
+    routerLength += 1
+  } else if (listener === 'POP') {
+    if (routerLength >= 1) routerLength -= 1
+  }
+})
+
+// 点击返回
+export const backPageFu = (path: string) => {
+  if (routerLength) history.go(-1)
+  else history.push(path)
+}

+ 7 - 0
后台管理/src/utils/select.ts

@@ -46,3 +46,10 @@ export const sizeSelect = [
   { value: 'cm', label: 'cm' },
   { value: 'm', label: 'm' }
 ]
+
+// 申请状态
+export const statusSelect = [
+  { value: 1, label: '待审批' },
+  { value: 2, label: '审批不通过' },
+  { value: 3, label: '已完成' }
+]

+ 10 - 1
后台管理/src/utils/tableData.ts

@@ -14,7 +14,7 @@
 //     ["text", "创建日期",'description', 50,A],
 //   ];
 
-import { dictSelect } from './select'
+import { dictSelect, statusSelect } from './select'
 
 export const B1tableC = [
   ['txt', '藏品编号', 'num'],
@@ -31,6 +31,15 @@ export const B1tableC = [
   ['txt', '有无说明牌', 'isNote']
 ]
 
+export const B2tableC = [
+  ['txt', '申请编号', 'num'],
+  ['txt', '藏品编号', 'snapNum'],
+  ['txt', '藏品名称', 'snapName'],
+  ['txt', '发起人', 'creatorName'],
+  ['time', '发起日期', 'createTime'],
+  ['select', '申请状态', 'status', statusSelect]
+]
+
 export const D2tableC = [
   ['txt', '流程名称', 'name'],
   ['text', '流程说明', 'remark', '100'],