Commit d82e94fa by zhaochengxiang

资产浏览

parent 6c65ac7b
......@@ -12,6 +12,7 @@ import Map from './view/Manage/Map';
import Model from './view/Manage/Model';
import ModelConfig from './view/Manage/ModelConfig';
import AssetManage from './view/Manage/AssetManage';
import AssetResourceBrowse from './view/Manage/AssetResourceBrowse';
import AssetBrowse from './view/Manage/AssetBrowse';
import AssetRecycle from './view/Manage/AssetRecycle';
import DatasourceManage from './view/Manage/DatasourceManage';
......@@ -103,6 +104,7 @@ export class App extends React.Component {
<Route path={'/center-home/view/model-config'} component={ModelConfig} exact />
<Route path={'/center-home/view/asset-map'} component={Map} exact />
<Route path={'/center-home/view/asset-manage'} component={AssetManage} exact />
<Route path={'/center-home/view/asset-resource-browse'} component={AssetResourceBrowse} exact />
<Route path={'/center-home/view/asset-browse'} component={AssetBrowse} exact />
<Route path={'/center-home/view/asset-recycle'} component={AssetRecycle} exact />
......@@ -111,6 +113,7 @@ export class App extends React.Component {
<Route path={'/center-home/menu/model-config'} component={ModelConfig} exact />
<Route path={'/center-home/menu/asset-map'} component={Map} exact />
<Route path={'/center-home/menu/asset-manage'} component={AssetManage} exact />
<Route path={'/center-home/menu/asset-resource-browse'} component={AssetResourceBrowse} exact />
<Route path={'/center-home/menu/asset-browse'} component={AssetBrowse} exact />
<Route path={'/center-home/menu/asset-recycle'} component={AssetRecycle} exact />
<Route path={'/center-home/data-model-action'} component={EditModel} exact />
......
......@@ -72,8 +72,14 @@ export function* deleteDirectory(payload) {
export function* existDataAsset(payload) {
return yield call(service.existDataAsset, payload);
}
export function* queryAllDirectoryAsTree(payload) {
return yield call(service.queryAllDirectoryAsTree, payload);
export function* queryAllDirectoryAsTree() {
return yield call(service.queryAllDirectoryAsTree);
}
export function* queryResourceDirectoryAsTree() {
return yield call(service.queryResourceDirectoryAsTree);
}
export function* queryAssetDirectoryAsTree() {
return yield call(service.queryAssetDirectoryAsTree);
}
export function* listAllTopics(payload) {
return yield call(service.listAllTopics, payload);
......
......@@ -32,6 +32,10 @@ export const routes = [
text: '资产管理',
},
{
name: 'asset-resource-browse',
text: '资源浏览',
},
{
name: 'asset-browse',
text: '资产浏览'
},
......
......@@ -92,8 +92,16 @@ export function existDataAsset(payload) {
return GetJSON("/dataassetmanager/directoryApi/existDataAsset", payload);
}
export function queryAllDirectoryAsTree(payload) {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree", payload);
export function queryAllDirectoryAsTree() {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree");
}
export function queryResourceDirectoryAsTree() {
return PostJSON("/dataassetmanager/directoryApi/querySourceTypeAsTree");
}
export function queryAssetDirectoryAsTree() {
return PostJSON("/dataassetmanager/directoryApi/queryDataAssetTypeAsTree");
}
export function listAllTopics(payload) {
......
import { useEffect, useState } from 'react';
import { dispatch } from '../../../../model';
import Relation from './Relation';
import { AssetBrowseReference, ResourceBrowseReference } from '../../../../util/constant';
const RelationContainer = (props) => {
const { nodeParams, onChange } = props;
const { nodeParams, onChange, reference } = props;
const [ dirs, setDirs ] = useState([]);
const [ nodes, setNodes ] = useState([]);
......@@ -14,19 +14,33 @@ const RelationContainer = (props) => {
useEffect(() => {
getDirectoryData();
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
useEffect(() => {
generateNodes();
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [dirs])
useEffect(() => {
generateRelationData();
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [nodeParams])
const getDirectoryData = () => {
let url = '';
if (reference === AssetBrowseReference) {
url = 'assetmanage.queryAssetDirectoryAsTree';
} else if (reference === ResourceBrowseReference) {
url = 'assetmanage.queryResourceDirectoryAsTree';
}
dispatch({
type: 'assetmanage.queryAllDirectoryAsTree',
type: url,
callback: data => {
let newDirs = [...data];
newDirs = (newDirs||[]).filter(item => item.type!=='custom');
......@@ -124,6 +138,7 @@ const RelationContainer = (props) => {
})
setNodes(data);
generateCenterNodeRelationData(data);
}
}
......
......@@ -13,10 +13,12 @@ import './index.less';
const AssetBrowse = (props) => {
const { reference = AssetBrowseReference } = props;
const [ nodeParams, setNodeParams ] = useState({ centerId: '', expandId: '' });
const [ expandTree, setExpandTree ] = useState(true);
const { nodeId, expandId } = nodeParams;
const { centerId, expandId } = nodeParams;
const onTreeSelect = (value, type) => {
setNodeParams({ centerId: value||'', expandId: '' });
......@@ -30,6 +32,14 @@ const AssetBrowse = (props) => {
setNodeParams(data);
}
let nodeId = '';
if ((expandId||'') !== '') {
nodeId = expandId;
} else {
nodeId = centerId;
}
const classes = classNames('asset-browse', {
'asset-browse-collapse': !expandTree
});
......@@ -37,7 +47,7 @@ const AssetBrowse = (props) => {
return (
<div className={classes}>
<div className='left'>
<AssetTree onSelect={onTreeSelect} reference={AssetBrowseReference} {...props} />
<AssetTree onSelect={onTreeSelect} reference={reference} {...props} />
</div>
<div className='tree-toggle-wrap'>
<div className='tree-toggle' onClick={treeToggleClick}>
......@@ -45,12 +55,12 @@ const AssetBrowse = (props) => {
</div>
</div>
<div className='right'>
<Row>
<Row style={{ height: '100%' }}>
<Col span={12}>
<RelationContainer nodeParams={nodeParams} onChange={onRelationChange} />
<RelationContainer reference={reference} nodeParams={nodeParams} onChange={onRelationChange} />
</Col>
<Col span={12}>
<AssetTable nodeId={nodeId} reference={AssetBrowseReference} {...props} />
<AssetTable nodeId={nodeId} reference={reference} {...props} />
</Col>
</Row>
</div>
......
......@@ -82,13 +82,23 @@ const AssetTree = (props) => {
}
const getAllDirectoryAsTree = (resetCurrentDirId=true, defaultSelectedId='') => {
setLoading(true);
if (resetCurrentDirId) {
onSelect && onSelect('');
}
let url = '';
if (reference === AssetManageReference) {
url = 'assetmanage.queryAllDirectoryAsTree';
} else if (reference === AssetBrowseReference) {
url = 'assetmanage.queryAssetDirectoryAsTree';
} else if (reference === ResourceBrowseReference) {
url = 'assetmanage.queryResourceDirectoryAsTree';
}
dispatch({
type: 'assetmanage.queryAllDirectoryAsTree',
type: url,
callback: data => {
setLoading(false);
......
import React from 'react';
import AssetBrowse from '../AssetBrowse';
import { ResourceBrowseReference } from '../../../util/constant';
const AssetResourceBrowse = (props) => {
return (
<AssetBrowse reference={ResourceBrowseReference} {...props} />
)
}
export default AssetResourceBrowse;
\ No newline at end of file
......@@ -10,6 +10,7 @@ import Map from './Map';
import Model from './Model';
import ModelConfig from './ModelConfig';
import AssetManage from './AssetManage';
import AssetResourceBrowse from './AssetResourceBrowse';
import AssetBrowse from './AssetBrowse';
import AssetRecycle from './AssetRecycle';
......@@ -31,6 +32,7 @@ class Manage extends Component {
<Route path={`${match.path}/model-config`} component={ModelConfig} />
<Route path={`${match.path}/asset-map`} component={Map} />
<Route path={`${match.path}/asset-manage`} component={AssetManage} />
<Route path={`${match.path}/asset-resource-browse`} component={AssetResourceBrowse} />
<Route path={`${match.path}/asset-browse`} component={AssetBrowse} />
<Route path={`${match.path}/asset-recycle`} component={AssetRecycle} />
</Switch>
......
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