Commit 4268bb0f by zhaochengxiang

资产路径

parent e8094fc0
......@@ -205,6 +205,10 @@ export function* countResourceState(payload) {
return yield call(service.countResourceState, payload);
}
export function* getAssetPaths(payload) {
return yield call(service.getAssetPaths, payload);
}
export function* getResourceRelations(payload) {
return yield call(service.getResourceRelations, payload);
}
......
......@@ -100,6 +100,10 @@ export function recoveryFromRecycleBin(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/recoveryFromRecycleBin", payload);
}
export function getAssetPaths(payload) {
return GetJSON("/dataassetmanager/dataAssetApi/getMultiPath", payload);
}
export function addOrUpdateDirectory(payload) {
return PostJSON("/dataassetmanager/directoryApi/addOrUpdateDirectory", payload);
}
......
......@@ -23,6 +23,7 @@ const AssetAction = (props) => {
const [ loading, setLoading ] = useState(false);
const [ confirmLoading, setConfirmLoading ] = useState(false);
const [ fullScreen, setFullScreen ] = useState(false);
const [ assetPaths, setAssetPaths ] = useState([]);
const [ resourceRelations, setResourceRelations ] = useState([]);
const { assets, attributes, attributesFoldMap } = assetParams;
const [ assetTagModalVisible, setAssetTagModalVisible ] = useState(false);
......@@ -34,6 +35,7 @@ const AssetAction = (props) => {
} else {
setCurrentAction('detail');
if ((id||'')!=='') {
getAssetPaths();
getResourceRelations();
if (readOnly) {
......@@ -51,6 +53,18 @@ const AssetAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [id])
const getAssetPaths = () => {
dispatch({
type: 'assetmanage.getAssetPaths',
payload: {
dataAssetId: id,
},
callback: data => {
setAssetPaths(data||[]);
}
});
}
const getResourceRelations = () => {
dispatch({
type: 'assetmanage.getResourceRelations',
......@@ -182,13 +196,25 @@ const AssetAction = (props) => {
}
}
const jumpToPath = () => {
const jumpToPath = (item) => {
if (!readOnly) {
setFullScreen(false);
let event = new Event('storage');
event.key = 'assetDirChangeEvent';
event.dirId = dirId||'';
event.dirId = item.dirId||'';
window?.dispatchEvent(event);
} else {
const timestamp = new Date().getTime();
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}&timestamp=${timestamp}`);
} else {
showMessage('warn', '资产类型不是资源也不是资产!');
}
}
}
const jumpToRelation = (relation) => {
......@@ -380,9 +406,15 @@ const AssetAction = (props) => {
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>}
style={{ paddingBottom: 15 }}
>
<a onClick={()=>{jumpToPath();}}>
{assets.currentPath||''}
</a>
<div className='flex' style={{ flexDirection: 'column' }}>
{
(assetPaths||[]).map((item, key) => {
return (
<a key={key} onClick={() => { jumpToPath(item); }}>{highlightSearchContentByTerms(item?.dataAssetName||'',[assets.currentPath])}</a>
);
})
}
</div>
</Descriptions.Item>
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 15 }}>
<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