|
@@ -17,6 +17,8 @@ import GItab3 from './GItab3'
|
|
|
import GItab4 from './GItab4'
|
|
import GItab4 from './GItab4'
|
|
|
import GItab5 from './GItab5'
|
|
import GItab5 from './GItab5'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
import { MessageFu } from '@/utils/message'
|
|
|
|
|
+import { FileListType } from '@/components/Z3upFiles/data'
|
|
|
|
|
+import { API_getFileListByIds } from '@/store/action/Cledger/C4file'
|
|
|
|
|
|
|
|
type tabArr1Type = {
|
|
type tabArr1Type = {
|
|
|
id: number
|
|
id: number
|
|
@@ -29,12 +31,22 @@ type tabArr1Type = {
|
|
|
|
|
|
|
|
function ZgoodsInfo() {
|
|
function ZgoodsInfo() {
|
|
|
const { id } = useParams<any>()
|
|
const { id } = useParams<any>()
|
|
|
- // 获取藏品详情
|
|
|
|
|
|
|
+ // 藏品详情
|
|
|
const [info, getInfo] = useState({} as GoodsType)
|
|
const [info, getInfo] = useState({} as GoodsType)
|
|
|
|
|
+ // 藏品附件
|
|
|
|
|
+ const [fileList, setFileList] = useState<FileListType[]>([])
|
|
|
const getInfoFu = useCallback(async () => {
|
|
const getInfoFu = useCallback(async () => {
|
|
|
const res = await API_getGoodsInfo(id)
|
|
const res = await API_getGoodsInfo(id)
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
getInfo(res.data)
|
|
getInfo(res.data)
|
|
|
|
|
+ // 获取附件信息
|
|
|
|
|
+ const fileIds = res.data.fileIds || ''
|
|
|
|
|
+ if (fileIds) {
|
|
|
|
|
+ const res22 = await API_getFileListByIds(fileIds.split(',').map((v: string) => Number(v)))
|
|
|
|
|
+ if (res22.code === 0) {
|
|
|
|
|
+ setFileList(res22.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}, [id])
|
|
}, [id])
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -43,13 +55,19 @@ function ZgoodsInfo() {
|
|
|
|
|
|
|
|
const tabArr1Temp = useMemo(() => {
|
|
const tabArr1Temp = useMemo(() => {
|
|
|
return [
|
|
return [
|
|
|
- { id: 331, name: '藏品信息', done: false, show: false, Dom: <GItab1 info={info} /> },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 331,
|
|
|
|
|
+ name: '藏品信息',
|
|
|
|
|
+ done: false,
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ Dom: <GItab1 info={info} fileList={fileList} />
|
|
|
|
|
+ },
|
|
|
{ id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
|
|
{ id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
|
|
|
{ id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
|
|
{ id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
|
|
|
{ id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
|
|
{ id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
|
|
|
{ id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
|
|
{ id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
|
|
|
]
|
|
]
|
|
|
- }, [info])
|
|
|
|
|
|
|
+ }, [fileList, info])
|
|
|
|
|
|
|
|
// 点击的时候校验前置状态和页面权限
|
|
// 点击的时候校验前置状态和页面权限
|
|
|
const tabArr2Temp = useMemo(() => {
|
|
const tabArr2Temp = useMemo(() => {
|
|
@@ -75,8 +93,8 @@ function ZgoodsInfo() {
|
|
|
if ([3, 6].includes(info.status)) {
|
|
if ([3, 6].includes(info.status)) {
|
|
|
authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null?gId=${id}`))
|
|
authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null?gId=${id}`))
|
|
|
} else {
|
|
} else {
|
|
|
- const txt = Reflect.get(selectObj['藏品入藏状态'], info.status) || '草稿'
|
|
|
|
|
- MessageFu.warning(`当前藏品为 ${txt} 状态,不可 注销`)
|
|
|
|
|
|
|
+ const txtObj = selectObj['藏品入藏状态'].find(v => v.value === info.status)
|
|
|
|
|
+ MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '草稿'} 状态,不可 注销`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -97,8 +115,8 @@ function ZgoodsInfo() {
|
|
|
history.push(`/inStorage_edit/1/null?gId=${id}`)
|
|
history.push(`/inStorage_edit/1/null?gId=${id}`)
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
- const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
|
|
|
|
|
- MessageFu.warning(`当前藏品为 ${txt} 状态,不可 入库`)
|
|
|
|
|
|
|
+ const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
|
|
|
|
|
+ MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '草稿'} 状态,不可 入库`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -111,8 +129,8 @@ function ZgoodsInfo() {
|
|
|
history.push(`/moveStorage_edit/1/null?gId=${id}`)
|
|
history.push(`/moveStorage_edit/1/null?gId=${id}`)
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
- const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
|
|
|
|
|
- MessageFu.warning(`当前藏品为 ${txt} 状态,不可 移库`)
|
|
|
|
|
|
|
+ const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
|
|
|
|
|
+ MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '未入库'} 状态,不可 移库`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -125,8 +143,8 @@ function ZgoodsInfo() {
|
|
|
history.push(`/outStorage_edit/1/null?gId=${id}`)
|
|
history.push(`/outStorage_edit/1/null?gId=${id}`)
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
- const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
|
|
|
|
|
- MessageFu.warning(`当前藏品为 ${txt} 状态,不可 出库`)
|
|
|
|
|
|
|
+ const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
|
|
|
|
|
+ MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '未入库'} 状态,不可 出库`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -215,18 +233,19 @@ function ZgoodsInfo() {
|
|
|
[tabArr1]
|
|
[tabArr1]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- // const pageFlag =useCallback((id:number)=>{
|
|
|
|
|
- // let flag =[false,false]
|
|
|
|
|
- // const obj =tabArr1.find(v=>v.id===id)
|
|
|
|
|
- // if(obj){
|
|
|
|
|
-
|
|
|
|
|
- // }
|
|
|
|
|
- // },[])
|
|
|
|
|
|
|
+ // 藏品状态
|
|
|
|
|
+ const goodsStatus = useMemo(() => {
|
|
|
|
|
+ let txt = '草稿'
|
|
|
|
|
+ const obj = selectObj['藏品入藏状态'].find(v => v.value === info.status)
|
|
|
|
|
+ if (obj) txt = obj.label
|
|
|
|
|
+ return txt
|
|
|
|
|
+ }, [info.status])
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.ZgoodsInfo}>
|
|
<div className={styles.ZgoodsInfo}>
|
|
|
<div className='GITot'>
|
|
<div className='GITot'>
|
|
|
<h2>{info.name || ''}</h2>
|
|
<h2>{info.name || ''}</h2>
|
|
|
|
|
+ {info.id ? <i>({goodsStatus})</i> : null}
|
|
|
{tagDom}
|
|
{tagDom}
|
|
|
</div>
|
|
</div>
|
|
|
<div className='GItab'>
|
|
<div className='GItab'>
|