Commit 8a5b9af0 by zhaochengxiang

无资产选中 详情显示要素

parent fc9103fd
...@@ -35,7 +35,7 @@ const AssetAction = (props) => { ...@@ -35,7 +35,7 @@ const AssetAction = (props) => {
} else { } else {
setMetadataId(''); setMetadataId('');
setAssetParams({...assetParams, ...{assets: {}, attributes: []}}); setAssetParams({...assetParams, ...{assets: {}, attributes: []}});
setElements([]); getElements();
} }
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
...@@ -50,24 +50,22 @@ const AssetAction = (props) => { ...@@ -50,24 +50,22 @@ const AssetAction = (props) => {
setElements(data||[]); setElements(data||[]);
onElementsChange && onElementsChange(data||[]); onElementsChange && onElementsChange(data||[]);
if (action === 'add') { const _attributes = [];
const _attributes = []; (data||[]).forEach(element => {
(data||[]).forEach(element => { if (_attributes.indexOf(element.type) === -1) {
if (_attributes.indexOf(element.type) === -1) { _attributes.push(element.type);
_attributes.push(element.type); }
} })
})
let newAttributesFoldMap = {...attributesFoldMap}; let newAttributesFoldMap = {...attributesFoldMap};
(_attributes||[]).forEach(attribute => { (_attributes||[]).forEach(attribute => {
if (newAttributesFoldMap[attribute]===undefined || newAttributesFoldMap[attribute]===null) { if (newAttributesFoldMap[attribute]===undefined || newAttributesFoldMap[attribute]===null) {
newAttributesFoldMap[attribute] = true; newAttributesFoldMap[attribute] = true;
} }
}) })
setAssetParams({ assets: {}, attributes: _attributes, attributesFoldMap: newAttributesFoldMap }); setAssetParams({ assets: {}, attributes: _attributes, attributesFoldMap: newAttributesFoldMap });
form?.resetFields(); form?.resetFields();
}
cb && cb(); cb && cb();
}, },
...@@ -260,22 +258,26 @@ const AssetAction = (props) => { ...@@ -260,22 +258,26 @@ const AssetAction = (props) => {
<div>资产详情</div> <div>资产详情</div>
<Space> <Space>
{ {
(currentAction!=='detail') && <Tooltip title='取消编辑'> ((id||'')!=='') && <React.Fragment>
<Button {
onClick={onCancelButtonClick} (currentAction!=='detail') && <Tooltip title='取消编辑'>
icon={<CancelSvg style={{ width: 20, height: 20 }} />} <Button
type='text' onClick={onCancelButtonClick}
/> icon={<CancelSvg style={{ width: 20, height: 20 }} />}
</Tooltip> type='text'
/>
</Tooltip>
}
<Tooltip title={(currentAction==='detail')?'编辑':'保存'}>
<Button
loading={confirmLoading}
onClick={onActionButtonClick}
icon={(currentAction==='detail')?<EditSvg style={{ width: 20, height: 20 }} />: <SaveSvg style={{ width: 20, height: 20 }} />}
type='text'
/>
</Tooltip>
</React.Fragment>
} }
<Tooltip title={(currentAction==='detail')?'编辑':'保存'}>
<Button
loading={confirmLoading}
onClick={onActionButtonClick}
icon={(currentAction==='detail')?<EditSvg style={{ width: 20, height: 20 }} />: <SaveSvg style={{ width: 20, height: 20 }} />}
type='text'
/>
</Tooltip>
<Tooltip title={fullScreen?'取消全屏':'全屏'}> <Tooltip title={fullScreen?'取消全屏':'全屏'}>
<Button <Button
onClick={onFullScreenClick} onClick={onFullScreenClick}
...@@ -287,19 +289,17 @@ const AssetAction = (props) => { ...@@ -287,19 +289,17 @@ const AssetAction = (props) => {
</div> </div>
} }
{ {
(action!=='add') && <div> (action!=='add' && (id||'')!=='') && <div>
<div className='pl-common py-compact-common'> <div className='pl-common py-compact-common'>
<Descriptions column={1}> <Descriptions column={1}>
{ <Descriptions.Item
(assets.currentPath||'')!=='' && <Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>}
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>} style={{ paddingBottom: 15 }}
style={{ paddingBottom: 15 }} >
> <a onClick={()=>{jumpToPath();}}>
<a onClick={()=>{jumpToPath();}}> {assets.currentPath||''}
{assets.currentPath||''} </a>
</a> </Descriptions.Item>
</Descriptions.Item>
}
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 0 }}> <Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 0 }}>
<AppContext.Consumer> <AppContext.Consumer>
{ {
......
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