Commit e89a5931 by zhaochengxiang

草稿标识修改

parent f5a82e06
......@@ -1286,11 +1286,10 @@ const AssetAction = (props) => {
{
(action!=='add' && (id||'')!=='') && <div>
<div className='mb-3'>
<Descriptions column={(reference===AssetDraftReference)?4:1}>
<Descriptions column={1}>
<Descriptions.Item
label='资产目录路径'
style={{ paddingBottom: 0 }}
span={2}
>
<span>
{
......@@ -1306,25 +1305,6 @@ const AssetAction = (props) => {
}
</span>
</Descriptions.Item>
{
(reference===AssetDraftReference) && <>
<Descriptions.Item
label='修改类型'
style={{ paddingBottom: 0 }}
>
{ assets?.operation==='release' && '新增'}
{ assets?.operation==='change' && '修改'}
{ assets?.operation==='offline' && '停用'}
</Descriptions.Item>
<Descriptions.Item
label='状态'
style={{ paddingBottom: 0 }}
>
{ assets?.state==='draft' && '待提交'}
{ assets?.operation==='auditing' && '审批中'}
</Descriptions.Item>
</>
}
</Descriptions>
</div>
</div>
......
......@@ -2,24 +2,52 @@ import React from 'react';
import { Drawer, Form } from 'antd';
import AssetAction from './AssetAction';
import { AssetDraftReference } from '../../../../util/constant';
import { dispatch } from '../../../../model';
const AssetDetailDrawer = (props) => {
const { onCancel, visible, id, dirId, reference, readonly = false } = props;
const [animated, setAnimated] = React.useState(true)
const [ form ] = Form.useForm();
const [draftAsset, setDraftAsset] = React.useState()
React.useEffect(() => {
if (visible) {
setTimeout(() => {
setAnimated(false)
}, 300)
if (reference === AssetDraftReference) {
getDraft()
}
}
}, [visible])
const title = React.useMemo(() => {
if (draftAsset?.state === 'draft') return '资产目录详情(待提交)'
if (draftAsset?.state === 'auditing') return '资产目录详情(审批中)'
return '资产目录详情'
}, [draftAsset])
const getDraft = () => {
dispatch({
type: 'assetmanage.getDraftDetail',
payload: {
params: {
draftId: id,
}
},
callback: data => {
setDraftAsset(data)
}
})
}
return (
<Drawer
visible={ visible }
title='资产目录详情'
title={title}
width='80%'
placement="right"
closable={ true }
......
......@@ -16,6 +16,8 @@ const AssetDetailPage = (props)=>{
const [ data, setData ] = useState({ id: '', dirId: '', isDraft: '', catalog: '' });
const [loading, setLoading] = useState(false)
const [templateType, setTemplateType] = useState()
const [draftAsset, setDraftAsset] = React.useState()
const { id, dirId, isDraft, catalog } = data;
useEffect(() => {
......@@ -31,6 +33,13 @@ const AssetDetailPage = (props)=>{
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const title = React.useMemo(() => {
if (draftAsset?.state === 'draft') return '资产目录详情(待提交)'
if (draftAsset?.state === 'auditing') return '资产目录详情(审批中)'
return '资产目录详情'
}, [draftAsset])
const getDataAssetDetail = () => {
const _id = getQueryParam('id', props.location.search);
const _dirId = getQueryParam('dirId', props.location.search);
......@@ -59,6 +68,9 @@ const AssetDetailPage = (props)=>{
setLoading(false);
LocalStorage.set(`templateType-${appId}`, data?.templateType)
setTemplateType(data?.templateType)
if (_isDraft === 'true') {
setDraftAsset(data)
}
},
error: () => {
setLoading(false);
......@@ -70,7 +82,7 @@ const AssetDetailPage = (props)=>{
return(
<div className='asset-detail position-relative'>
<div className='detail-header'>
<span style={{ fontSize: 16, fontWeight: 'bold', color: '#000' }}>资产目录详情</span>
<span style={{ fontSize: 16, fontWeight: 'bold', color: '#000' }}>{title}</span>
</div>
<Spin spinning={loading}>
<div className='detail-container'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment