Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
694fe1f0
Commit
694fe1f0
authored
Mar 09, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关系图没有子节点不显示操作按钮
parent
462206d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
Relation.jsx
src/view/Manage/AssetBrowse/Component/Relation.jsx
+8
-8
RelationContainer.jsx
src/view/Manage/AssetBrowse/Component/RelationContainer.jsx
+21
-1
No files found.
src/view/Manage/AssetBrowse/Component/Relation.jsx
View file @
694fe1f0
...
...
@@ -125,7 +125,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
});
//virtual功能已去掉
if
(
!
cfg
?.
virtual
)
{
if
(
!
cfg
?.
virtual
&&
cfg
?.
haveChild
)
{
const
view
=
new
(
Chart
||
window
.
Chart
)({
group
,
width
:
raduis
*
2
,
...
...
@@ -226,7 +226,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
fillOpacity
:
1.0
,
stroke
:
'#fff'
,
strokeOpacity
:
0
,
cursor
:
(
cfg
.
virtual
)?
''
:
'pointer'
,
cursor
:
(
cfg
?
.
virtual
)?
''
:
'pointer'
,
},
name
:
'innnerCircle1'
,
draggable
:
true
,
...
...
@@ -242,7 +242,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
fillOpacity
:
1.0
,
stroke
:
'#fff'
,
strokeOpacity
:
0
,
cursor
:
(
cfg
.
virtual
)?
''
:
'pointer'
,
cursor
:
(
cfg
?
.
virtual
)?
''
:
'pointer'
,
},
name
:
'innnerCircle2'
,
draggable
:
true
,
...
...
@@ -258,7 +258,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
fillOpacity
:
1.0
,
stroke
:
'#fff'
,
strokeOpacity
:
0
,
cursor
:
(
cfg
.
virtual
)?
''
:
'pointer'
,
cursor
:
(
cfg
?
.
virtual
)?
''
:
'pointer'
,
},
name
:
'innnerCircle3'
,
draggable
:
true
,
...
...
@@ -275,7 +275,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
fillOpacity
:
1.0
,
stroke
:
'#fff'
,
strokeOpacity
:
0
,
cursor
:
(
cfg
.
virtual
)?
''
:
'pointer'
,
cursor
:
(
cfg
?
.
virtual
)?
''
:
'pointer'
,
},
name
:
'innnerCircle1'
,
draggable
:
true
,
...
...
@@ -291,7 +291,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
textAlign
:
'center'
,
textBaseline
:
"middle"
,
fill
:
"#fff"
,
cursor
:
(
cfg
.
virtual
)?
''
:
'pointer'
,
cursor
:
(
cfg
?
.
virtual
)?
''
:
'pointer'
,
},
name
:
'text'
,
draggable
:
true
...
...
@@ -300,7 +300,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
return
keyShape
;
},
afterDraw
:
(
cfg
,
group
)
=>
{
if
(
!
cfg
?.
virtual
)
{
if
(
!
cfg
?.
virtual
&&
cfg
?.
haveChild
)
{
const
pathShape1
=
group
.
get
(
'children'
)[
1
];
const
pathShape2
=
group
.
get
(
'children'
)[
2
];
const
pathShape3
=
group
.
get
(
'children'
)[
3
];
...
...
@@ -313,7 +313,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
setState
(
name
,
value
,
item
)
{
const
model
=
item
?.
getModel
();
if
(
!
model
?.
virtual
)
{
if
(
!
model
?.
virtual
&&
model
?.
haveChild
)
{
const
group
=
item
.
getContainer
();
const
keyShape
=
group
.
get
(
'children'
)[
0
];
...
...
src/view/Manage/AssetBrowse/Component/RelationContainer.jsx
View file @
694fe1f0
...
...
@@ -79,11 +79,31 @@ const RelationContainer = (props) => {
recursion
(
centerDirectory
.
children
||
[],
centerDirectory
.
nodeId
,
'0'
);
//判断是否有子节点
newNodes
.
forEach
(
node
=>
{
const
index
=
newNodes
.
findIndex
(
_node
=>
_node
.
levelId
===
`
${
node
.
levelId
}
-0`
);
node
.
haveChild
=
(
index
!==-
1
);
})
setNodes
(
newNodes
);
generateCenterNodeRelationData
(
newNodes
);
}
}
const
judgeNodeHaveChild
=
(
node
,
data
=
nodes
)
=>
{
let
nodeLevelId
=
`
${
node
.
levelId
}
-`
;
(
data
||
[]).
forEach
(
item
=>
{
if
(
node
.
levelId
.
split
(
'-'
).
length
<
item
.
levelId
.
split
(
'-'
).
length
&&
item
.
levelId
.
slice
(
0
,
nodeLevelId
.
length
)
===
nodeLevelId
)
{
return
true
;
}
});
return
false
;
}
const
generateCenterNodeRelationData
=
(
data
=
nodes
)
=>
{
if
((
data
||
[]).
length
===
0
)
{
setRelationData
(
null
);
...
...
@@ -95,7 +115,7 @@ const RelationContainer = (props) => {
let
rootNode
=
data
[
index
];
let
totalLevel
=
1
;
rootNode
=
{...
rootNode
,
center
:
true
};
rootNode
=
{...
rootNode
,
center
:
true
};
let
newRelationData
=
{...
rootNode
,
children
:
[]};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment