|
|
@@ -498,30 +498,35 @@ var feeRateObject={
|
|
|
}
|
|
|
me.updateFeerateWhenCellsChange(changeCells);
|
|
|
},
|
|
|
- sumParentRate:function (rateID,value,updateDatas) {
|
|
|
+ sumParentRate:function (subRateID,subValue,updateDatas) {
|
|
|
let feeRate = projectObj.project.FeeRate;
|
|
|
- let rate = feeRate.getFeeRateByID(rateID);
|
|
|
- let parent = feeRate.getFeeRateByID(rate.ParentID);
|
|
|
- if(parent && parent.sum == true){
|
|
|
- let suRates = feeRate.getChildrenByID(parent.ID);
|
|
|
- let total = 0;
|
|
|
- for(let r of suRates) {
|
|
|
- let tem = r.rate ? r.rate:0;
|
|
|
- tem = scMathUtil.roundForObj(tem,getDecimal("feeRate"));
|
|
|
- if (rateID == r.ID){
|
|
|
- tem = value;
|
|
|
+ sum(subRateID,subValue);
|
|
|
+
|
|
|
+ function sum(rateID,value){
|
|
|
+ let rate = feeRate.getFeeRateByID(rateID);
|
|
|
+ let parent = feeRate.getFeeRateByID(rate.ParentID);
|
|
|
+ if(parent && parent.sum == true){
|
|
|
+ let suRates = feeRate.getChildrenByID(parent.ID);
|
|
|
+ let total = 0;
|
|
|
+ for(let r of suRates) {
|
|
|
+ let tem = r.rate ? r.rate:0;
|
|
|
+ tem = scMathUtil.roundForObj(tem,getDecimal("feeRate"));
|
|
|
+ if (rateID == r.ID){
|
|
|
+ tem = value;
|
|
|
+ }else {
|
|
|
+ let u = _.find(updateDatas,{"rateID":r.ID})//看是不是更新的过程中包含了汇总的数据
|
|
|
+ if(u && gljUtil.isDef(u.doc.rate)) tem = u.doc.rate;
|
|
|
+ }
|
|
|
+ total = scMathUtil.roundForObj(tem + total,getDecimal('process'))
|
|
|
+ }
|
|
|
+ total = scMathUtil.roundForObj(total,getDecimal("feeRate"));
|
|
|
+ let tp = _.find(updateDatas,{"rateID":parent.ID});//如果父节点也在更新列表中
|
|
|
+ if(tp){
|
|
|
+ tp.doc.rate = total
|
|
|
}else {
|
|
|
- let u = _.find(updateDatas,{"rateID":r.ID})//看是不是更新的过程中包含了汇总的数据
|
|
|
- if(u && gljUtil.isDef(u.doc.rate)) tem = u.doc.rate;
|
|
|
+ updateDatas.push({rateID:parent.ID,doc:{rate:total}});
|
|
|
}
|
|
|
- total = scMathUtil.roundForObj(tem + total,getDecimal('process'))
|
|
|
- }
|
|
|
- total = scMathUtil.roundForObj(total,getDecimal("feeRate"));
|
|
|
- let tp = _.find(updateDatas,{"rateID":parent.ID});//如果父节点也在更新列表中
|
|
|
- if(tp){
|
|
|
- tp.doc.rate = total
|
|
|
- }else {
|
|
|
- updateDatas.push({rateID:parent.ID,doc:{rate:total}});
|
|
|
+ sum(parent.ID,total);
|
|
|
}
|
|
|
}
|
|
|
|