Commit 8be981c6 by zhaochengxiang

元数据挂载资产

parent 1db68649
...@@ -329,4 +329,8 @@ export function* getPermission(payload) { ...@@ -329,4 +329,8 @@ export function* getPermission(payload) {
export function* getTemplates() { export function* getTemplates() {
return yield call(service.getTemplates) return yield call(service.getTemplates)
}
export function* getMetadataTemplates(payload) {
return yield call(service.getMetadataTemplates, payload)
} }
\ No newline at end of file
...@@ -314,4 +314,8 @@ export function getPermission(payload) { ...@@ -314,4 +314,8 @@ export function getPermission(payload) {
export function getTemplates() { export function getTemplates() {
return GetJSON("/dataassetmanager/elementTemplateApi/listSupportTemplates") return GetJSON("/dataassetmanager/elementTemplateApi/listSupportTemplates")
}
export function getMetadataTemplates(payload) {
return GetJSON("/dataassetmanager/elementTemplateApi/listSupportElementTemplatesByMetadataIdPath", payload)
} }
\ No newline at end of file
...@@ -81,6 +81,8 @@ const AssetManageTree = (props) => { ...@@ -81,6 +81,8 @@ const AssetManageTree = (props) => {
useEffect(() => { useEffect(() => {
if (reference === AssetManageReference) { if (reference === AssetManageReference) {
getTemplates() getTemplates()
} else if (reference === AssetMountReference && (metadataIds??[]).length > 0) {
getMetadataTemplates()
} else { } else {
getAllDirectoryAsTree(false) getAllDirectoryAsTree(false)
} }
...@@ -148,6 +150,28 @@ const AssetManageTree = (props) => { ...@@ -148,6 +150,28 @@ const AssetManageTree = (props) => {
}) })
} }
const getMetadataTemplates = () => {
setLoadingTemplates(true)
dispatch({
type: 'assetmanage.getMetadataTemplates',
payload: {
metadataIdPath: metadataIds[0]
},
callback: data => {
setLoadingTemplates(false)
setTemplates(data)
if ((data??[]).length > 0) {
setTemplateType(data[0].type)
LocalStorage.set(`templateType-${appId}`, data[0].type)
getAllDirectoryAsTree(true)
}
},
error: () => {
setLoadingTemplates(false)
}
})
}
const getDataAssetLocationThenGetTreeData = () => { const getDataAssetLocationThenGetTreeData = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -261,37 +285,16 @@ const AssetManageTree = (props) => { ...@@ -261,37 +285,16 @@ const AssetManageTree = (props) => {
} }
} }
} }
if ((metadataIds??[]).length > 0) {
dispatch({
type: 'assetmanage.queryDirectoryTreeByMetadataId',
payload: {
metadataIdPath: metadataIds[0]
},
callback: data => {
disposeData(data)
},
error: () => {
setLoading(false);
}
});
} else {
let url = '';
if (reference === AssetManageReference || reference === AssetMountReference) {
url = 'assetmanage.queryAllDirectoryAsTree';
}
dispatch({
type: url,
callback: data => {
disposeData(data)
},
error: () => {
setLoading(false);
}
});
}
dispatch({
type: 'assetmanage.queryAllDirectoryAsTree',
callback: data => {
disposeData(data)
},
error: () => {
setLoading(false);
}
})
} }
const treeDirectoryChanged = (did) => { const treeDirectoryChanged = (did) => {
...@@ -785,7 +788,7 @@ const AssetManageTree = (props) => { ...@@ -785,7 +788,7 @@ const AssetManageTree = (props) => {
getAllDirectoryAsTree(true) getAllDirectoryAsTree(true)
}, 100) }, 100)
}} }}
style={{ width: 80 }} style={{ width: 100 }}
> >
{ {
(templates??[]).map((item, index) => <Select.Option key={index} value={item.type}>{item.name}</Select.Option>) (templates??[]).map((item, index) => <Select.Option key={index} value={item.type}>{item.name}</Select.Option>)
...@@ -811,10 +814,34 @@ const AssetManageTree = (props) => { ...@@ -811,10 +814,34 @@ const AssetManageTree = (props) => {
</div> </div>
)} )}
bordered={false} bordered={false}
bodyStyle={{ padding: '10px 15px' }} bodyStyle={{ padding: (reference===AssetMountReference)?0:'10px 15px' }}
headStyle={{ padding: 0 }} headStyle={{ padding: 0 }}
style={{ width: '100%' }} style={{ width: '100%' }}
> >
{
(metadataIds??[]).length>0 && <div className='mb-3'>
<Select
loading={loadingTemplates}
size='small'
value={currentTemplateType}
onChange={(val) => {
setTemplateType(val)
LocalStorage.set(`templateType-${appId}`, val);
setCurrentDirId();
onSelect?.(null, null);
setTimeout(() => {
onSelect?.('', '');
getAllDirectoryAsTree(true)
}, 100)
}}
style={{ width: 100 }}
>
{
(templates??[]).map((item, index) => <Select.Option key={index} value={item.type}>{item.name}</Select.Option>)
}
</Select>
</div>
}
<Spin spinning={loading}> <Spin spinning={loading}>
<AutoComplete <AutoComplete
allowClear allowClear
......
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