[update 拆分排序] 调整拖拽到内部,传最底层的最后一个节点的序号

This commit is contained in:
danshihao
2024-09-25 18:40:51 +08:00
parent 13c36cbd91
commit 2ffa301060
2 changed files with 19 additions and 6 deletions
@@ -406,9 +406,15 @@ export default {
const targetId = info.node.eventKey
// 序号,拖拽到节点里面,就把序号设置成最后一个节点的序号
let displaySeq = info.node.dataRef.displaySeq
const children = info.node.dataRef.children || []
let children = info.node.dataRef.children || []
// 递归拿到最内层的最后一个节点的序号
while (true) {
if (children && children.length) {
displaySeq = children[children.length - 1].displaySeq
children = children[children.length - 1].children || []
} else {
break
}
}
this.treeNodeSort({ sourceId, targetId, displaySeq })
},
@@ -134,12 +134,19 @@ export default {
const targetId = info.node.eventKey
// 序号,拖拽到节点里面,就把序号设置成最后一个节点的序号
let displaySeq = info.node.dataRef.displaySeq
const children = info.node.dataRef.children || []
let children = info.node.dataRef.children || []
// 递归拿到最内层的最后一个节点的序号
while (true) {
if (children && children.length) {
displaySeq = children[children.length - 1].displaySeq
children = children[children.length - 1].children || []
} else {
break
}
}
this.treeNodeSort({ sourceId, targetId, displaySeq })
},
// 发请求
treeNodeSort (params) {
this.confirmLoading = true