Commit 346fee25 by zhaochengxiang

资产地图性能优化

parent d0a3ee91
...@@ -48,7 +48,8 @@ const AssetMount = (props) => { ...@@ -48,7 +48,8 @@ const AssetMount = (props) => {
> >
<AssetTree <AssetTree
readOnly={true} readOnly={true}
onSelect={(value) => setNodeId(value) } onSelect={(value) => setNodeId(value) }
{...props}
/> />
</Modal> </Modal>
) )
......
...@@ -231,6 +231,7 @@ const AssetRecycle = (props) => { ...@@ -231,6 +231,7 @@ const AssetRecycle = (props) => {
visible={ assetMountVisible } visible={ assetMountVisible }
id={ currentAssetId } id={ currentAssetId }
onCancel={ onAssetMountCancel } onCancel={ onAssetMountCancel }
{...props}
/> />
{contextHolder} {contextHolder}
</div> </div>
......
...@@ -62,6 +62,7 @@ class Org extends React.Component { ...@@ -62,6 +62,7 @@ class Org extends React.Component {
textAlign: 'left', textAlign: 'left',
textBaseline: 'middle', textBaseline: 'middle',
text: (cfg.label||''), text: (cfg.label||''),
cursor: 'pointer',
} }
}); });
...@@ -77,6 +78,7 @@ class Org extends React.Component { ...@@ -77,6 +78,7 @@ class Org extends React.Component {
symbol: EXPAND_ICON, symbol: EXPAND_ICON,
stroke: '#73d13d', stroke: '#73d13d',
lineWidth: 2, lineWidth: 2,
cursor: 'pointer',
} }
}); });
} else if ((cfg.children||[]).length>0) { } else if ((cfg.children||[]).length>0) {
...@@ -88,6 +90,7 @@ class Org extends React.Component { ...@@ -88,6 +90,7 @@ class Org extends React.Component {
symbol: cfg.collapsed ? EXPAND_ICON : COLLAPSE_ICON, symbol: cfg.collapsed ? EXPAND_ICON : COLLAPSE_ICON,
stroke: cfg.collapsed ? '#73d13d' : '#ff4d4f', stroke: cfg.collapsed ? '#73d13d' : '#ff4d4f',
lineWidth: 2, lineWidth: 2,
cursor: 'pointer',
} }
}); });
} }
...@@ -255,14 +258,13 @@ class Org extends React.Component { ...@@ -255,14 +258,13 @@ class Org extends React.Component {
const model = node.getModel(); const model = node.getModel();
if (model.dbType==='Dir') { if (model.dbType==='Root' || model.dbType==='Dir') {
const children = model.children; const children = model.children;
if (!children && loadMoreData) { if (!children && loadMoreData) {
loadMoreData(model.dirId||'', nodeId); loadMoreData(model.dirId||'', nodeId);
} }
} else if (model.dbType !== 'Root') { } else if (model.dbType === 'Table') {
//通过资产id跳转到资产详情页
// history && history.push(`${ContextPath}/home`);
} }
}); });
......
...@@ -11,7 +11,6 @@ const colors = [ ...@@ -11,7 +11,6 @@ const colors = [
'from-cyan-400 to-lightBlue-500', 'from-cyan-400 to-lightBlue-500',
'from-green-400 to-cyan-500', 'from-green-400 to-cyan-500',
'from-yellow-400 to-orange-500', 'from-yellow-400 to-orange-500',
'from-light-blue-400 to-indigo-500',
]; ];
class SquareItem extends React.Component { class SquareItem extends React.Component {
......
...@@ -4,14 +4,9 @@ ...@@ -4,14 +4,9 @@
color: #fff !important; color: #fff !important;
font-size: 20px !important; font-size: 20px !important;
font-weight: bold !important; font-weight: bold !important;
// :hover {
// color: #1890ff;
// }
} }
.yy-card-body { .yy-card-body {
// color: #1890ff !important;
font-size: 18px !important; font-size: 18px !important;
height: 76px !important; height: 76px !important;
} }
......
...@@ -8,7 +8,7 @@ import Tree from './Component/Tree'; ...@@ -8,7 +8,7 @@ import Tree from './Component/Tree';
import Relation from './Component/Relation'; import Relation from './Component/Relation';
import { dispatch, dispatchLatest } from '../../../model'; import { dispatch, dispatchLatest } from '../../../model';
const column = 3; const column = 4;
class MapContent extends React.Component { class MapContent extends React.Component {
...@@ -92,6 +92,10 @@ class MapContent extends React.Component { ...@@ -92,6 +92,10 @@ class MapContent extends React.Component {
item.id = `t${parentDirId}${item.id || ''}${index}`; item.id = `t${parentDirId}${item.id || ''}${index}`;
} }
if (index === 10) {
item.text = '点击加载更多';
}
if (item.children) { if (item.children) {
this.convertRemoteData(item.children, item.dirId || ''); this.convertRemoteData(item.children, item.dirId || '');
} }
...@@ -103,9 +107,10 @@ class MapContent extends React.Component { ...@@ -103,9 +107,10 @@ class MapContent extends React.Component {
return { return {
text: topic.name || '', text: topic.name || '',
dirId: topic.id,
id: `t${topic.id}`, id: `t${topic.id}`,
dbType: 'Root', dbType: 'Root',
children: data children: (data||[]).length===0 ? null : data
}; };
} }
...@@ -171,13 +176,6 @@ class MapContent extends React.Component { ...@@ -171,13 +176,6 @@ class MapContent extends React.Component {
const { type, topic, switchMode } = this.props; const { type, topic, switchMode } = this.props;
const { curTableModelData, breadcrumbContents, orgModelData, treeModelData, relationModelData, orgChildData, treeChildData, relationChildData, parentNodeId, currentLevel, totalLevel } = this.state; const { curTableModelData, breadcrumbContents, orgModelData, treeModelData, relationModelData, orgChildData, treeChildData, relationChildData, parentNodeId, currentLevel, totalLevel } = this.state;
let groups = [];
if (curTableModelData) {
for (var i = 0; i < curTableModelData.length; i += column) {
groups.push(curTableModelData.slice(i, i + column));
}
}
if (type === 'square') { if (type === 'square') {
return ( return (
<div className='position-relative p-3 from-blueGray-200 bg-gradient-to-b' style={{ height: '100%' }}> <div className='position-relative p-3 from-blueGray-200 bg-gradient-to-b' style={{ height: '100%' }}>
...@@ -207,30 +205,20 @@ class MapContent extends React.Component { ...@@ -207,30 +205,20 @@ class MapContent extends React.Component {
{switchMode} {switchMode}
</div> </div>
</div> </div>
<Row gutter={10}>
{ {
groups && groups.map((group, index) => { curTableModelData && curTableModelData.map((item, index) => {
return ( return (
<div key={index}> <Col className='mt-3' key={index} xs={24} md={8} lg={6}>
<Row gutter={10} className={index === 0 ? '' : 'mt-3'}> <SquareItem item={item} index={index} onClick={this.onSquareItemClick} {...this.props} />
{ </Col>
group && group.map((item, _index) => {
return (
<Col key={_index} xs={24} md={8} lg={6} //span={24 / column}
>
<SquareItem item={item} index={(index * column + _index)} onClick={this.onSquareItemClick} {...this.props} />
</Col>
)
})
}
</Row>
{ (index === groups.length - 1) && <div style={{ height: 10 }} />}
</div>
) )
}) })
} }
</Row>
<div style={{ height: 10 }} />
</> </>
} }
</div> </div>
); );
} else { } else {
......
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