Commit 346fee25 by zhaochengxiang

资产地图性能优化

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