Commit 1d1e6ff3 by zhaochengxiang

资产浏览增加目录信息

parent c530e109
...@@ -19,7 +19,7 @@ class Relation extends React.Component { ...@@ -19,7 +19,7 @@ class Relation extends React.Component {
// } // }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
const { data, onCenterClick, onExpandClick } = this.props; const { data, expandTree, onCenterClick, onExpandClick } = this.props;
if (data) { if (data) {
...@@ -30,6 +30,11 @@ class Relation extends React.Component { ...@@ -30,6 +30,11 @@ class Relation extends React.Component {
this.graph = init(this)(this.elem, newData, onCenterClick, onExpandClick); this.graph = init(this)(this.elem, newData, onCenterClick, onExpandClick);
} }
} }
if (expandTree !== prevProps.expandTree && prevProps.expandTree!==null) {
if (!this.elem || !this.elem.scrollWidth || !this.elem.scrollHeight) return;
this.graph?.changeSize(this.elem.scrollWidth, this.elem.scrollHeight);
}
} }
......
...@@ -6,7 +6,7 @@ import { AssetBrowseReference, ResourceBrowseReference } from '../../../../util/ ...@@ -6,7 +6,7 @@ import { AssetBrowseReference, ResourceBrowseReference } from '../../../../util/
const RelationContainer = (props) => { const RelationContainer = (props) => {
const { nodeParams, onChange, reference } = props; const { nodeParams, onChange, reference, expandTree } = props;
const [ dirs, setDirs ] = useState([]); const [ dirs, setDirs ] = useState([]);
const [ nodes, setNodes ] = useState([]); const [ nodes, setNodes ] = useState([]);
...@@ -178,7 +178,7 @@ const RelationContainer = (props) => { ...@@ -178,7 +178,7 @@ const RelationContainer = (props) => {
return ( return (
<div style={{ width: '100%', height: '100%' }}> <div style={{ width: '100%', height: '100%' }}>
<Relation data={relationData} onCenterClick={onCenterClick} onExpandClick={onExpandClick} /> <Relation data={relationData} expandTree={expandTree} onCenterClick={onCenterClick} onExpandClick={onExpandClick} />
</div> </div>
); );
} }
......
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Row, Col } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons'; import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
import AssetTree from '../AssetManage/Component/AssetTree'; import AssetTree from '../AssetManage/Component/AssetTree';
import AssetDirectory from '../AssetManage/Component/AssetDirectory';
import RelationContainer from './Component/RelationContainer'; import RelationContainer from './Component/RelationContainer';
import AssetTable from "../AssetManage/Component/AssetTable"; import AssetTable from "../AssetManage/Component/AssetTable";
...@@ -17,6 +17,7 @@ const AssetBrowse = (props) => { ...@@ -17,6 +17,7 @@ const AssetBrowse = (props) => {
const [ nodeParams, setNodeParams ] = useState({ centerId: '', expandId: '' }); const [ nodeParams, setNodeParams ] = useState({ centerId: '', expandId: '' });
const [ expandTree, setExpandTree ] = useState(true); const [ expandTree, setExpandTree ] = useState(true);
const [ assetCount, setAssetCount ] = useState(0);
const { centerId, expandId } = nodeParams; const { centerId, expandId } = nodeParams;
...@@ -32,6 +33,10 @@ const AssetBrowse = (props) => { ...@@ -32,6 +33,10 @@ const AssetBrowse = (props) => {
setNodeParams(data); setNodeParams(data);
} }
const onAssetCountChange = (count) => {
setAssetCount(count);
}
let nodeId = ''; let nodeId = '';
if ((expandId||'') !== '') { if ((expandId||'') !== '') {
nodeId = expandId; nodeId = expandId;
...@@ -54,14 +59,15 @@ const AssetBrowse = (props) => { ...@@ -54,14 +59,15 @@ const AssetBrowse = (props) => {
</div> </div>
</div> </div>
<div className='right'> <div className='right'>
<Row style={{ height: '100%' }}> <AssetDirectory id={nodeId} assetCount={assetCount} reference={reference} />
<Col span={12}> <div className='flex' style={{ height: '100%' }}>
<RelationContainer reference={reference} nodeParams={nodeParams} onChange={onRelationChange} /> <div style={{ width: '50%', height: '100%' }}>
</Col> <RelationContainer reference={reference} nodeParams={nodeParams} onChange={onRelationChange} expandTree={expandTree} />
<Col span={12}> </div>
<AssetTable nodeId={nodeId} reference={reference} {...props} /> <div style={{ width: '50%' }}>
</Col> <AssetTable nodeId={nodeId} reference={reference} onCountChange={onAssetCountChange} {...props} />
</Row> </div>
</div>
</div> </div>
</div> </div>
) )
......
...@@ -2,11 +2,12 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,11 +2,12 @@ import React, { useEffect, useState } from 'react';
import { Space, Spin, Tooltip } from 'antd'; import { Space, Spin, Tooltip } from 'antd';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { AssetManageReference } from '../../../../util/constant';
import record from '../../../../assets/record.png'; import record from '../../../../assets/record.png';
const AssetDirectory = (props) => { const AssetDirectory = (props) => {
const { id, directoryChanged, assetCount } = props; const { id, directoryChanged, assetCount, reference = AssetManageReference } = props;
const [ dir, setDir ] = useState(null); const [ dir, setDir ] = useState(null);
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
...@@ -57,7 +58,9 @@ const AssetDirectory = (props) => { ...@@ -57,7 +58,9 @@ const AssetDirectory = (props) => {
<Tooltip title={`${dir?(dir.remark||''):''}`}> <Tooltip title={`${dir?(dir.remark||''):''}`}>
<div className='textOverflow'>{`描述: ${dir?(dir.desc||''):''}`}</div> <div className='textOverflow'>{`描述: ${dir?(dir.desc||''):''}`}</div>
</Tooltip> </Tooltip>
<div>{`备注: ${dir?(dir.remarks||''):''}`}</div> {
(reference === AssetManageReference) && <div>{`备注: ${dir?(dir.remarks||''):''}`}</div>
}
</div> </div>
<div <div
className='flex' className='flex'
......
...@@ -384,7 +384,7 @@ const AssetTable = (props) => { ...@@ -384,7 +384,7 @@ const AssetTable = (props) => {
} else if (reference===AssetManageReference) { } else if (reference===AssetManageReference) {
scrollY = 'calc(100vh - 182px - 52px - 52px - 84px - 12px)'; scrollY = 'calc(100vh - 182px - 52px - 52px - 84px - 12px)';
} else if (reference===AssetBrowseReference||reference===ResourceBrowseReference) { } else if (reference===AssetBrowseReference||reference===ResourceBrowseReference) {
scrollY = 'calc(100vh - 182px - 52px - 12px)'; scrollY = 'calc(100vh - 182px - 84px - 52px - 12px)';
} else if (reference===AssetRecycleReference) { } else if (reference===AssetRecycleReference) {
scrollY = 'calc(100vh - 182px - 52px - 12px)'; scrollY = 'calc(100vh - 182px - 52px - 12px)';
} }
......
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