|
@@ -1,9 +1,225 @@
|
|
|
-import React from 'react'
|
|
|
|
|
|
|
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
import styles from './index.module.scss'
|
|
|
|
|
+import { GoodsType } from '../Zother/SonGoodsList/data'
|
|
|
|
|
+import { API_getGoodsInfo } from '@/store/action/Cledger/C1ledger'
|
|
|
|
|
+import { useParams } from 'react-router-dom'
|
|
|
|
|
+import { resTagFu } from '@/utils/dataChange'
|
|
|
|
|
+import { Button, Dropdown, Tag } from 'antd'
|
|
|
|
|
+import { useSelector } from 'react-redux'
|
|
|
|
|
+import { RootState } from '@/store'
|
|
|
|
|
+import classNames from 'classnames'
|
|
|
|
|
+import history from '@/utils/history'
|
|
|
|
|
+import { authorityFu } from '@/utils/authority'
|
|
|
|
|
+import { CaretDownOutlined } from '@ant-design/icons'
|
|
|
|
|
+
|
|
|
|
|
+type tabArr1Type = {
|
|
|
|
|
+ id: number
|
|
|
|
|
+ name: string
|
|
|
|
|
+ done: boolean
|
|
|
|
|
+ show: boolean
|
|
|
|
|
+ son?: 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() {
|
|
function ZgoodsInfo() {
|
|
|
|
|
+ const { id } = useParams<any>()
|
|
|
|
|
+ // 获取藏品详情
|
|
|
|
|
+ const [info, getInfo] = useState({} as GoodsType)
|
|
|
|
|
+ const getInfoFu = useCallback(async () => {
|
|
|
|
|
+ const res = await API_getGoodsInfo(id)
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ getInfo(res.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [id])
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ getInfoFu()
|
|
|
|
|
+ }, [getInfoFu])
|
|
|
|
|
+
|
|
|
|
|
+ // 待完善sg 一些状态待确定
|
|
|
|
|
+ const tabArr2Temp = useMemo(() => {
|
|
|
|
|
+ return [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 336,
|
|
|
|
|
+ name: '档案管理',
|
|
|
|
|
+ done: true,
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ son: [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '1',
|
|
|
|
|
+ label: '修改',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(420, '您没有藏品修改权限!', () =>
|
|
|
|
|
+ history.push(`/edit_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '2',
|
|
|
|
|
+ label: '注销',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(430, '您没有藏品注销权限!', () =>
|
|
|
|
|
+ history.push(`/writeOff_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 337,
|
|
|
|
|
+ name: '库存信息',
|
|
|
|
|
+ done: true,
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ son: [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '1',
|
|
|
|
|
+ label: '入库',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(1010, '您没有藏品入库权限!', () =>
|
|
|
|
|
+ history.push(`/inStorage_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '2',
|
|
|
|
|
+ label: '移库',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(1020, '您没有藏品移库权限!', () =>
|
|
|
|
|
+ history.push(`/moveStorage_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '3',
|
|
|
|
|
+ label: '出库',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(1030, '您没有藏品出库权限!', () =>
|
|
|
|
|
+ history.push(`/outStorage_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 338,
|
|
|
|
|
+ name: '藏品维护',
|
|
|
|
|
+ done: true,
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ son: [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '1',
|
|
|
|
|
+ label: '鉴定登记',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(230, '您没有藏品鉴定权限!', () =>
|
|
|
|
|
+ history.push(`/auth_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '2',
|
|
|
|
|
+ label: '事故登记',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(510, '您没有事故登记权限!', () =>
|
|
|
|
|
+ history.push(`/accident_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '3',
|
|
|
|
|
+ label: '现状登记',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(540, '您没有现状登记权限!', () =>
|
|
|
|
|
+ history.push(`/actuality_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '4',
|
|
|
|
|
+ label: '修复登记',
|
|
|
|
|
+ onClick: () =>
|
|
|
|
|
+ authorityFu(550, '您没有修复登记权限!', () =>
|
|
|
|
|
+ history.push(`/repair_edit/1/null?gId=${id}`)
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }, [id])
|
|
|
|
|
+
|
|
|
|
|
+ const [tabArr1, setTabArr1] = useState<tabArr1Type[]>([])
|
|
|
|
|
+ const [tabAc, setTabAc] = useState(0)
|
|
|
|
|
+
|
|
|
|
|
+ const [tabArr2, setTabArr2] = useState<tabArr1Type[]>([])
|
|
|
|
|
+
|
|
|
|
|
+ const authorityIds = useSelector((state: RootState) => state.A0Layout.authorityIds)
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ const newArr1 = tabArr1Temp.filter(v => authorityIds.includes(v.id))
|
|
|
|
|
+ if (newArr1.length) {
|
|
|
|
|
+ setTabAc(newArr1[0].id)
|
|
|
|
|
+ newArr1[0].done = newArr1[0].show = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ setTabArr1(newArr1)
|
|
|
|
|
+ setTabArr2(tabArr2Temp.filter(v => authorityIds.includes(v.id)))
|
|
|
|
|
+ }, [authorityIds, tabArr2Temp])
|
|
|
|
|
+
|
|
|
|
|
+ // 获取标签
|
|
|
|
|
+ const tagDom = useMemo(() => {
|
|
|
|
|
+ let dom: any = ''
|
|
|
|
|
+ if (info.tagDictId) {
|
|
|
|
|
+ dom = []
|
|
|
|
|
+ const txt: string = resTagFu(info.tagDictId)
|
|
|
|
|
+ const arr = txt.split(';')
|
|
|
|
|
+ arr.forEach((v, i) => {
|
|
|
|
|
+ dom.push(<Tag key={i}>{v}</Tag>)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ return dom
|
|
|
|
|
+ }, [info.tagDictId])
|
|
|
|
|
+
|
|
|
|
|
+ // 切换左侧tab
|
|
|
|
|
+ const cutTabFu = useCallback(
|
|
|
|
|
+ (id: number) => {
|
|
|
|
|
+ setTabAc(id)
|
|
|
|
|
+ setTabArr1(
|
|
|
|
|
+ tabArr1.map(v => ({
|
|
|
|
|
+ ...v,
|
|
|
|
|
+ done: v.id === id && !v.done ? true : v.done,
|
|
|
|
|
+ show: v.id === id
|
|
|
|
|
+ }))
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ [tabArr1]
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.ZgoodsInfo}>
|
|
<div className={styles.ZgoodsInfo}>
|
|
|
- <h1>藏品详情页,开发中</h1>
|
|
|
|
|
|
|
+ <div className='GITot'>
|
|
|
|
|
+ <h2>{info.name || ''}</h2>
|
|
|
|
|
+ <div>{tagDom}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className='GItab'>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {tabArr1.map(item => (
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={classNames('GItab1', tabAc === item.id ? 'GItab1Ac' : '')}
|
|
|
|
|
+ key={item.id}
|
|
|
|
|
+ onClick={() => cutTabFu(item.id)}
|
|
|
|
|
+ >
|
|
|
|
|
+ {item.name}
|
|
|
|
|
+ </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>
|
|
|
{/* 待完善sg */}
|
|
{/* 待完善sg */}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|