|
|
@@ -77,6 +77,7 @@ let cbTools = {
|
|
|
if(this.isUnDef(exp) || exp === ''){
|
|
|
return rst;
|
|
|
}
|
|
|
+ let findChildNodes = [];//直接引用的节点,这些节点可能存在子节点,子节点才有公式,因此获取这些节点的子公式节点
|
|
|
//获取表达式中的基数和行引用
|
|
|
let figureF = cbParser.getFigureF(cbParser.getFigure(exp), cbParser.getUID(cbParser.getFIDArr(exp)));
|
|
|
//首先提取出多处引用的进行排序
|
|
|
@@ -86,35 +87,32 @@ let cbTools = {
|
|
|
let bill = this.isDef(calcBase.baseFigures[figure.value]['fixedBill']) ? calcBase.baseFigures[figure.value]['fixedBill']['bill'] : null;
|
|
|
let figureMultiRef = calcBase.baseFigures[figure.value]['multiRef'];
|
|
|
if(this.isDef(figureMultiRef)){
|
|
|
- let findChildNodes = [];
|
|
|
for(let flag of figureMultiRef){
|
|
|
let refNode = this.findBill(flag) ? this.getNodeByID(this.findBill(flag).ID) : null;
|
|
|
- if(refNode){
|
|
|
+ if(refNode && !ids.includes(refNode.data.ID)){
|
|
|
findChildNodes.push(refNode);
|
|
|
+ ids.push(refNode.data.ID);
|
|
|
}
|
|
|
}
|
|
|
- let childrenNodes = calcTools.getChildrenFormulaNodes(node, formulaNodesArr, findChildNodes);
|
|
|
- for(let cNode of childrenNodes){
|
|
|
- ids.push(cNode.data.ID);
|
|
|
- }
|
|
|
- rst = rst.concat(childrenNodes);
|
|
|
- }
|
|
|
- else if(this.isDef(bill) && ids.indexOf(bill.ID) === -1){
|
|
|
+ } else if(this.isDef(bill) && ids.indexOf(bill.ID) === -1){
|
|
|
let node = this.getNodeByID(bill.ID);
|
|
|
- if(this.isDef(node)){
|
|
|
+ if(this.isDef(node) && !ids.includes(node.data.ID)){
|
|
|
+ findChildNodes.push(node);
|
|
|
ids.push(node.data.ID);
|
|
|
- rst.push(node);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else if(figure.type === 'id'){
|
|
|
+ } else if(figure.type === 'id'){
|
|
|
let node = this.getNodeByID(figure.value);
|
|
|
- if(this.isDef(node) && ids.indexOf(node.data.ID) === -1){
|
|
|
+ if (this.isDef(node) && !ids.includes(node.data.ID)) {
|
|
|
+ findChildNodes.push(node);
|
|
|
ids.push(node.data.ID);
|
|
|
- rst.push(node);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (findChildNodes.length > 0) {
|
|
|
+ let childrenNodes = calcTools.getChildrenFormulaNodes(node, formulaNodesArr, findChildNodes);
|
|
|
+ rst = rst.concat(childrenNodes);
|
|
|
+ }
|
|
|
return rst;
|
|
|
},
|
|
|
//需要用到计算基数的时候,先找出所有的固定清单,避免每个基数都要去遍历寻找清单
|