shaogen1995 1 mēnesi atpakaļ
vecāks
revīzija
76ef05fa6e

+ 7 - 1
后台管理/src/pages/A0goodsInfo/Tab2log/index.tsx

@@ -7,6 +7,8 @@ import { goodsLogTableC } from '@/utils/tableData'
 import { Button } from 'antd'
 import tabLeftArr from '@/pages/Layout/data'
 import { openLink } from '@/utils/history'
+import { authorityFu } from '@/utils/authority'
+import { MessageFu } from '@/utils/message'
 
 type Props = {
   sId: number
@@ -63,7 +65,11 @@ function Tab2log({ sId }: Props) {
               type='text'
               onClick={() => {
                 const obj = dataChange(item)
-                if (obj) openLink(`${obj.path}_look/1/${item.id}`)
+                if (obj) {
+                  authorityFu(obj.id, `您没有${obj.name}页面权限`, () => {
+                    openLink(`${obj.path}_look/1/${item.id}`)
+                  })
+                } else MessageFu.warning(`type字段:${item.type} 错误`)
               }}
             >
               查看

+ 16 - 11
后台管理/src/pages/A0goodsInfo/index.tsx

@@ -12,6 +12,7 @@ import { MessageFu } from '@/utils/message'
 import A0addGoods from '../A0addGoods'
 import history from '@/utils/history'
 import { B4_APIcreate } from '@/store/action/B4delete'
+import { authorityFu } from '@/utils/authority'
 const topBtnArr = ['藏品信息', '编辑记录', '库存状态']
 
 function A0goodsInfo() {
@@ -45,8 +46,10 @@ function A0goodsInfo() {
           <span
             className='AIdroRow'
             onClick={() => {
-              if (goodsInfo.status === 2) MessageFu.warning('该藏品修改审核中,无法重复修改')
-              else setIsEdit(true)
+              authorityFu(500, '您没有藏品修改页面权限', () => {
+                if (goodsInfo.status === 2) MessageFu.warning('该藏品修改审核中,无法重复修改')
+                else setIsEdit(true)
+              })
             }}
           >
             修改
@@ -59,16 +62,18 @@ function A0goodsInfo() {
           <span
             className='AIdroRow'
             style={{ color: '#ff4d4d' }}
-            onClick={async () => {
-              if (goodsInfo.status === 3) MessageFu.warning('该藏品删除审核中,无法重复删除')
-              else if (goodsInfo.status === 2) MessageFu.warning('该藏品修改审核中,无法删除')
-              else {
-                // 创建订单
-                const res = await B4_APIcreate(goodsInfo)
-                if (res.code === 0) {
-                  history.push(`/delete_look/1/${res.data.id}`)
+            onClick={() => {
+              authorityFu(600, '您没有藏品删除页面权限', async () => {
+                if (goodsInfo.status === 3) MessageFu.warning('该藏品删除审核中,无法重复删除')
+                else if (goodsInfo.status === 2) MessageFu.warning('该藏品修改审核中,无法删除')
+                else {
+                  // 创建订单
+                  const res = await B4_APIcreate(goodsInfo)
+                  if (res.code === 0) {
+                    history.push(`/delete_look/1/${res.data.id}`)
+                  }
                 }
-              }
+              })
             }}
           >
             删除

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

@@ -14,7 +14,6 @@ import { openLink } from '@/utils/history'
 import { authorityFu } from '@/utils/authority'
 
 function B1ledger() {
-  // 待完善 表格/导出 入库时间 出库时间 当前位置相关
   const dispatch = useDispatch()
   const [formData, setFormData] = useState(B1fromDataBase)
 

+ 0 - 13
后台管理/src/pages/C1storage/index.tsx

@@ -1,13 +0,0 @@
-import React from 'react'
-import styles from './index.module.scss'
-function C1storage() {
-  return (
-    <div className={styles.C1storage}>
-      <div className='pageTitle'>库房管理</div>
-    </div>
-  )
-}
-
-const MemoC1storage = React.memo(C1storage)
-
-export default MemoC1storage

+ 24 - 0
后台管理/src/pages/C1storageSet/data.ts

@@ -0,0 +1,24 @@
+export type C1fromDataType = {
+  siteLoc: string
+  num: string
+  name: string
+  siteStatus: null | number
+  pageNum: number
+  pageSize: number
+}
+
+export const C1fromDataBase: C1fromDataType = {
+  siteLoc: '',
+  num: '',
+  name: '',
+  siteStatus: null,
+  pageNum: 1,
+  pageSize: 10
+}
+
+// 入库移库出库
+export const C1btnArr = [
+  { name: '入库', id: 800, path: '/storageIn_look/1/0' },
+  { name: '移库', id: 900, path: '/storageMove_look/1/0' },
+  { name: '出库', id: 1000, path: '/storageOut_look/1/0' }
+]

+ 23 - 0
后台管理/src/pages/C1storageSet/index.module.scss

@@ -0,0 +1,23 @@
+.C1storageSet {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 20px;
+  :global {
+    .C1top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      .C1topll {
+        display: flex;
+      }
+      .C1toprr {
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
+  }
+}

+ 159 - 0
后台管理/src/pages/C1storageSet/index.tsx

@@ -0,0 +1,159 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { C1btnArr, C1fromDataBase } from './data'
+import { C1_APIgetlist } from '@/store/action/C1storageSet'
+import { RootState } from '@/store'
+import { B1listType } from '../B1ledger/data'
+import { Button, Input, Select } from 'antd'
+import history, { openLink } from '@/utils/history'
+import { storageSelect } from '@/utils/select'
+import MyTable from '@/components/MyTable'
+import { C1tableC } from '@/utils/tableData'
+import { B3devFu } from '@/utils/deriveFu'
+import { authorityFu } from '@/utils/authority'
+function C1storageSet() {
+  const dispatch = useDispatch()
+  const [formData, setFormData] = useState(C1fromDataBase)
+
+  const getListFu = useCallback(() => {
+    dispatch(C1_APIgetlist(formData))
+  }, [dispatch, formData])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  // 输入框改变
+  const timeRef = useRef(-1)
+  const txtChangeFu = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'siteLoc' | 'num' | 'name') => {
+      clearTimeout(timeRef.current)
+      timeRef.current = window.setTimeout(() => {
+        setFormData({
+          ...formData,
+          [key]: e.target.value,
+          pageNum: 1
+        })
+      }, 500)
+    },
+    [formData]
+  )
+
+  // 点击重置
+  const [inputKey, setInputKey] = useState(1)
+  const resetSelectFu = useCallback(() => {
+    // 把2个输入框和时间选择器清空
+    setInputKey(Date.now())
+    setFormData(C1fromDataBase)
+  }, [])
+
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.C1storageSet.tableInfo)
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: B1listType) => {
+          return (
+            <Button size='small' type='text' onClick={() => openLink(`/goodsLook/${item.id}`)}>
+              查看
+            </Button>
+          )
+        }
+      }
+    ]
+  }, [])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+    },
+    [formData]
+  )
+
+  return (
+    <div className={styles.C1storageSet}>
+      <div className='pageTitle'>库房管理</div>
+
+      <div className='C1top'>
+        <div className='C1topll' key={inputKey}>
+          <Input
+            placeholder='库房位置'
+            maxLength={30}
+            showCount
+            allowClear
+            onChange={e => txtChangeFu(e, 'siteLoc')}
+            style={{ width: 200 }}
+          />
+          &emsp;
+          <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, 'name')}
+            style={{ width: 200 }}
+          />
+          &emsp;
+          <Select
+            allowClear
+            style={{ width: 200 }}
+            placeholder='库存状态'
+            options={storageSelect}
+            value={formData.siteStatus}
+            onChange={e => setFormData({ ...formData, siteStatus: e })}
+          />
+          &emsp;
+        </div>
+        <div className='C1toprr'>
+          {C1btnArr.map(v => (
+            <Button
+              key={v.id}
+              type='primary'
+              onClick={() =>
+                authorityFu(v.id, `您没有藏品${v.name}页面权限`, () => {
+                  history.push(v.path)
+                })
+              }
+            >
+              {v.name}
+            </Button>
+          ))}
+
+          <Button onClick={resetSelectFu}>重置</Button>
+          <Button type='primary' onClick={() => B3devFu(formData)}>
+            数据导出
+          </Button>
+        </div>
+      </div>
+
+      {/* 表格 */}
+      <MyTable
+        yHeight={655}
+        list={tableInfo.list}
+        columnsTemp={C1tableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
+    </div>
+  )
+}
+
+const MemoC1storageSet = React.memo(C1storageSet)
+
+export default MemoC1storageSet

