Browse Source

藏品详情按钮权限

shaogen1995 3 months ago
parent
commit
5745078850
2 changed files with 27 additions and 15 deletions
  1. 3 0
      src/pages/A3_ledger/C1ledger/type.d.ts
  2. 24 15
      src/pages/Y_goodsDetails/Y2look/index.tsx

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

@@ -136,4 +136,7 @@ export type C1GoodType = {
 
 
   // 详情按钮的盘点
   // 详情按钮的盘点
   statusCollect: number
   statusCollect: number
+
+  // 是否在编辑状态isEdit
+  isEdit: 0 | 1
 }
 }

+ 24 - 15
src/pages/Y_goodsDetails/Y2look/index.tsx

@@ -16,6 +16,7 @@ import { C3_APIfocus, C3_APIfocusNo } from '@/store/action/C3focus'
 import { MessageFu } from '@/utils/message'
 import { MessageFu } from '@/utils/message'
 import C22revamp from '@/pages/C_goodsManage/C22goodEdit/C22revamp'
 import C22revamp from '@/pages/C_goodsManage/C22goodEdit/C22revamp'
 import history from '@/utils/history'
 import history from '@/utils/history'
+import { statusStorageObj } from '@/utils/tableData'
 
 
 function Y2look() {
 function Y2look() {
   const { id: sId } = useParams<any>()
   const { id: sId } = useParams<any>()
@@ -53,8 +54,13 @@ function Y2look() {
       {
       {
         key: '1',
         key: '1',
         label: (
         label: (
-          // 待完善 过滤
-          <span className='Y2xia' onClick={() => setIsEdit(true)}>
+          <span
+            className='Y2xia'
+            onClick={() => {
+              if (info.isEdit === 1) MessageFu.warning('该藏品修改审核中,无法重复修改')
+              else setIsEdit(true)
+            }}
+          >
             编辑
             编辑
           </span>
           </span>
         )
         )
@@ -66,9 +72,7 @@ function Y2look() {
             style={{ color: '#ff4d4d' }}
             style={{ color: '#ff4d4d' }}
             className='Y2xia'
             className='Y2xia'
             onClick={() => {
             onClick={() => {
-              if ([2, 3, 4].includes(info.statusCollect)) {
-                history.push(`/cancel_edit/1/null?id=${sId}`)
-              } else MessageFu.warning('待完善')
+              history.push(`/cancel_edit/1/null?id=${sId}`)
             }}
             }}
           >
           >
             注销
             注销
@@ -78,7 +82,7 @@ function Y2look() {
     ]
     ]
 
 
     return arr
     return arr
-  }, [info.statusCollect, sId])
+  }, [info.isEdit, sId])
 
 
   const items2 = useMemo(() => {
   const items2 = useMemo(() => {
     let arr: MenuProps['items'] = [
     let arr: MenuProps['items'] = [
@@ -88,9 +92,12 @@ function Y2look() {
           <span
           <span
             className='Y2xia'
             className='Y2xia'
             onClick={() => {
             onClick={() => {
-              if (1 + 1 === 2) {
+              if (!info.statusStorage || info.statusStorage === 4) {
                 history.push(`/impStor_edit/1/null?id=${sId}`)
                 history.push(`/impStor_edit/1/null?id=${sId}`)
-              } else MessageFu.warning('待完善')
+              } else {
+                const txt = statusStorageObj[info.statusStorage]
+                MessageFu.warning(`该藏品${txt},无法入库`)
+              }
             }}
             }}
           >
           >
             入库
             入库
@@ -103,9 +110,10 @@ function Y2look() {
           <span
           <span
             className='Y2xia'
             className='Y2xia'
             onClick={() => {
             onClick={() => {
-              if (1 + 1 === 2) {
-                history.push(`/moveStor_edit/1/null?id=${sId}`)
-              } else MessageFu.warning('待完善')
+              let txt = statusStorageObj[info.statusStorage] || ''
+              const txtRes = txt ? `该藏品${txt},` : ''
+              if (info.statusStorage === 2) history.push(`/moveStor_edit/1/null?id=${sId}`)
+              else MessageFu.warning(txtRes + `只有已入库的藏品才能移库`)
             }}
             }}
           >
           >
             移库
             移库
@@ -118,9 +126,10 @@ function Y2look() {
           <span
           <span
             className='Y2xia'
             className='Y2xia'
             onClick={() => {
             onClick={() => {
-              if (1 + 1 === 2) {
-                history.push(`/putsStor_edit/1/null?id=${sId}`)
-              } else MessageFu.warning('待完善')
+              let txt = statusStorageObj[info.statusStorage] || ''
+              const txtRes = txt ? `该藏品${txt},` : ''
+              if (info.statusStorage === 2) history.push(`/putsStor_edit/1/null?id=${sId}`)
+              else MessageFu.warning(txtRes + `只有已入库的藏品才能出库`)
             }}
             }}
           >
           >
             出库
             出库
@@ -129,7 +138,7 @@ function Y2look() {
       }
       }
     ]
     ]
     return arr
     return arr
-  }, [sId])
+  }, [info.statusStorage, sId])
 
 
   const items3 = useMemo(() => {
   const items3 = useMemo(() => {
     let arr: MenuProps['items'] = [
     let arr: MenuProps['items'] = [