Commit 4268bb0f by zhaochengxiang

资产路径

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