|
@@ -1238,14 +1238,17 @@ function getCommonTotalFee(bills) {
|
|
|
function summarizeToParent(parent, child, flagFieldMapping) {
|
|
function summarizeToParent(parent, child, flagFieldMapping) {
|
|
|
const decimal = -2;
|
|
const decimal = -2;
|
|
|
let costFields = [];
|
|
let costFields = [];
|
|
|
- for (let flag in flagFieldMapping) {
|
|
|
|
|
- let costItems = flagFieldMapping[flag];
|
|
|
|
|
- for (let costItem of costItems) {
|
|
|
|
|
- costFields.push(costItem.name);
|
|
|
|
|
|
|
+ //删除相关的逻辑或哪里有bug出现parent被删除,child还没有被标记为删除状态,这时,parent会为undefine 这时就会报错
|
|
|
|
|
+ if(parent && child){
|
|
|
|
|
+ for (let flag in flagFieldMapping) {
|
|
|
|
|
+ let costItems = flagFieldMapping[flag];
|
|
|
|
|
+ for (let costItem of costItems) {
|
|
|
|
|
+ costFields.push(costItem.name);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for (let field of costFields) {
|
|
|
|
|
+ parent[field] = scMathUtil.roundTo(parseFloat(parent[field]) + parseFloat(child[field]), decimal);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- for (let field of costFields) {
|
|
|
|
|
- parent[field] = scMathUtil.roundTo(parseFloat(parent[field]) + parseFloat(child[field]), decimal);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|