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

调整

parent 674f4769
......@@ -14,4 +14,5 @@ export default {
DELETE_RELATION: '/node/relation',
GET_NODES: '/node/relations',
DELETE_NODE: '/node/{id}',
GET_SYSTEMS: '/systems',
}
......@@ -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,
......
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