shaogen1995 5 dni temu
rodzic
commit
9c68bf5a50

+ 9 - 22
src/pages/Cledger/C1ledger/index.tsx

@@ -151,66 +151,53 @@ function C1ledger() {
         {
           key: '1',
           label: '登记',
-          onClick: () =>
-            authorityFu(410, '您没有藏品登记权限!', () => history.push(`/register_edit/1/null`))
+          onClick: () => authorityFu(410, '藏品登记', () => history.push(`/register_edit/1/null`))
         },
         {
           key: '2',
           label: '注销',
-          onClick: () =>
-            authorityFu(430, '您没有藏品注销权限!', () => history.push(`/writeOff_edit/1/null`))
+          onClick: () => authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null`))
         }
       ],
       kufang: [
         {
           key: '1',
           label: '入库',
-          onClick: () =>
-            authorityFu(1010, '您没有藏品入库权限!', () => history.push(`/inStorage_edit/1/null`))
+          onClick: () => authorityFu(1010, '藏品入库', () => history.push(`/inStorage_edit/1/null`))
         },
         {
           key: '2',
           label: '移库',
           onClick: () =>
-            authorityFu(1020, '您没有藏品移库权限!', () =>
-              history.push(`/moveStorage_edit/1/null`)
-            )
+            authorityFu(1020, '藏品移库', () => history.push(`/moveStorage_edit/1/null`))
         },
         {
           key: '3',
           label: '出库',
           onClick: () =>
-            authorityFu(1030, '您没有藏品出库权限!', () => history.push(`/outStorage_edit/1/null`))
+            authorityFu(1030, '藏品出库', () => history.push(`/outStorage_edit/1/null`))
         }
       ],
       weihu: [
         {
           key: '1',
           label: '鉴定登记',
-          onClick: () =>
-            authorityFu(230, '您没有藏品鉴定登记权限!', () => history.push(`/auth_edit/1/null`))
+          onClick: () => authorityFu(230, '藏品鉴定', () => history.push(`/auth_edit/1/null`))
         },
         {
           key: '2',
           label: '事故登记',
-          onClick: () =>
-            authorityFu(510, '您没有藏品事故登记权限!', () =>
-              history.push(`/accident_edit/1/null`)
-            )
+          onClick: () => authorityFu(510, '事故登记', () => history.push(`/accident_edit/1/null`))
         },
         {
           key: '3',
           label: '现状登记',
-          onClick: () =>
-            authorityFu(540, '您没有藏品现状登记权限!', () =>
-              history.push(`/actuality_edit/1/null`)
-            )
+          onClick: () => authorityFu(540, '现状登记', () => history.push(`/actuality_edit/1/null`))
         },
         {
           key: '4',
           label: '修复登记',
-          onClick: () =>
-            authorityFu(550, '您没有藏品修复登记权限!', () => history.push(`/repair_edit/1/null`))
+          onClick: () => authorityFu(550, '修复登记', () => history.push(`/repair_edit/1/null`))
         }
       ]
     }

+ 4 - 0
src/pages/ZgoodsInfo/GItab1/index.module.scss

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

+ 53 - 0
src/pages/ZgoodsInfo/GItab1/index.tsx

@@ -0,0 +1,53 @@
+import React, { useEffect } from 'react'
+import styles from './index.module.scss'
+import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+
+type Props = {
+  info: GoodsType
+}
+
+function GItab1({ info }: Props) {
+  useEffect(() => {
+    console.log('GItab1')
+  }, [])
+
+  return (
+    <div className={styles.GItab1}>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+      <h1>GItab1</h1>
+    </div>
+  )
+}
+
+const MemoGItab1 = React.memo(GItab1)
+
+export default MemoGItab1

+ 7 - 0
src/pages/ZgoodsInfo/GItab2/index.module.scss

@@ -0,0 +1,7 @@
+.GItab2 {
+  width: 100%;
+  height: 100%;
+  overflow-y: auto;
+  :global {
+  }
+}

+ 47 - 0
src/pages/ZgoodsInfo/GItab2/index.tsx

@@ -0,0 +1,47 @@
+import React, { useEffect } from 'react'
+import styles from './index.module.scss'
+function GItab2() {
+  useEffect(() => {
+    console.log('GItab2')
+  }, [])
+
+  return (
+    <div className={styles.GItab2}>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+      <h1>GItab2</h1>
+    </div>
+  )
+}
+
+const MemoGItab2 = React.memo(GItab2)
+
+export default MemoGItab2

+ 7 - 0
src/pages/ZgoodsInfo/GItab3/index.module.scss

@@ -0,0 +1,7 @@
+.GItab3 {
+  width: 100%;
+  height: 100%;
+  overflow-y: auto;
+  :global {
+  }
+}

+ 47 - 0
src/pages/ZgoodsInfo/GItab3/index.tsx

@@ -0,0 +1,47 @@
+import React, { useEffect } from 'react'
+import styles from './index.module.scss'
+function GItab3() {
+  useEffect(() => {
+    console.log('GItab3')
+  }, [])
+
+  return (
+    <div className={styles.GItab3}>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+      <h1>GItab3</h1>
+    </div>
+  )
+}
+
+const MemoGItab3 = React.memo(GItab3)
+
+export default MemoGItab3

+ 7 - 0
src/pages/ZgoodsInfo/GItab4/index.module.scss

@@ -0,0 +1,7 @@
+.GItab4 {
+  width: 100%;
+  height: 100%;
+  overflow-y: auto;
+  :global {
+  }
+}

+ 47 - 0
src/pages/ZgoodsInfo/GItab4/index.tsx

@@ -0,0 +1,47 @@
+import React, { useEffect } from 'react'
+import styles from './index.module.scss'
+function GItab4() {
+  useEffect(() => {
+    console.log('GItab4')
+  }, [])
+
+  return (
+    <div className={styles.GItab4}>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+      <h1>GItab4</h1>
+    </div>
+  )
+}
+
+const MemoGItab4 = React.memo(GItab4)
+
+export default MemoGItab4

+ 7 - 0
src/pages/ZgoodsInfo/GItab5/index.module.scss

@@ -0,0 +1,7 @@
+.GItab5 {
+  width: 100%;
+  height: 100%;
+  overflow-y: auto;
+  :global {
+  }
+}

+ 47 - 0
src/pages/ZgoodsInfo/GItab5/index.tsx

@@ -0,0 +1,47 @@
+import React, { useEffect } from 'react'
+import styles from './index.module.scss'
+function GItab5() {
+  useEffect(() => {
+    console.log('GItab5')
+  }, [])
+
+  return (
+    <div className={styles.GItab5}>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+      <h1>GItab5</h1>
+    </div>
+  )
+}
+
+const MemoGItab5 = React.memo(GItab5)
+
+export default MemoGItab5

+ 37 - 13
src/pages/ZgoodsInfo/index.module.scss

@@ -2,26 +2,25 @@
   padding: 15px;
   :global {
     .GITot {
-      display: flex;
-      align-items: center;
-      height: 32px;
+      width: 100%;
+      overflow-x: auto;
+      white-space: nowrap;
+      display: inline-block;
+      height: 52px;
       & > h2 {
+        display: inline-block;
         margin-right: 20px;
+        position: relative;
+        top: 3px;
       }
-      & > div {
-        width: calc(100% - 100px);
-        overflow: auto;
-        white-space: nowrap;
+      .ant-tag {
         display: inline-block;
-        .ant-tag {
-          line-height: 30px;
-          margin-right: 8px;
-          padding: 0 15px;
-        }
+        line-height: 30px;
+        margin-right: 8px;
+        padding: 0 15px;
       }
     }
     .GItab {
-      margin-top: 20px;
       display: flex;
       justify-content: space-between;
       border-bottom: 1px solid #ccc;
@@ -51,5 +50,30 @@
         }
       }
     }
+    .GImain {
+      margin-top: 10px;
+      width: 100%;
+      height: calc(100% - 110px);
+      & > div {
+        width: 100%;
+        height: 100%;
+
+        & > div {
+          width: 100%;
+          height: 100%;
+          overflow-y: auto;
+        }
+      }
+      .GImainNone {
+        width: 70%;
+        height: 70%;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-weight: 700;
+        font-size: 20px;
+        letter-spacing: 4px;
+      }
+    }
   }
 }

+ 74 - 52
src/pages/ZgoodsInfo/index.tsx

@@ -11,6 +11,11 @@ import classNames from 'classnames'
 import history from '@/utils/history'
 import { authorityFu } from '@/utils/authority'
 import { CaretDownOutlined } from '@ant-design/icons'
+import GItab1 from './GItab1'
+import GItab2 from './GItab2'
+import GItab3 from './GItab3'
+import GItab4 from './GItab4'
+import GItab5 from './GItab5'
 
 type tabArr1Type = {
   id: number
@@ -18,16 +23,9 @@ type tabArr1Type = {
   done: boolean
   show: boolean
   son?: any[]
+  Dom?: any
 }
 
-const tabArr1Temp: tabArr1Type[] = [
-  { id: 331, name: '藏品信息', done: false, show: false },
-  { id: 332, name: '库存信息', done: false, show: false },
-  { id: 333, name: '藏品附件', done: false, show: false },
-  { id: 334, name: '藏品故事', done: false, show: false },
-  { id: 335, name: '藏品日志', done: false, show: false }
-]
-
 function ZgoodsInfo() {
   const { id } = useParams<any>()
   // 获取藏品详情
@@ -42,7 +40,17 @@ function ZgoodsInfo() {
     getInfoFu()
   }, [getInfoFu])
 
-  // 待完善sg 一些状态待确定
+  const tabArr1Temp = useMemo(() => {
+    return [
+      { id: 331, name: '藏品信息', done: false, show: false, Dom: <GItab1 info={info} /> },
+      { id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
+      { id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
+      { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
+      { id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
+    ]
+  }, [info])
+
+  // 待完善sg 点击的时候校验前置状态,待确定
   const tabArr2Temp = useMemo(() => {
     return [
       {
@@ -55,23 +63,19 @@ function ZgoodsInfo() {
             key: '1',
             label: '修改',
             onClick: () =>
-              authorityFu(420, '您没有藏品修改权限!', () =>
-                history.push(`/edit_edit/1/null?gId=${id}`)
-              )
+              authorityFu(420, '藏品修改', () => history.push(`/edit_edit/1/null?gId=${id}`))
           },
           {
             key: '2',
             label: '注销',
             onClick: () =>
-              authorityFu(430, '您没有藏品注销权限!', () =>
-                history.push(`/writeOff_edit/1/null?gId=${id}`)
-              )
+              authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null?gId=${id}`))
           }
         ]
       },
       {
         id: 337,
-        name: '库存信息',
+        name: '库房管理',
         done: true,
         show: true,
         son: [
@@ -79,15 +83,13 @@ function ZgoodsInfo() {
             key: '1',
             label: '入库',
             onClick: () =>
-              authorityFu(1010, '您没有藏品入库权限!', () =>
-                history.push(`/inStorage_edit/1/null?gId=${id}`)
-              )
+              authorityFu(1010, '藏品入库', () => history.push(`/inStorage_edit/1/null?gId=${id}`))
           },
           {
             key: '2',
             label: '移库',
             onClick: () =>
-              authorityFu(1020, '您没有藏品移库权限!', () =>
+              authorityFu(1020, '藏品移库', () =>
                 history.push(`/moveStorage_edit/1/null?gId=${id}`)
               )
           },
@@ -95,9 +97,7 @@ function ZgoodsInfo() {
             key: '3',
             label: '出库',
             onClick: () =>
-              authorityFu(1030, '您没有藏品出库权限!', () =>
-                history.push(`/outStorage_edit/1/null?gId=${id}`)
-              )
+              authorityFu(1030, '藏品出库', () => history.push(`/outStorage_edit/1/null?gId=${id}`))
           }
         ]
       },
@@ -111,33 +111,25 @@ function ZgoodsInfo() {
             key: '1',
             label: '鉴定登记',
             onClick: () =>
-              authorityFu(230, '您没有藏品鉴定权限!', () =>
-                history.push(`/auth_edit/1/null?gId=${id}`)
-              )
+              authorityFu(230, '藏品鉴定', () => history.push(`/auth_edit/1/null?gId=${id}`))
           },
           {
             key: '2',
             label: '事故登记',
             onClick: () =>
-              authorityFu(510, '您没有事故登记权限!', () =>
-                history.push(`/accident_edit/1/null?gId=${id}`)
-              )
+              authorityFu(510, '事故登记', () => history.push(`/accident_edit/1/null?gId=${id}`))
           },
           {
             key: '3',
             label: '现状登记',
             onClick: () =>
-              authorityFu(540, '您没有现状登记权限!', () =>
-                history.push(`/actuality_edit/1/null?gId=${id}`)
-              )
+              authorityFu(540, '现状登记', () => history.push(`/actuality_edit/1/null?gId=${id}`))
           },
           {
             key: '4',
             label: '修复登记',
             onClick: () =>
-              authorityFu(550, '您没有修复登记权限!', () =>
-                history.push(`/repair_edit/1/null?gId=${id}`)
-              )
+              authorityFu(550, '修复登记', () => history.push(`/repair_edit/1/null?gId=${id}`))
           }
         ]
       }
@@ -145,7 +137,7 @@ function ZgoodsInfo() {
   }, [id])
 
   const [tabArr1, setTabArr1] = useState<tabArr1Type[]>([])
-  const [tabAc, setTabAc] = useState(0)
+  const [loding, setLoding] = useState(false)
 
   const [tabArr2, setTabArr2] = useState<tabArr1Type[]>([])
 
@@ -154,13 +146,15 @@ function ZgoodsInfo() {
   useEffect(() => {
     const newArr1 = tabArr1Temp.filter(v => authorityIds.includes(v.id))
     if (newArr1.length) {
-      setTabAc(newArr1[0].id)
       newArr1[0].done = newArr1[0].show = true
     }
+    setTimeout(() => {
+      setLoding(true)
+    }, 300)
 
     setTabArr1(newArr1)
     setTabArr2(tabArr2Temp.filter(v => authorityIds.includes(v.id)))
-  }, [authorityIds, tabArr2Temp])
+  }, [authorityIds, tabArr1Temp, tabArr2Temp])
 
   // 获取标签
   const tagDom = useMemo(() => {
@@ -179,7 +173,6 @@ function ZgoodsInfo() {
   // 切换左侧tab
   const cutTabFu = useCallback(
     (id: number) => {
-      setTabAc(id)
       setTabArr1(
         tabArr1.map(v => ({
           ...v,
@@ -191,17 +184,25 @@ function ZgoodsInfo() {
     [tabArr1]
   )
 
+  // const pageFlag =useCallback((id:number)=>{
+  //   let flag =[false,false]
+  //   const obj =tabArr1.find(v=>v.id===id)
+  //   if(obj){
+
+  //   }
+  // },[])
+
   return (
     <div className={styles.ZgoodsInfo}>
       <div className='GITot'>
         <h2>{info.name || ''}</h2>
-        <div>{tagDom}</div>
+        {tagDom}
       </div>
       <div className='GItab'>
         <div>
           {tabArr1.map(item => (
             <div
-              className={classNames('GItab1', tabAc === item.id ? 'GItab1Ac' : '')}
+              className={classNames('GItab1', item.show ? 'GItab1Ac' : '')}
               key={item.id}
               onClick={() => cutTabFu(item.id)}
             >
@@ -209,18 +210,39 @@ function ZgoodsInfo() {
             </div>
           ))}
         </div>
-        <div>
-          {tabArr2.map(item => (
-            <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
-              <Button type='primary'>
-                {item.name}
-                <CaretDownOutlined />
-              </Button>
-            </Dropdown>
-          ))}
-        </div>
+        {/* 已删除状态隐藏右侧抽屉按钮 */}
+        {info.status === 8 ? (
+          <div></div>
+        ) : (
+          <div>
+            {tabArr2.map(item => (
+              <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
+                <Button type='primary'>
+                  {item.name}
+                  <CaretDownOutlined />
+                </Button>
+              </Dropdown>
+            ))}
+          </div>
+        )}
+      </div>
+
+      {/* 主体 */}
+      <div className='GImain'>
+        {tabArr1.length ? (
+          <>
+            {tabArr1.map(item => (
+              <div key={item.id} hidden={!item.show}>
+                {item.done ? item.Dom : null}
+              </div>
+            ))}
+          </>
+        ) : (
+          <div className='GImainNone' hidden={!loding}>
+            该页面请联系管理员!
+          </div>
+        )}
       </div>
-      {/* 待完善sg */}
     </div>
   )
 }

+ 2 - 2
src/utils/authority.ts

@@ -5,11 +5,11 @@ import history from './history'
 import { Typetable } from '@/pages/Zother/data'
 
 // 看下有没有权限
-export const authorityFu = (id: number, txt: string, fu: () => void) => {
+export const authorityFu = (id: number, txt: string, fu: () => void, txt2?: string) => {
   const authorityIds = store.getState().A0Layout.authorityIds
 
   if (authorityIds.includes(id)) fu()
-  else MessageFu.warning(txt)
+  else MessageFu.warning(txt2 ? txt2 : `您没有${txt}权限!`)
 }
 
 // 列表页面的审批按钮是否显示,true为显示