fix: 删除用例后数量统计错误 (#4350)
Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
This commit is contained in:
parent
462838b4e8
commit
b6a11e41f7
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue