master
面包骑士 2024-08-30 21:31:28 +08:00
parent 1f0323ac39
commit 735c661936
1 changed files with 31 additions and 10 deletions

View File

@ -96,6 +96,7 @@ export default {
const rows = res.data.rows
for (let i = 0; i < rows.length; i++) {
const r = flowNode.methods.toJsPlumbNode(rows[i])
//
this.data.nodeList.push({
id: r.node.id,
type: r.node.type,
@ -104,6 +105,7 @@ export default {
top: r.node.top,
left: r.node.left
})
// 线
if (r.line) {
r.line.forEach(v => {
this.data.lineList.push({
@ -116,6 +118,16 @@ export default {
})
}
}
//
this.nodeHandle()
// 线
this.data.lineList = this.lineHandle(this.data.lineList)
})
this.flag = true
},
// -
nodeHandle() {
//
this.data.nodeList.forEach(node => {
nodeTypeList.forEach(v => {
if (node.type === v.type) {
@ -125,14 +137,23 @@ export default {
}
})
})
})
this.flag = true
},
// 线
lineHandle(lineList) {
let map = new Map();
lineList.forEach(item => {
const key = item.from + '->' + item.to;
if (!map.has(key)) {
map.set(key, item);
}
});
return Array.from(map.values());
},
//
save() {
// 1. 线
const nodeList = this.data.nodeList
const lineList = this.data.lineList
const lineList = this.lineHandle(this.data.lineList)
console.log(this.data)
// 2. ,jsPlumb ==>
const nodeData = []