+ 1 - 1
后台管理/src/pages/C1storage/index.module.scss

@@ -1,4 +1,4 @@
-.C1storage {
+.C2look {
   :global {
   }
 }

+ 13 - 0
后台管理/src/pages/C2storageIn/C2look/index.tsx

@@ -0,0 +1,13 @@
+import React from 'react'
+import styles from './index.module.scss'
+function C2look() {
+  return (
+    <div className={styles.C2look}>
+      <h1>C2look</h1>
+    </div>
+  )
+}
+
+const MemoC2look = React.memo(C2look)
+
+export default MemoC2look

+ 4 - 0
后台管理/src/pages/C3storageMove/C3look/index.module.scss

@@ -0,0 +1,4 @@
+.C3look {
+  :global {
+  }
+}

+ 13 - 0
后台管理/src/pages/C3storageMove/C3look/index.tsx

@@ -0,0 +1,13 @@
+import React from 'react'
+import styles from './index.module.scss'
+function C3look() {
+  return (
+    <div className={styles.C3look}>
+      <h1>C3look</h1>
+    </div>
+  )
+}
+
+const MemoC3look = React.memo(C3look)
+
+export default MemoC3look

+ 4 - 0
后台管理/src/pages/C4storageOut/C4look/index.module.scss

@@ -0,0 +1,4 @@
+.C4look {
+  :global {
+  }
+}

+ 13 - 0
后台管理/src/pages/C4storageOut/C4look/index.tsx

@@ -0,0 +1,13 @@
+import React from 'react'
+import styles from './index.module.scss'
+function C4look() {
+  return (
+    <div className={styles.C4look}>
+      <h1>C4look</h1>
+    </div>
+  )
+}
+
+const MemoC4look = React.memo(C4look)
+
+export default MemoC4look

+ 19 - 1
后台管理/src/pages/Layout/data.ts

@@ -63,7 +63,7 @@ const tabLeftArr: RouterType = [
         id: 700,
         name: '库房管理',
         path: '/storageSet',
-        Com: React.lazy(() => import('../C1storage'))
+        Com: React.lazy(() => import('../C1storageSet'))
       },
       {
         id: 800,
@@ -154,5 +154,23 @@ export const routerSon: RouterTypeRow = [
     name: '藏品删除-查看',
     path: '/delete_look/:key/:id',
     Com: React.lazy(() => import('../B4delete/B4look'))
+  },
+  {
+    id: 800,
+    name: '藏品入库-查看',
+    path: '/storageIn_look/:key/:id',
+    Com: React.lazy(() => import('../C2storageIn/C2look'))
+  },
+  {
+    id: 900,
+    name: '藏品移库-查看',
+    path: '/storageMove_look/:key/:id',
+    Com: React.lazy(() => import('../C3storageMove/C3look'))
+  },
+  {
+    id: 1000,
+    name: '藏品出库-查看',
+    path: '/storageOut_look/:key/:id',
+    Com: React.lazy(() => import('../C4storageOut/C4look'))
   }
 ]

+ 21 - 0
后台管理/src/store/action/C1storageSet.ts

@@ -0,0 +1,21 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 库房管理-获取列表
+ */
+export const C1_APIgetlist = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/orderSite/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/orderSite/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'C1/getList', payload: obj })
+      }
+    }
+  }
+}

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

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

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

