Commit d82e94fa by zhaochengxiang

资产浏览

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