|
|
@@ -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>
|
|
|
)
|
|
|
}
|