Commit 1d1e6ff3 by zhaochengxiang

资产浏览增加目录信息

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