diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue index 16a6278220..4eeadc0b2f 100644 --- a/frontend/src/business/components/track/common/NodeTree.vue +++ b/frontend/src/business/components/track/common/NodeTree.vue @@ -210,22 +210,28 @@ export default { if (node.caseNum) { node.caseNum++; } - }); + }, true); + if (this.extendTreeNodes[0].id === 'root') { + this.extendTreeNodes[0].caseNum++; + } }, decrease(id) { this.traverse(id, node => { if (node.caseNum) { node.caseNum--; } - }); - }, - traverse(id, callback) { - for (let i = 0; i < this.treeNodes.length; i++) { - let rootNode = this.treeNodes[i]; - this._traverse(rootNode, id, callback); + }, true); + if (this.extendTreeNodes[0].id === 'root') { + this.extendTreeNodes[0].caseNum--; } }, - _traverse(rootNode, id, callback) { + traverse(id, callback, isParentCallback) { + for (let i = 0; i < this.treeNodes.length; i++) { + let rootNode = this.treeNodes[i]; + this._traverse(rootNode, id, callback, isParentCallback); + } + }, + _traverse(rootNode, id, callback, isParentCallback) { if (rootNode.id === id) { if (callback) { callback(rootNode); @@ -235,8 +241,11 @@ export default { if (!rootNode.children) {return false;} for (let i = 0; i < rootNode.children.length; i++) { let children = rootNode.children[i]; - let result = this._traverse(children); + let result = this._traverse(children, id, callback, isParentCallback); if (result === true) { + if (isParentCallback) { + callback(rootNode); + } return result; } }