|  | @@ -229,22 +229,6 @@ let nodeTools = {
 | 
	
		
			
				|  |  |              return treeNodeCalcType.ctRationCalcProgram;
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    // 界面显示的结点的工程量的数值。
 | 
	
		
			
				|  |  | -    uiQuantity: function (treeNode){
 | 
	
		
			
				|  |  | -        return parseFloatPlus(treeNode.data.quantity).toDecimal(decimalObj.decimal("quantity", treeNode));
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    // 界面显示的工料机价格,包括定额价、市场价等。参数 price 传入一个普通的价格数值即可。
 | 
	
		
			
				|  |  | -    uiGLJPrice: function (price){
 | 
	
		
			
				|  |  | -        if (price)
 | 
	
		
			
				|  |  | -            return parseFloat(price).toDecimal(decimalObj.glj.unitPrice)
 | 
	
		
			
				|  |  | -        else return 0;
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    // 界面显示的工料机数量。参数 quantity 传入一个普通的数量数值即可。
 | 
	
		
			
				|  |  | -    uiGLJQuantity: function (quantity){
 | 
	
		
			
				|  |  | -        if (quantity)
 | 
	
		
			
				|  |  | -            return parseFloat(quantity).toDecimal(decimalObj.glj.quantity)
 | 
	
		
			
				|  |  | -        else return 0;
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 参数fieldName值: 'common.totalFee'、'equipment.unitFee'
 | 
	
		
			
				|  |  |      getFee: function (treeNode, fieldName) {
 | 
	
	
		
			
				|  | @@ -263,126 +247,55 @@ let nodeTools = {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getNodeByID: function (ID){
 | 
	
		
			
				|  |  |          return cbTools.getNodeByID(ID);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    getRationBaseFee: function (treeNode, gljTypes, priceType){
 | 
	
		
			
				|  |  | -    if (!treeNode.data.gljList) return 0;
 | 
	
		
			
				|  |  | -    let result = 0;
 | 
	
		
			
				|  |  | -    let me = this;
 | 
	
		
			
				|  |  | -    for (let glj of treeNode.data.gljList) {
 | 
	
		
			
				|  |  | -        let price = 0, temp = 0;
 | 
	
		
			
				|  |  | -        if (gljTypes.indexOf(glj.type) >= 0) {
 | 
	
		
			
				|  |  | -            if (priceType == priceTypes.ptDiffPrice){
 | 
	
		
			
				|  |  | -                let aprice = me.uiGLJPrice(glj["adjustPrice"]);
 | 
	
		
			
				|  |  | -                let mprice = me.uiGLJPrice(glj["marketPrice"]);
 | 
	
		
			
				|  |  | -                temp = (me.uiGLJQuantity(glj["quantity"]) * mprice).toDecimal(decimalObj.ration.unitPrice) - (me.uiGLJQuantity(glj["quantity"]) * aprice).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | -                temp = temp.toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            else {
 | 
	
		
			
				|  |  | -                if (priceType == priceTypes.ptBasePrice){ price = me.uiGLJPrice(glj["basePrice"]);}
 | 
	
		
			
				|  |  | -                else if (priceType == priceTypes.ptAdjustPrice){price = me.uiGLJPrice(glj["adjustPrice"]);}
 | 
	
		
			
				|  |  | -                else if (priceType == priceTypes.ptMarketPrice){price = me.uiGLJPrice(glj["marketPrice"]);}
 | 
	
		
			
				|  |  | -                temp = (me.uiGLJQuantity(glj["quantity"]) * price).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            result = (result + temp).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -    };
 | 
	
		
			
				|  |  | -    return result;
 | 
	
		
			
				|  |  | -},
 | 
	
		
			
				|  |  | -    calcEstimateFee: function (treeNode, isBase = false){
 | 
	
		
			
				|  |  | -    let me = this, sumU = 0, sumT = 0;
 | 
	
		
			
				|  |  | -    // 父清单暂估费的汇总计算走计算程序逻辑,不在这里。
 | 
	
		
			
				|  |  | -    if (nodeTools.isTotalCostBill(treeNode)){
 | 
	
		
			
				|  |  | -        let nodes = projectObj.project.mainTree.roots;
 | 
	
		
			
				|  |  | -        for (let node of nodes){
 | 
	
		
			
				|  |  | -            if (nodeTools.isTotalCostBill(node)) break;
 | 
	
		
			
				|  |  | -            let eU = 0, eT = 0;
 | 
	
		
			
				|  |  | -            if (node.data.feesIndex && node.data.feesIndex.estimate){
 | 
	
		
			
				|  |  | -                eU = node.data.feesIndex.estimate.unitFee;
 | 
	
		
			
				|  |  | -                eT = node.data.feesIndex.estimate.totalFee;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            else {
 | 
	
		
			
				|  |  | -                eU = 0, eT = 0;
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -            sumU = (sumU + parseFloatPlus(eU)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -            sumT = (sumT + parseFloatPlus(eT)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -        sumU = (sumU).toDecimal(decimalObj.bills.unitPrice);
 | 
	
		
			
				|  |  | -        sumT = (sumT).toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    else{
 | 
	
		
			
				|  |  | -        if (!treeNode.data.gljList) return;
 | 
	
		
			
				|  |  | -        let GLJObjs = [];
 | 
	
		
			
				|  |  | -        for (let glj of treeNode.data.gljList) {
 | 
	
		
			
				|  |  | -            if (allMaterialTypes.indexOf(glj.type) >= 0) {
 | 
	
		
			
				|  |  | -                if (glj.isEstimate){
 | 
	
		
			
				|  |  | -                    GLJObjs.push({code: glj.code, name: glj.name, specs: glj.specs, unit: glj.unit, type: glj.type,
 | 
	
		
			
				|  |  | -                        quantity: glj.quantity, marketPrice: glj.marketPrice});
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                else{   // 组成物
 | 
	
		
			
				|  |  | -                    if (compositionTypes.indexOf(glj.type) >= 0){
 | 
	
		
			
				|  |  | -                        let mds = projectObj.project.composition.getCompositionByGLJ(glj);
 | 
	
		
			
				|  |  | -                        if (!mds) mds = [];
 | 
	
		
			
				|  |  | -                        for (let md of mds){
 | 
	
		
			
				|  |  | -                            if (md.isEstimate){
 | 
	
		
			
				|  |  | -                                let isExist = false;
 | 
	
		
			
				|  |  | -                                let mdQ = (me.uiGLJQuantity(glj.quantity) * me.uiGLJQuantity(md.consumption)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                                for (let obj of GLJObjs){
 | 
	
		
			
				|  |  | -                                    if (gljOprObj.getIndex(md, gljKeyArray) == gljOprObj.getIndex(obj, gljKeyArray)){
 | 
	
		
			
				|  |  | -                                        isExist = true;
 | 
	
		
			
				|  |  | -                                        obj.quantity = (me.uiGLJQuantity(obj.quantity) + mdQ).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -                                        break;
 | 
	
		
			
				|  |  | -                                    }
 | 
	
		
			
				|  |  | -                                };
 | 
	
		
			
				|  |  | -                                if (!isExist)
 | 
	
		
			
				|  |  | -                                    GLJObjs.push({code: md.code, name: md.name, specs: md.specs, unit: md.unit, type: md.type,
 | 
	
		
			
				|  |  | -                                        quantity: mdQ, marketPrice: md.marketPrice});
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        for (let obj of GLJObjs){
 | 
	
		
			
				|  |  | -            sumU = sumU + (me.uiGLJQuantity(obj.quantity) * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -            sumU = sumU.toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            let q = (me.uiGLJQuantity(obj.quantity) * me.uiQuantity(treeNode)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -            sumT = sumT + (q * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -            sumT = sumT.toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -        sumU = sumU.toDecimal(decimalObj.bills.unitPrice);
 | 
	
		
			
				|  |  | -        if (projectObj.project.property.zanguCalcMode == zanguCalcType.common){
 | 
	
		
			
				|  |  | -            sumT = (nodeTools.uiQuantity(treeNode) * sumU).toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        else if (projectObj.project.property.zanguCalcMode == zanguCalcType.gatherMaterial){
 | 
	
		
			
				|  |  | -            sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -    };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    if (isBase)
 | 
	
		
			
				|  |  | -        return sumU
 | 
	
		
			
				|  |  | -    else
 | 
	
		
			
				|  |  | -        nodeTools.checkFeeField(treeNode, {'fieldName': 'estimate', 'unitFee': sumU, 'totalFee': sumT});
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const rationCalcBaser = {
 | 
	
		
			
				|  |  | -    '定额基价人工费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +let assistCalcer = {
 | 
	
		
			
				|  |  | +    // 界面显示的结点的工程量的数值。
 | 
	
		
			
				|  |  | +    uiQuantity: function (treeNode){
 | 
	
		
			
				|  |  | +        return parseFloatPlus(treeNode.data.quantity).toDecimal(decimalObj.decimal("quantity", treeNode));
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    '定额基价材料费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, baseMaterialTypes, priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +    // 界面显示的工料机价格,包括定额价、市场价等。参数 price 传入一个普通的价格数值即可。
 | 
	
		
			
				|  |  | +    uiGLJPrice: function (price){
 | 
	
		
			
				|  |  | +        if (price)
 | 
	
		
			
				|  |  | +            return parseFloat(price).toDecimal(decimalObj.glj.unitPrice)
 | 
	
		
			
				|  |  | +        else return 0;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    '定额基价机械费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.GENERAL_MACHINE], priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +    // 界面显示的工料机数量。参数 quantity 传入一个普通的数量数值即可。
 | 
	
		
			
				|  |  | +    uiGLJQuantity: function (quantity){
 | 
	
		
			
				|  |  | +        if (quantity)
 | 
	
		
			
				|  |  | +            return parseFloat(quantity).toDecimal(decimalObj.glj.quantity)
 | 
	
		
			
				|  |  | +        else return 0;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    '定额基价机上人工费': function machineLabourFee(node) {
 | 
	
		
			
				|  |  | -        if (!node.data.gljList) return 0;
 | 
	
		
			
				|  |  | +    rationBaseFee: function (treeNode, gljTypes, priceType){
 | 
	
		
			
				|  |  | +        if (!treeNode.data.gljList) return 0;
 | 
	
		
			
				|  |  | +        let result = 0;
 | 
	
		
			
				|  |  | +        let me = this;
 | 
	
		
			
				|  |  | +        for (let glj of treeNode.data.gljList) {
 | 
	
		
			
				|  |  | +            let price = 0, temp = 0;
 | 
	
		
			
				|  |  | +            if (gljTypes.indexOf(glj.type) >= 0) {
 | 
	
		
			
				|  |  | +                if (priceType == priceTypes.ptDiffPrice){
 | 
	
		
			
				|  |  | +                    let aprice = me.uiGLJPrice(glj["adjustPrice"]);
 | 
	
		
			
				|  |  | +                    let mprice = me.uiGLJPrice(glj["marketPrice"]);
 | 
	
		
			
				|  |  | +                    temp = (me.uiGLJQuantity(glj["quantity"]) * mprice).toDecimal(decimalObj.ration.unitPrice) - (me.uiGLJQuantity(glj["quantity"]) * aprice).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | +                    temp = temp.toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else {
 | 
	
		
			
				|  |  | +                    if (priceType == priceTypes.ptBasePrice){ price = me.uiGLJPrice(glj["basePrice"]);}
 | 
	
		
			
				|  |  | +                    else if (priceType == priceTypes.ptAdjustPrice){price = me.uiGLJPrice(glj["adjustPrice"]);}
 | 
	
		
			
				|  |  | +                    else if (priceType == priceTypes.ptMarketPrice){price = me.uiGLJPrice(glj["marketPrice"]);}
 | 
	
		
			
				|  |  | +                    temp = (me.uiGLJQuantity(glj["quantity"]) * price).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                result = (result + temp).toDecimal(decimalObj.ration.unitPrice);
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        return result;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    machineLabourFee: function (gljArr) {
 | 
	
		
			
				|  |  | +        if (!gljArr) return 0;
 | 
	
		
			
				|  |  |          let result = 0, mdSum = 0;
 | 
	
		
			
				|  |  | -        for (let glj of node.data.gljList) {
 | 
	
		
			
				|  |  | +        for (let glj of gljArr) {
 | 
	
		
			
				|  |  |              if (glj.type == gljType.GENERAL_MACHINE) {
 | 
	
		
			
				|  |  |                  // 获取机械组成物
 | 
	
		
			
				|  |  |                  let mds = projectObj.project.composition.getCompositionByGLJ(glj);
 | 
	
	
		
			
				|  | @@ -395,36 +308,126 @@ const rationCalcBaser = {
 | 
	
		
			
				|  |  |                          mdSum = (mdSum).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                ;
 | 
	
		
			
				|  |  |                  result = result + (glj["quantity"] * mdSum).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  |                  result = (result).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            ;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        ;
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    estimateFee: function (treeNode, isBase = false){
 | 
	
		
			
				|  |  | +        let me = this, sumU = 0, sumT = 0;
 | 
	
		
			
				|  |  | +        // 父清单暂估费的汇总计算走计算程序逻辑,不在这里。
 | 
	
		
			
				|  |  | +        if (nodeTools.isTotalCostBill(treeNode)){
 | 
	
		
			
				|  |  | +            let nodes = projectObj.project.mainTree.roots;
 | 
	
		
			
				|  |  | +            for (let node of nodes){
 | 
	
		
			
				|  |  | +                if (nodeTools.isTotalCostBill(node)) break;
 | 
	
		
			
				|  |  | +                let eU = 0, eT = 0;
 | 
	
		
			
				|  |  | +                if (node.data.feesIndex && node.data.feesIndex.estimate){
 | 
	
		
			
				|  |  | +                    eU = node.data.feesIndex.estimate.unitFee;
 | 
	
		
			
				|  |  | +                    eT = node.data.feesIndex.estimate.totalFee;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else {
 | 
	
		
			
				|  |  | +                    eU = 0, eT = 0;
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                sumU = (sumU + parseFloatPlus(eU)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                sumT = (sumT + parseFloatPlus(eT)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            sumU = (sumU).toDecimal(decimalObj.bills.unitPrice);
 | 
	
		
			
				|  |  | +            sumT = (sumT).toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else{
 | 
	
		
			
				|  |  | +            if (!treeNode.data.gljList) return;
 | 
	
		
			
				|  |  | +            let GLJObjs = [];
 | 
	
		
			
				|  |  | +            for (let glj of treeNode.data.gljList) {
 | 
	
		
			
				|  |  | +                if (allMaterialTypes.indexOf(glj.type) >= 0) {
 | 
	
		
			
				|  |  | +                    if (glj.isEstimate){
 | 
	
		
			
				|  |  | +                        GLJObjs.push({code: glj.code, name: glj.name, specs: glj.specs, unit: glj.unit, type: glj.type,
 | 
	
		
			
				|  |  | +                            quantity: glj.quantity, marketPrice: glj.marketPrice});
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    else{   // 组成物
 | 
	
		
			
				|  |  | +                        if (compositionTypes.indexOf(glj.type) >= 0){
 | 
	
		
			
				|  |  | +                            let mds = projectObj.project.composition.getCompositionByGLJ(glj);
 | 
	
		
			
				|  |  | +                            if (!mds) mds = [];
 | 
	
		
			
				|  |  | +                            for (let md of mds){
 | 
	
		
			
				|  |  | +                                if (md.isEstimate){
 | 
	
		
			
				|  |  | +                                    let isExist = false;
 | 
	
		
			
				|  |  | +                                    let mdQ = (me.uiGLJQuantity(glj.quantity) * me.uiGLJQuantity(md.consumption)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                    for (let obj of GLJObjs){
 | 
	
		
			
				|  |  | +                                        if (gljOprObj.getIndex(md, gljKeyArray) == gljOprObj.getIndex(obj, gljKeyArray)){
 | 
	
		
			
				|  |  | +                                            isExist = true;
 | 
	
		
			
				|  |  | +                                            obj.quantity = (me.uiGLJQuantity(obj.quantity) + mdQ).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                                            break;
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                    };
 | 
	
		
			
				|  |  | +                                    if (!isExist)
 | 
	
		
			
				|  |  | +                                        GLJObjs.push({code: md.code, name: md.name, specs: md.specs, unit: md.unit, type: md.type,
 | 
	
		
			
				|  |  | +                                            quantity: mdQ, marketPrice: md.marketPrice});
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            for (let obj of GLJObjs){
 | 
	
		
			
				|  |  | +                sumU = sumU + (me.uiGLJQuantity(obj.quantity) * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                sumU = sumU.toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                let q = (me.uiGLJQuantity(obj.quantity) * me.uiQuantity(treeNode)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                sumT = sumT + (q * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                sumT = sumT.toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            sumU = sumU.toDecimal(decimalObj.bills.unitPrice);
 | 
	
		
			
				|  |  | +            if (projectObj.project.property.zanguCalcMode == zanguCalcType.common){
 | 
	
		
			
				|  |  | +                sumT = (me.uiQuantity(treeNode) * sumU).toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (projectObj.project.property.zanguCalcMode == zanguCalcType.gatherMaterial){
 | 
	
		
			
				|  |  | +                sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (isBase)
 | 
	
		
			
				|  |  | +            return sumU
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +            nodeTools.checkFeeField(treeNode, {'fieldName': 'estimate', 'unitFee': sumU, 'totalFee': sumT});
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const rationCalcBaser = {
 | 
	
		
			
				|  |  | +    '定额基价人工费': function (node) {
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    '定额基价材料费': function (node) {
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, baseMaterialTypes, priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    '定额基价机械费': function (node) {
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.GENERAL_MACHINE], priceTypes.ptBasePrice);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    '定额基价机上人工费': function (node) {
 | 
	
		
			
				|  |  | +        return assistCalcer.machineLabourFee(node.data.gljList);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      '人工费价差': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.LABOUR], priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '材料费价差': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, baseMaterialTypes, priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, baseMaterialTypes, priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '机械费价差': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.GENERAL_MACHINE], priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.GENERAL_MACHINE], priceTypes.ptDiffPrice);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '主材费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.MAIN_MATERIAL], priceTypes.ptMarketPrice);
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.MAIN_MATERIAL], priceTypes.ptMarketPrice);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '设备费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.getRationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice);
 | 
	
		
			
				|  |  | +        return assistCalcer.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '人工工日': function (node) {
 | 
	
		
			
				|  |  |          if (!node.data.gljList) return 0;
 | 
	
		
			
				|  |  |          let rst = 0;
 | 
	
		
			
				|  |  |          for (let glj of node.data.gljList) {
 | 
	
		
			
				|  |  |              if (glj.type == gljType.LABOUR) {
 | 
	
		
			
				|  |  | -                rst = rst + (me.uiGLJQuantity(glj["quantity"]) * me.uiQuantity(node)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  | +                rst = rst + (assistCalcer.uiGLJQuantity(glj["quantity"]) * assistCalcer.uiQuantity(node)).toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  |                  rst = rst.toDecimal(decimalObj.process);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          };
 | 
	
	
		
			
				|  | @@ -451,7 +454,7 @@ const rationCalcBaser = {
 | 
	
		
			
				|  |  |      '甲定设备费': function (node) {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '暂估材料费': function (node) {
 | 
	
		
			
				|  |  | -        return nodeTools.calcEstimateFee(node, true);
 | 
	
		
			
				|  |  | +        return assistCalcer.estimateFee(node, true);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      '分包定额基价人工费': function (node) {
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -621,21 +624,36 @@ let executeObj = {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      base: function(baseName) {
 | 
	
		
			
				|  |  |          let me = executeObj;
 | 
	
		
			
				|  |  | -        function marketPriceToBase(baseName) {
 | 
	
		
			
				|  |  | +        function marketPriceToBase(baseName, type) {
 | 
	
		
			
				|  |  |              let result = 0;
 | 
	
		
			
				|  |  |              if (
 | 
	
		
			
				|  |  | -                ( me.treeNode.data.subType === gljType.LABOUR && baseName === '定额基价人工费') ||
 | 
	
		
			
				|  |  | -                ( baseMaterialTypes.includes(me.treeNode.data.subType) && baseName === '定额基价材料费') ||
 | 
	
		
			
				|  |  | -                ( me.treeNode.data.subType === gljType.GENERAL_MACHINE && baseName === '定额基价机械费') ||
 | 
	
		
			
				|  |  | -                ( me.treeNode.data.subType === gljType.MAIN_MATERIAL && baseName === '主材费') ||
 | 
	
		
			
				|  |  | -                ( me.treeNode.data.subType === gljType.EQUIPMENT && baseName === '设备费')
 | 
	
		
			
				|  |  | -            ) result = me.treeNode.data.marketUnitFee ? parseFloat(me.treeNode.data.marketUnitFee).toDecimal(decimalObj.ration.unitPrice) : 0;
 | 
	
		
			
				|  |  | +                (me.treeNode.data.subType === gljType.LABOUR && baseName === '定额基价人工费') ||
 | 
	
		
			
				|  |  | +                (baseMaterialTypes.includes(me.treeNode.data.subType) && baseName === '定额基价材料费') ||
 | 
	
		
			
				|  |  | +                (me.treeNode.data.subType === gljType.GENERAL_MACHINE && baseName === '定额基价机械费') ||
 | 
	
		
			
				|  |  | +                (me.treeNode.data.subType === gljType.MAIN_MATERIAL && baseName === '主材费') ||
 | 
	
		
			
				|  |  | +                (me.treeNode.data.subType === gljType.EQUIPMENT && baseName === '设备费')) {
 | 
	
		
			
				|  |  | +                if (type == rationType.volumePrice)
 | 
	
		
			
				|  |  | +                    result = me.treeNode.data.marketUnitFee ? parseFloat(me.treeNode.data.marketUnitFee).toDecimal(decimalObj.ration.unitPrice) : 0
 | 
	
		
			
				|  |  | +                else if (type == rationType.gljRation)
 | 
	
		
			
				|  |  | +                    result = me.treeNode.data.basePrice ? parseFloat(me.treeNode.data.basePrice).toDecimal(decimalObj.ration.unitPrice) : 0;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (me.treeNode.data.subType === gljType.GENERAL_MACHINE && baseName === '定额基价机上人工费'){
 | 
	
		
			
				|  |  | +                let glj = {
 | 
	
		
			
				|  |  | +                    'code': me.treeNode.data.code,
 | 
	
		
			
				|  |  | +                    'name': me.treeNode.data.name,
 | 
	
		
			
				|  |  | +                    'specs': me.treeNode.data.specs,
 | 
	
		
			
				|  |  | +                    'unit': me.treeNode.data.unit,
 | 
	
		
			
				|  |  | +                    'quantity': 1,
 | 
	
		
			
				|  |  | +                    'type': me.treeNode.data.subType      // 注意:这里要取subType
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                result = assistCalcer.machineLabourFee([glj]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              return result;
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 量价、工料机形式的定额, 要把自己的市场单价用于计算程序中的基数。
 | 
	
		
			
				|  |  |          if (me.treeNode.data.type == rationType.volumePrice || me.treeNode.data.type == rationType.gljRation)
 | 
	
		
			
				|  |  | -            return marketPriceToBase(baseName)
 | 
	
		
			
				|  |  | +            return marketPriceToBase(baseName, me.treeNode.data.type)
 | 
	
		
			
				|  |  |          else{
 | 
	
		
			
				|  |  |              if (!rationCalcBaser[baseName]){
 | 
	
		
			
				|  |  |                  alert('定额基数“' + baseName + '”末定义,计算错误。 (模板 ' + me.template.ID + ',规则 ' + me.tempCalcItem.ID +')');
 | 
	
	
		
			
				|  | @@ -648,7 +666,7 @@ let executeObj = {
 | 
	
		
			
				|  |  |      HJ: function () {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  |          let p = me.treeNode.data.calcBaseValue ? me.treeNode.data.calcBaseValue : 0;
 | 
	
		
			
				|  |  | -        let q = nodeTools.uiQuantity(me.treeNode) ? nodeTools.uiQuantity(me.treeNode) : 1;
 | 
	
		
			
				|  |  | +        let q = assistCalcer.uiQuantity(me.treeNode) ? assistCalcer.uiQuantity(me.treeNode) : 1;
 | 
	
		
			
				|  |  |          let u = (p / q).toDecimal(decimalObj.decimal('unitPrice', me.treeNode));
 | 
	
		
			
				|  |  |          return u;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -970,9 +988,9 @@ class CalcProgram {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){     // 这里的算法要配合冷姐姐的神图才能看懂^_^
 | 
	
		
			
				|  |  |                      let sum_rtf = 0, sum_rttf = 0;
 | 
	
		
			
				|  |  | -                    let bq = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 1;
 | 
	
		
			
				|  |  | +                    let bq = assistCalcer.uiQuantity(treeNode) ? assistCalcer.uiQuantity(treeNode) : 1;
 | 
	
		
			
				|  |  |                      for (let node of nodes) {
 | 
	
		
			
				|  |  | -                        let rq = nodeTools.uiQuantity(node) ? nodeTools.uiQuantity(node) : 0;
 | 
	
		
			
				|  |  | +                        let rq = assistCalcer.uiQuantity(node) ? assistCalcer.uiQuantity(node) : 0;
 | 
	
		
			
				|  |  |                          let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
 | 
	
		
			
				|  |  |                          if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
 | 
	
		
			
				|  |  |                              ruf = parseFloat(node.data.feesIndex[ft.type].unitFee);
 | 
	
	
		
			
				|  | @@ -1051,7 +1069,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
 | 
	
		
			
				|  |  | -            let q = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 1;
 | 
	
		
			
				|  |  | +            let q = assistCalcer.uiQuantity(treeNode) ? assistCalcer.uiQuantity(treeNode) : 1;
 | 
	
		
			
				|  |  |              let b = treeNode.data.calcBaseValue ? treeNode.data.calcBaseValue : 0;
 | 
	
		
			
				|  |  |              let uf = (b * f * q / 100).toDecimal(decimalObj.bills.unitPrice);
 | 
	
		
			
				|  |  |              let tuf = uf;
 | 
	
	
		
			
				|  | @@ -1063,7 +1081,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |              // 总造价清单还要做单项工程、建设项目的四大项金额汇总
 | 
	
		
			
				|  |  |              if (nodeTools.isTotalCostBill(treeNode)){
 | 
	
		
			
				|  |  |                  // 公式叶子清单没有暂估费,但总造价清单除外。
 | 
	
		
			
				|  |  | -                nodeTools.calcEstimateFee(treeNode);
 | 
	
		
			
				|  |  | +                assistCalcer.estimateFee(treeNode);
 | 
	
		
			
				|  |  |                  nodeTools.initSummaryFee(treeNode);
 | 
	
		
			
				|  |  |                  treeNode.data.summaryFees.totalFee = tf;
 | 
	
		
			
				|  |  |                  treeNode.data.summaryFees.estimateFee = nodeTools.getFee(treeNode, 'estimate.totalFee');
 | 
	
	
		
			
				|  | @@ -1080,7 +1098,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |                  if (treeNode.data.type == rationType.volumePrice){
 | 
	
		
			
				|  |  |                      delete treeNode.data.gljList;
 | 
	
		
			
				|  |  |                      let muf = treeNode.data.marketUnitFee ? treeNode.data.marketUnitFee : 0;
 | 
	
		
			
				|  |  | -                    let q = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 0;
 | 
	
		
			
				|  |  | +                    let q = assistCalcer.uiQuantity(treeNode) ? assistCalcer.uiQuantity(treeNode) : 0;
 | 
	
		
			
				|  |  |                      treeNode.data.marketTotalFee = (muf * q).toDecimal(decimalObj.ration.totalPrice);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else if (treeNode.data.type == rationType.gljRation){
 | 
	
	
		
			
				|  | @@ -1089,7 +1107,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |                  else{
 | 
	
		
			
				|  |  |                      treeNode.data.gljList = me.project.ration_glj.getGljArrByRation(treeNode.data.ID);
 | 
	
		
			
				|  |  |                      // 计算程序里没有暂估费的计算规则,会漏掉,所以这里要专门算。
 | 
	
		
			
				|  |  | -                    nodeTools.calcEstimateFee(treeNode);
 | 
	
		
			
				|  |  | +                    assistCalcer.estimateFee(treeNode);
 | 
	
		
			
				|  |  |                      fnArr.push('estimate');
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1106,7 +1124,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 叶子清单自己的计算程序计算,其暂估费也要汇总算。
 | 
	
		
			
				|  |  | -                nodeTools.calcEstimateFee(treeNode);
 | 
	
		
			
				|  |  | +                assistCalcer.estimateFee(treeNode);
 | 
	
		
			
				|  |  |                  fnArr.push('estimate');
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1126,7 +1144,7 @@ class CalcProgram {
 | 
	
		
			
				|  |  |                      let feeRate = parseFloatPlus(calcItem.feeRate) ? parseFloatPlus(calcItem.feeRate).toDecimal(decimalObj.feeRate) : 100;  // 100%
 | 
	
		
			
				|  |  |                      calcItem.unitFee = (eval(calcItem.compiledExpr) * feeRate * 0.01).toDecimal(decimalObj.decimal('unitPrice', treeNode));   // 如果eval()对清单树有影响,就换成小麦的Expression对象再试
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    let q = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 0;
 | 
	
		
			
				|  |  | +                    let q = assistCalcer.uiQuantity(treeNode) ? assistCalcer.uiQuantity(treeNode) : 0;
 | 
	
		
			
				|  |  |                      calcItem.totalFee = (calcItem.unitFee * q).toDecimal(decimalObj.decimal('totalPrice', treeNode));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      if (calcItem.fieldName) {
 |