|
|
@@ -15,6 +15,7 @@ import { FileListType } from '@/components/Z3upFiles/data'
|
|
|
import Zg2file from './Zg2file'
|
|
|
import Zg3log from './Zg3log'
|
|
|
import { getKuListByOpenFu } from '../data'
|
|
|
+import history from '@/utils/history'
|
|
|
|
|
|
function ZgoodsInfo() {
|
|
|
const { id, fId } = useParams<any>()
|
|
|
@@ -22,14 +23,17 @@ function ZgoodsInfo() {
|
|
|
const [kuTxt, setkuTxt] = useState('')
|
|
|
const [kuList, setKuList] = useState<antdSelectType[]>([])
|
|
|
|
|
|
+ const [errFlag, setErrFlag] = useState(false)
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
getKuListByOpenFu(data => {
|
|
|
if (data && data.length) {
|
|
|
setKuList(data)
|
|
|
const obj = data.find(v => v.value === Number(fId))
|
|
|
if (obj) setkuTxt(obj.label)
|
|
|
+ else setErrFlag(true)
|
|
|
}
|
|
|
- }, true)
|
|
|
+ })
|
|
|
}, [fId])
|
|
|
|
|
|
// 获取表单字段
|
|
|
@@ -63,8 +67,8 @@ function ZgoodsInfo() {
|
|
|
}, [getInfoFu])
|
|
|
|
|
|
// 发布状态/入库状态
|
|
|
- const selectTxt = useCallback((type: '发布状态' | '入库状态', val: number) => {
|
|
|
- let txt = type === '发布状态' ? '未发布' : '未入库'
|
|
|
+ const selectTxt = useCallback((type: '发布状态' | '入库状态' | '推荐状态', val: number) => {
|
|
|
+ let txt = type === '发布状态' ? '未发布' : type === '入库状态' ? '未入库' : '未推荐'
|
|
|
const obj = selectObj[type].find(v => v.value === val)
|
|
|
if (obj) txt = obj.label
|
|
|
return txt
|
|
|
@@ -100,11 +104,6 @@ function ZgoodsInfo() {
|
|
|
|
|
|
// 点击的时候校验前置状态和页面权限
|
|
|
const tabArr2 = useMemo(() => {
|
|
|
- // 待完善 校验
|
|
|
- // let arr: any[] = []
|
|
|
- // if ([3, 4, 6, 7].includes(info.status)) {
|
|
|
-
|
|
|
- // }
|
|
|
let arr = [
|
|
|
{
|
|
|
id: 336,
|
|
|
@@ -121,7 +120,12 @@ function ZgoodsInfo() {
|
|
|
key: '2',
|
|
|
label: '注销',
|
|
|
onClick: () => {
|
|
|
- MessageFu.warning('开发中')
|
|
|
+ // 发布状态 未发布
|
|
|
+ if ([2, 3].includes(info.status_publish)) {
|
|
|
+ MessageFu.warning(`发布状态为(未发布)时,才可进行注销`)
|
|
|
+ } else {
|
|
|
+ MessageFu.warning('开发中')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
@@ -134,21 +138,39 @@ function ZgoodsInfo() {
|
|
|
key: '1',
|
|
|
label: '发布',
|
|
|
onClick: () => {
|
|
|
- MessageFu.warning('开发中')
|
|
|
+ // 发布状态 未发布
|
|
|
+ if ([2, 3].includes(info.status_publish)) {
|
|
|
+ MessageFu.warning(`发布状态为(未发布)时,才可进行发布`)
|
|
|
+ } else {
|
|
|
+ authorityFu(410, '资源发布', () =>
|
|
|
+ history.push(`/resIssue_edit/1/null/${fId}?gId=${info.id}`)
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
key: '2',
|
|
|
label: '下架',
|
|
|
onClick: () => {
|
|
|
- MessageFu.warning('开发中')
|
|
|
+ // 发布状态 已发布
|
|
|
+ if (info.status_publish === 3) {
|
|
|
+ MessageFu.warning('开发中')
|
|
|
+ } else MessageFu.warning(`发布状态为(已发布)时,才可进行下架`)
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
key: '3',
|
|
|
label: '推荐',
|
|
|
onClick: () => {
|
|
|
- MessageFu.warning('开发中')
|
|
|
+ // 发布状态 已发布
|
|
|
+ if (info.status_publish === 3) {
|
|
|
+ // 推荐状态 未推荐
|
|
|
+ if ([2, 3].includes(info.status_hot)) {
|
|
|
+ MessageFu.warning(`推荐状态为(未推荐)时,才可进行推荐`)
|
|
|
+ } else {
|
|
|
+ MessageFu.warning('开发中')
|
|
|
+ }
|
|
|
+ } else MessageFu.warning(`发布状态为(已发布)时,才可进行推荐`)
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
@@ -156,16 +178,20 @@ function ZgoodsInfo() {
|
|
|
]
|
|
|
|
|
|
return arr
|
|
|
- }, [info.id])
|
|
|
+ }, [fId, info])
|
|
|
return (
|
|
|
<div className={styles.ZgoodsInfo}>
|
|
|
- <div className='pageTitle'>资源详情 资源库:{kuTxt}</div>
|
|
|
- {info.id ? (
|
|
|
+ <div className='pageTitle'>
|
|
|
+ 资源详情 {errFlag ? null : '资源库:'}
|
|
|
+ {kuTxt}
|
|
|
+ </div>
|
|
|
+ {info.id && kuTxt ? (
|
|
|
<>
|
|
|
<div className='ZGtop1'>
|
|
|
<p title={info.name}>{info.name}</p>
|
|
|
- <Button>{selectTxt('发布状态', info.status_publish)}</Button>
|
|
|
<Button>{selectTxt('入库状态', info.status_storage)}</Button>
|
|
|
+ <Button>{selectTxt('发布状态', info.status_publish)}</Button>
|
|
|
+ <Button>{selectTxt('推荐状态', info.status_hot)}</Button>
|
|
|
</div>
|
|
|
|
|
|
<div className='ZGtop2'>资源编码:{info.num}</div>
|
|
|
@@ -184,7 +210,7 @@ function ZgoodsInfo() {
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
- {info.status_storage
|
|
|
+ {info.status_storage === 3
|
|
|
? tabArr2.map(item => (
|
|
|
<Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
|
|
|
<Button type='primary'>
|
|
|
@@ -210,7 +236,7 @@ function ZgoodsInfo() {
|
|
|
</div>
|
|
|
</>
|
|
|
) : null}
|
|
|
-
|
|
|
+ {errFlag ? <div className='Z0null'>资源库数据异常 或 资源库状态被停用</div> : null}
|
|
|
{/* 新增/编辑 资源 */}
|
|
|
{editId ? (
|
|
|
<AddGood
|