Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
R
relation-graph
Project
Project
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
郭铭瑶
relation-graph
Commits
4ee6c475
Commit
4ee6c475
authored
Aug 16, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
674f4769
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
299 deletions
+108
-299
api.js
src/ajax/api.js
+1
-0
main.vue
src/components/main.vue
+27
-31
useD3.js
src/util/useD3.js
+80
-268
No files found.
src/ajax/api.js
View file @
4ee6c475
...
...
@@ -14,4 +14,5 @@ export default {
DELETE_RELATION
:
'/node/relation'
,
GET_NODES
:
'/node/relations'
,
DELETE_NODE
:
'/node/{id}'
,
GET_SYSTEMS
:
'/systems'
,
}
src/components/main.vue
View file @
4ee6c475
...
...
@@ -103,19 +103,6 @@ export default {
const
graphData
=
ref
({
nodes
:
[],
links
:
[]
})
const
subjectNodes
=
ref
([])
function
fetchSubjects
()
{
// ajax
// .get({
// url: api.GET_NODES,
// params: { nodeId: '572563400077869056' },
// })
// .then((res) => {
// console.log('nodes:', res)
// graphData.value = res.data.content
// systemOptions.value = graphData.value.nodes
// .filter((node) => node.nodeLabel === 'System')
// .map((node) => ({ label: node.systemName, value: node.nodeId }))
// })
ajax
.
get
({
url
:
api
.
GET_SUBJECTS
,
...
...
@@ -138,14 +125,28 @@ export default {
if
(
!
res
.
data
||
!
res
.
data
.
content
)
return
relationOptions
.
value
=
res
.
data
.
content
.
map
((
item
)
=>
({
label
:
item
.
relationName
,
value
:
item
.
id
,
value
:
item
.
id
+
''
,
}))
})
ajax
.
get
({
url
:
api
.
GET_SYSTEMS
,
})
.
then
((
res
)
=>
{
if
(
!
res
.
data
||
!
res
.
data
.
content
)
return
systemOptions
.
value
=
res
.
data
.
content
.
map
((
item
)
=>
({
label
:
item
.
systemName
,
value
:
item
.
id
+
''
,
}))
})
function
fetchSubordinates
(
params
=
null
)
{
ajax
.
get
({
url
:
api
.
GET_NODES
,
params
,
params
:
{
type
:
params
.
nodeLabel
,
nodeId
:
params
.
nodeId
,
},
})
.
then
((
res
)
=>
{
const
{
links
,
nodes
}
=
res
.
data
.
content
...
...
@@ -166,9 +167,6 @@ export default {
),
],
}
systemOptions
.
value
=
graphData
.
value
.
nodes
.
filter
((
node
)
=>
node
.
nodeLabel
===
'System'
)
.
map
((
node
)
=>
({
label
:
node
.
systemName
,
value
:
node
.
nodeId
}))
})
}
function
handleAdd
({
nodeId
})
{
...
...
@@ -197,7 +195,10 @@ export default {
},
})
.
then
(()
=>
{
fetchSubordinates
({
nodeId
:
subjectId
.
value
})
fetchSubordinates
({
nodeId
:
subjectId
.
value
,
nodeLabel
:
'Subject'
,
})
isLoading
.
value
=
false
showDrawer
.
value
=
false
message
.
success
(
'提交成功'
)
...
...
@@ -224,7 +225,6 @@ export default {
if
(
data
.
nodeLabel
===
'Subject'
)
{
fetchSubjects
()
}
else
{
// fetchSubordinates({ nodeId: data.subjectId })
graphData
.
value
=
{
nodes
:
graphData
.
value
.
nodes
.
filter
(
(
node
)
=>
node
.
id
!=
data
.
id
...
...
@@ -264,7 +264,6 @@ export default {
})
}
const
handleSearch
=
(
key
)
=>
{
console
.
log
(
key
)
if
(
!
key
)
{
fetchSubjects
()
return
...
...
@@ -276,9 +275,6 @@ export default {
})
.
then
((
res
)
=>
{
graphData
.
value
=
res
.
data
.
content
systemOptions
.
value
=
graphData
.
value
.
nodes
.
filter
((
node
)
=>
node
.
nodeLabel
===
'System'
)
.
map
((
node
)
=>
({
label
:
node
.
systemName
,
value
:
node
.
nodeId
}))
})
}
return
{
...
...
@@ -317,13 +313,13 @@ export default {
trigger
:
[
'input'
,
'blur'
],
},
],
//
systemId: [
//
{
//
required: true,
//
message: '请选择所属系统',
//
trigger: ['input', 'blur'],
//
},
//
],
systemId
:
[
{
required
:
true
,
message
:
'请选择所属系统'
,
trigger
:
[
'input'
,
'blur'
],
},
],
},
curNode
,
handleDelete
,
...
...
src/util/useD3.js
View file @
4ee6c475
This diff is collapsed.
Click to expand it.
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