@@ -7,6 +7,7 @@ import B1ledger from './B1ledger'
 import B2register from './B2register'
 import B3edit from './B3edit'
 import B4delete from './B4delete'
+import C1storageSet from './C1storageSet'
 
 import D1dict from './D1dict'
 import D2approval from './D2approval'
@@ -21,6 +22,7 @@ const rootReducer = combineReducers({
   B2register,
   B3edit,
   B4delete,
+  C1storageSet,
   D1dict,
   D2approval,
   D3role,

+ 65 - 10
后台管理/src/utils/deriveFu.ts

@@ -3,10 +3,11 @@ import ExportJsonExcel from 'js-export-excel'
 import { B1_APIgetlist } from '@/store/action/B1ledger'
 import { MessageFu } from './message'
 import dayjs from 'dayjs'
-import { dictSelect, statusSelect } from './select'
+import { dictSelect, goodsSelect, statusSelect, storageSelect } from './select'
 import { B2_APIgetlist } from '@/store/action/B2register'
 import { B3_APIgetlist } from '@/store/action/B3edit'
 import { B4_APIgetlist } from '@/store/action/B4delete'
+import { C1_APIgetlist } from '@/store/action/C1storageSet'
 
 // 入口
 const devDownFu = (
@@ -42,7 +43,7 @@ export const timeChange = (val?: string) => {
 // 下拉框处理
 export const selectChange = (data: any[], val?: number) => {
   let txt = '(空)'
-  if (val) {
+  if (val || val === 0) {
     const obj = data.find(v => v.value === val)
     if (obj) txt = obj.label
   }
@@ -82,11 +83,13 @@ export const sizeChange = (val1?: number, val2?: number, val3?: number, val4?: s
 }
 
 const dataChange = (key: string, val: any, val2?: any) => {
-  if (['inHouseTime', 'registerTime', 'createTime'].includes(key)) return timeChange(val)
+  if (['inHouseTime', 'registerTime', 'createTime', 'siteDateIn', 'siteDateOut'].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 if (['siteStatus'].includes(key)) return selectChange(storageSelect, val)
   else return val
 }
 
@@ -103,13 +106,14 @@ export const B1devFu = async (formData: any) => {
       'name',
       'inHouseTime',
       'registerTime',
-      '待完善',
-      '待完善',
+      'siteDateIn',
+      'siteDateOut',
       'typeDictId',
       'textureDictId',
-      '待完善',
+      'siteLoc',
       'pcs',
-      'isNote'
+      'isNote',
+      'status'
     ]
 
     const arr2 = [
@@ -123,7 +127,8 @@ export const B1devFu = async (formData: any) => {
       '材质',
       '当前位置',
       '数量',
-      '有无说明牌'
+      '有无说明牌',
+      '状态'
     ]
 
     data.forEach(v => {
@@ -133,7 +138,9 @@ export const B1devFu = async (formData: any) => {
         if (v[c]) {
           if (c === 'pcs') val2 = v.pcsUnitDictId
           else val2 = undefined
-          v[c] = dataChange(c, v[c], val2)
+
+          if (c === 'status') v[c] = selectChange(goodsSelect, v[c])
+          else v[c] = dataChange(c, v[c], val2)
         } else v[c] = '(空)'
       })
     })
@@ -142,7 +149,7 @@ export const B1devFu = async (formData: any) => {
   }
 }
 
-// ------------------藏品登记
+// ------------------藏品登记' | '藏品修改' | '藏品删除
 export const B2devFu = async (formData: any, txtKey: '藏品登记' | '藏品修改' | '藏品删除') => {
   const obj = { ...formData, pageNum: 1, pageSize: 99999 }
 
@@ -173,3 +180,51 @@ export const B2devFu = async (formData: any, txtKey: '藏品登记' | '藏品修
     devDownFu(data, txtKey, arr1, arr2)
   }
 }
+
+// ------------------库房管理
+export const B3devFu = async (formData: any) => {
+  const res = await C1_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 = [
+      'siteLoc',
+      'num',
+      'name',
+      'siteStatus',
+      'siteDateIn',
+      'siteDateOut',
+      'typeDictId',
+      'textureDictId',
+      'pcs'
+    ]
+
+    const arr2 = [
+      '库房位置',
+      '藏品编号',
+      '藏品名称',
+      '库存状态',
+      '入库时间',
+      '出库时间',
+      '类型',
+      '材质',
+      '数量'
+    ]
+
+    data.forEach(v => {
+      let val2: any = undefined
+
+      arr1.forEach(c => {
+        if (v[c] || v[c] === 0) {
+          if (c === 'pcs') val2 = v.pcsUnitDictId
+          else val2 = undefined
+          v[c] = dataChange(c, v[c], val2)
+        } else v[c] = '(空)'
+      })
+    })
+
+    devDownFu(data, '库房管理', arr1, arr2)
+  }
+}

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

@@ -60,3 +60,13 @@ export const goodsSelect = [
   { value: 2, label: '修改中' },
   { value: 3, label: '删除中' }
 ]
+
+// 库存状态
+export const storageSelect = [
+  { value: 0, label: '待入库' },
+  { value: 1, label: '入库中' },
+  { value: 2, label: '已入库' },
+  { value: 3, label: '移库中' },
+  { value: 4, label: '出库中' },
+  { value: 5, label: '已出库' }
+]

+ 17 - 4
后台管理/src/utils/tableData.ts

@@ -14,7 +14,7 @@
 //     ["text", "创建日期",'description', 50,A],
 //   ];
 
-import { dictSelect, goodsSelect, statusSelect } from './select'
+import { dictSelect, goodsSelect, statusSelect, storageSelect } from './select'
 
 export const auditTableC = [
   ['txt', '节点名称', 'nodeName'],
@@ -36,11 +36,11 @@ export const B1tableC = [
   ['img', '封面图', 'thumb'],
   ['time', '入馆时间', 'inHouseTime'],
   ['time', '登记时间', 'registerTime'],
-  ['time', '入库时间', '待完善'],
-  ['time', '出库时间', '待完善'],
+  ['time', '入库时间', 'siteDateIn'],
+  ['time', '出库时间', 'siteDateOut'],
   ['select', '类型', 'typeDictId', dictSelect('藏品类型')],
   ['select', '材质', 'textureDictId', dictSelect('藏品材质')],
-  ['txt', '当前位置', '待完善'],
+  ['txt', '当前位置', 'siteLoc'],
   ['ping', '数量', 'pcs', 'pcsUnitDictId', dictSelect('数量单位')],
   ['txt', '有无说明牌', 'isNote'],
   ['select', '状态', 'status', goodsSelect]
@@ -55,6 +55,19 @@ export const B2tableC = [
   ['select', '申请状态', 'status', statusSelect]
 ]
 
+export const C1tableC = [
+  ['txt', '库房位置', 'siteLoc'],
+  ['txt', '藏品编号', 'num'],
+  ['txt', '藏品名称', 'name'],
+  ['img', '封面图', 'thumb'],
+  ['select', '库存状态', 'siteStatus', storageSelect],
+  ['time', '入库时间', 'siteDateIn'],
+  ['time', '出库时间', 'siteDateOut'],
+  ['select', '类型', 'typeDictId', dictSelect('藏品类型')],
+  ['select', '材质', 'textureDictId', dictSelect('藏品材质')],
+  ['ping', '数量', 'pcs', 'pcsUnitDictId', dictSelect('数量单位')]
+]
+
 export const D2tableC = [
   ['txt', '流程名称', 'name'],
   ['text', '流程说明', 'remark', '100'],