Commit 4ee6c475 authored by 郭铭瑶's avatar 郭铭瑶 🤘

调整

parent 674f4769
...@@ -14,4 +14,5 @@ export default { ...@@ -14,4 +14,5 @@ export default {
DELETE_RELATION: '/node/relation', DELETE_RELATION: '/node/relation',
GET_NODES: '/node/relations', GET_NODES: '/node/relations',
DELETE_NODE: '/node/{id}', DELETE_NODE: '/node/{id}',
GET_SYSTEMS: '/systems',
} }
...@@ -103,19 +103,6 @@ export default { ...@@ -103,19 +103,6 @@ export default {
const graphData = ref({ nodes: [], links: [] }) const graphData = ref({ nodes: [], links: [] })
const subjectNodes = ref([]) const subjectNodes = ref([])
function fetchSubjects() { 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 ajax
.get({ .get({
url: api.GET_SUBJECTS, url: api.GET_SUBJECTS,
...@@ -138,14 +125,28 @@ export default { ...@@ -138,14 +125,28 @@ export default {
if (!res.data || !res.data.content) return if (!res.data || !res.data.content) return
relationOptions.value = res.data.content.map((item) => ({ relationOptions.value = res.data.content.map((item) => ({
label: item.relationName, 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) { function fetchSubordinates(params = null) {
ajax ajax
.get({ .get({
url: api.GET_NODES, url: api.GET_NODES,
params, params: {
type: params.nodeLabel,
nodeId: params.nodeId,
},
}) })
.then((res) => { .then((res) => {
const { links, nodes } = res.data.content const { links, nodes } = res.data.content
...@@ -166,9 +167,6 @@ export default { ...@@ -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 }) { function handleAdd({ nodeId }) {
...@@ -197,7 +195,10 @@ export default { ...@@ -197,7 +195,10 @@ export default {
}, },
}) })
.then(() => { .then(() => {
fetchSubordinates({ nodeId: subjectId.value }) fetchSubordinates({
nodeId: subjectId.value,
nodeLabel: 'Subject',
})
isLoading.value = false isLoading.value = false
showDrawer.value = false showDrawer.value = false
message.success('提交成功') message.success('提交成功')
...@@ -224,7 +225,6 @@ export default { ...@@ -224,7 +225,6 @@ export default {
if (data.nodeLabel === 'Subject') { if (data.nodeLabel === 'Subject') {
fetchSubjects() fetchSubjects()
} else { } else {
// fetchSubordinates({ nodeId: data.subjectId })
graphData.value = { graphData.value = {
nodes: graphData.value.nodes.filter( nodes: graphData.value.nodes.filter(
(node) => node.id != data.id (node) => node.id != data.id
...@@ -264,7 +264,6 @@ export default { ...@@ -264,7 +264,6 @@ export default {
}) })
} }
const handleSearch = (key) => { const handleSearch = (key) => {
console.log(key)
if (!key) { if (!key) {
fetchSubjects() fetchSubjects()
return return
...@@ -276,9 +275,6 @@ export default { ...@@ -276,9 +275,6 @@ export default {
}) })
.then((res) => { .then((res) => {
graphData.value = res.data.content graphData.value = res.data.content
systemOptions.value = graphData.value.nodes
.filter((node) => node.nodeLabel === 'System')
.map((node) => ({ label: node.systemName, value: node.nodeId }))
}) })
} }
return { return {
...@@ -317,13 +313,13 @@ export default { ...@@ -317,13 +313,13 @@ export default {
trigger: ['input', 'blur'], trigger: ['input', 'blur'],
}, },
], ],
// systemId: [ systemId: [
// { {
// required: true, required: true,
// message: '请选择所属系统', message: '请选择所属系统',
// trigger: ['input', 'blur'], trigger: ['input', 'blur'],
// }, },
// ], ],
}, },
curNode, curNode,
handleDelete, handleDelete,
......
This diff is collapsed.
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