修复子数据追加错误

This commit is contained in:
lin
2026-04-20 18:56:33 +08:00
parent 36ea9e79a8
commit 87c1416e3c
2 changed files with 6 additions and 4 deletions

View File

@@ -487,12 +487,15 @@ export default {
},
nodeClickHandler: function(data, node, tree) {
console.log(data)
console.log(data.nextData.length)
console.log(this.treeLimit)
if (data && data.nextData && data.nextData.length > 0) {
const parentNode = node.parent
let nextData = data.nextData
if (nextData.length > this.treeLimit) {
let subData = nextData.splice(0, this.treeLimit)
console.log(subData)
subData.push({
treeId: '---',
deviceId: '---',
@@ -506,10 +509,9 @@ export default {
for (let item of subData) {
this.$refs.veTree.append(item, parentNode)
}
} else {
this.$refs.veTree.remove(data, parentNode)
for (let item of subData) {
for (let item of nextData) {
this.$refs.veTree.append(item, parentNode)
}
}

View File

@@ -487,7 +487,7 @@ export default {
} else {
this.$refs.veTree.remove(data, parentNode)
for (let item of subData) {
for (let item of nextData) {
this.$refs.veTree.append(item, parentNode)
}
}