Commit 53cf45a4 by zhaochengxiang

bug fix

parent 9f33ce11
......@@ -31,7 +31,6 @@ const AssetAction = (props) => {
const [ currentAction, setCurrentAction ] = useState(action);
const [ assetParams, setAssetParams ] = useState({ assets: {}, attributes: [], attributesFoldMap: {} });
const [ elements, setElements ] = useState([]);
const [ wholeElements, setWholeElements ] = useState([]);
const [currentAttribute, setCurrentAttribute] = useState();
const [ metadataId, setMetadataId ] = useState('');
const [ loading, setLoading ] = useState(false);
......@@ -213,12 +212,11 @@ const AssetAction = (props) => {
getTreeData();
getDepartments();
if (action === 'add') {
// getElements();
} else {
setCurrentAction('detail');
if ((id||'')!=='') {
setPagination({...pagination, pageNum: 1});
getElements();
getAssetPaths();
getResourceRelations();
checkDataAssetEditable();
......@@ -228,7 +226,6 @@ const AssetAction = (props) => {
setMetadataId('');
setAssetParams({...assetParams, ...{assets: {}, attributes: []}});
setCurrentAttribute();
getElements();
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
......@@ -385,20 +382,6 @@ const AssetAction = (props) => {
});
}
const getElements = ( cb = null ) => {
dispatch({
type: (currentAction==='add')?'assetmanage.listElementsAndFillValue':'assetmanage.listElements',
payload: (currentAction==='add')?{
params: {
dirId
}
}:undefined,
callback: data => {
setWholeElements(data||[]);
}
})
}
const getUserElements = () => {
setLoading(true);
dispatch({
......@@ -597,7 +580,7 @@ const AssetAction = (props) => {
if (item.resourceType==='innerSource'||item.resourceType==='outerSource') {
window.open(`/center-home/menu/asset-resource-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`);
} else if (item.resourceType==='dataAsset') {
window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&templateType=${LocalStorage.get(`templateType-${appId}`)}&timestamp=${timestamp}`);
window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&templateType=${assets?.templateType}&timestamp=${timestamp}`);
} else {
showMessage('warn', '资产目录类型不是资源也不是资产!');
}
......@@ -946,6 +929,10 @@ const AssetAction = (props) => {
</Space>
</div>
}
<Spin
spinning={loading}
>
{
(action!=='add' && (id||'')!=='') && <div>
<div className='pl-common py-compact-common'>
......@@ -1000,9 +987,7 @@ const AssetAction = (props) => {
overflow: 'auto',
}}
> */}
<Spin
spinning={loading}
>
<Form form={form} onValuesChange={onValuesChange}>
<Radio.Group buttonStyle='solid' className='mb-3' value={currentAttribute} onChange={(e) => {
setCurrentAttribute(e.target.value)
......@@ -1018,15 +1003,9 @@ const AssetAction = (props) => {
return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}>
<Descriptions column={1} bordered>
{
wholeElements?.length>0 && elements?.map((element, index) => {
elements?.map((element, index) => {
if (element.type!==attribute || element.name === '资产项') return null;
let interpretation = null;
const filterElements = wholeElements?.filter(_element => _element.id === element.id);
if (filterElements.length>0) {
interpretation = filterElements[0].interpretation;
}
return (
<Descriptions.Item
key={index}
......@@ -1054,8 +1033,8 @@ const AssetAction = (props) => {
</Form.Item>
</Col>
{
interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}>
element.interpretation && <Col span={2}>
<Tooltip placement="left" title={element.interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip>
</Col>
......@@ -1067,8 +1046,8 @@ const AssetAction = (props) => {
{ elementDetailComponent(element) }
</Col>
{
interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}>
element.interpretation && <Col span={2}>
<Tooltip placement="left" title={element.interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip>
</Col>
......
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