|
@@ -412,13 +412,13 @@ let executeObj = {
|
|
|
HJ: function () {
|
|
|
let me = this;
|
|
|
let p = me.treeNode.data.calcBaseValue ? me.treeNode.data.calcBaseValue : 0;
|
|
|
- let q = treeNodeTools.uiQuantity(me.treeNode) ? treeNodeTools.uiQuantity(me.treeNode) : 1;
|
|
|
+ let q = nodeTools.uiQuantity(me.treeNode) ? nodeTools.uiQuantity(me.treeNode) : 1;
|
|
|
let u = (p / q).toDecimal(decimalObj.decimal('unitPrice', me.treeNode));
|
|
|
return u;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-let treeNodeTools = {
|
|
|
+let nodeTools = {
|
|
|
isBill: function(treeNode){
|
|
|
return treeNode.sourceType === ModuleNames.bills;
|
|
|
},
|
|
@@ -809,7 +809,7 @@ class CalcProgram {
|
|
|
// 仅用作树节点显示的工料机不能参与计算。
|
|
|
if (treeNode.sourceType === me.project.ration_glj.getSourceType()) return;
|
|
|
|
|
|
- treeNode.calcType = treeNodeTools.getCalcType(treeNode);
|
|
|
+ treeNode.calcType = nodeTools.getCalcType(treeNode);
|
|
|
// if (treeNode.calcType == treeNodeCalcType.ctCalcBaseValue) return;
|
|
|
|
|
|
function isBaseFeeType(type){
|
|
@@ -820,10 +820,10 @@ class CalcProgram {
|
|
|
function calcEstimateFee(treeNode){
|
|
|
let sumU = 0, sumT = 0;
|
|
|
|
|
|
- if (treeNodeTools.isTotalCostBill(treeNode)){
|
|
|
+ if (nodeTools.isTotalCostBill(treeNode)){
|
|
|
let nodes = projectObj.project.mainTree.roots;
|
|
|
for (let node of nodes){
|
|
|
- if (treeNodeTools.isTotalCostBill(node)) break;
|
|
|
+ if (nodeTools.isTotalCostBill(node)) break;
|
|
|
let eU = 0, eT = 0;
|
|
|
if (node.data.feesIndex && node.data.feesIndex.estimate){
|
|
|
eU = node.data.feesIndex.estimate.unitFee;
|
|
@@ -883,14 +883,14 @@ class CalcProgram {
|
|
|
};
|
|
|
sumU = sumU.toDecimal(decimalObj.bills.unitPrice);
|
|
|
if (projectObj.project.property.zanguCalcMode == zanguCalcType.common){
|
|
|
- sumT = (treeNodeTools.uiQuantity(treeNode) * sumU).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ sumT = (nodeTools.uiQuantity(treeNode) * sumU).toDecimal(decimalObj.bills.totalPrice);
|
|
|
}
|
|
|
else if (projectObj.project.property.zanguCalcMode == zanguCalcType.gatherMaterial){
|
|
|
sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- treeNodeTools.checkFeeField(treeNode, {'fieldName': 'estimate', 'unitFee': sumU, 'totalFee': sumT});
|
|
|
+ nodeTools.checkFeeField(treeNode, {'fieldName': 'estimate', 'unitFee': sumU, 'totalFee': sumT});
|
|
|
};
|
|
|
|
|
|
// 删掉多余的费用。例如:从其它计算方式切换到公式计算方式,会多出其它的费(不光是common)
|
|
@@ -906,7 +906,7 @@ class CalcProgram {
|
|
|
}
|
|
|
}
|
|
|
else{ // 总造价清单只留common, estimate两个费用类别。其它公式清单只留common。
|
|
|
- let reserveArr = treeNodeTools.isTotalCostBill(treeNode)? ['common', 'estimate']:['common'];
|
|
|
+ let reserveArr = nodeTools.isTotalCostBill(treeNode)? ['common', 'estimate']:['common'];
|
|
|
if (treeNode.data.fees && treeNode.data.fees.length > 0){
|
|
|
let feesArr = treeNode.data.fees;
|
|
|
for (let i = 0; i < feesArr.length; i++) {
|
|
@@ -923,7 +923,7 @@ class CalcProgram {
|
|
|
// 父清单汇总子项(子清单或定额)的费用类别
|
|
|
if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees || treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
treeNode.data.programID = null;
|
|
|
- treeNodeTools.initFees(treeNode);
|
|
|
+ nodeTools.initFees(treeNode);
|
|
|
let nodes = (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees) ? treeNode.children : me.project.Ration.getRationNodes(treeNode);
|
|
|
let rst = [];
|
|
|
for (let ft of cpFeeTypes) {
|
|
@@ -944,9 +944,9 @@ class CalcProgram {
|
|
|
}
|
|
|
else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){ // 这里的算法要配合冷姐姐的神图才能看懂^_^
|
|
|
let sum_rtf = 0, sum_rttf = 0;
|
|
|
- let bq = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 1;
|
|
|
+ let bq = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 1;
|
|
|
for (let node of nodes) {
|
|
|
- let rq = treeNodeTools.uiQuantity(node) ? treeNodeTools.uiQuantity(node) : 0;
|
|
|
+ let rq = nodeTools.uiQuantity(node) ? nodeTools.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);
|
|
@@ -982,7 +982,7 @@ class CalcProgram {
|
|
|
ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
ftObj.tenderUnitFee = btuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
ftObj.tenderTotalFee = bttf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
- treeNodeTools.checkFeeField(treeNode, ftObj);
|
|
|
+ nodeTools.checkFeeField(treeNode, ftObj);
|
|
|
|
|
|
rst.push(ftObj);
|
|
|
};
|
|
@@ -1025,24 +1025,24 @@ class CalcProgram {
|
|
|
}
|
|
|
|
|
|
let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
|
|
|
- let q = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 1;
|
|
|
+ let q = nodeTools.uiQuantity(treeNode) ? nodeTools.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;
|
|
|
let tf = (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) ? (b * f / 100).toDecimal(decimalObj.bills.totalPrice) : (uf * q).toDecimal(decimalObj.bills.totalPrice);
|
|
|
let ttf = tf;
|
|
|
deleteUselessFees(treeNode);
|
|
|
- treeNodeTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf});
|
|
|
+ nodeTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf});
|
|
|
|
|
|
// 总造价清单还要做单项工程、建设项目的四大项金额汇总
|
|
|
- if (treeNodeTools.isTotalCostBill(treeNode)){
|
|
|
+ if (nodeTools.isTotalCostBill(treeNode)){
|
|
|
// 公式叶子清单没有暂估费,但总造价清单除外。
|
|
|
calcEstimateFee(treeNode);
|
|
|
- treeNodeTools.initSummaryFee(treeNode);
|
|
|
+ nodeTools.initSummaryFee(treeNode);
|
|
|
treeNode.data.summaryFees.totalFee = tf;
|
|
|
- treeNode.data.summaryFees.estimateFee = treeNodeTools.getFee(treeNode, 'estimate.totalFee');
|
|
|
- treeNode.data.summaryFees.safetyFee = treeNodeTools.getFee(treeNodeTools.getNodeByFlag(fixedFlag.SAFETY_CONSTRUCTION), 'common.totalFee');
|
|
|
- treeNode.data.summaryFees.chargeFee = treeNodeTools.getFee(treeNodeTools.getNodeByFlag(fixedFlag.CHARGE), 'common.totalFee');
|
|
|
+ treeNode.data.summaryFees.estimateFee = nodeTools.getFee(treeNode, 'estimate.totalFee');
|
|
|
+ treeNode.data.summaryFees.safetyFee = nodeTools.getFee(nodeTools.getNodeByFlag(fixedFlag.SAFETY_CONSTRUCTION), 'common.totalFee');
|
|
|
+ treeNode.data.summaryFees.chargeFee = nodeTools.getFee(nodeTools.getNodeByFlag(fixedFlag.CHARGE), 'common.totalFee');
|
|
|
}
|
|
|
|
|
|
treeNode.data.calcTemplate = {"calcItems": []};
|
|
@@ -1054,7 +1054,7 @@ class CalcProgram {
|
|
|
if (treeNode.data.type == rationType.volumePrice){
|
|
|
delete treeNode.data.gljList;
|
|
|
let muf = treeNode.data.marketUnitFee ? treeNode.data.marketUnitFee : 0;
|
|
|
- let q = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 0;
|
|
|
+ let q = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 0;
|
|
|
treeNode.data.marketTotalFee = (muf * q).toDecimal(decimalObj.ration.totalPrice);
|
|
|
}
|
|
|
else if (treeNode.data.type == rationType.gljRation){
|
|
@@ -1093,19 +1093,19 @@ class CalcProgram {
|
|
|
$CE.template = template;
|
|
|
$CE.calcBase = me.compiledCalcBases;
|
|
|
|
|
|
- treeNodeTools.initFees(treeNode);
|
|
|
+ nodeTools.initFees(treeNode);
|
|
|
|
|
|
for (let idx of template.compiledSeq) {
|
|
|
let calcItem = template.calcItems[idx];
|
|
|
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 = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 0;
|
|
|
+ let q = nodeTools.uiQuantity(treeNode) ? nodeTools.uiQuantity(treeNode) : 0;
|
|
|
calcItem.totalFee = (calcItem.unitFee * q).toDecimal(decimalObj.decimal('totalPrice', treeNode));
|
|
|
|
|
|
if (calcItem.fieldName) {
|
|
|
fnArr.push(calcItem.fieldName);
|
|
|
- treeNodeTools.checkFeeField(treeNode, calcItem);
|
|
|
+ nodeTools.checkFeeField(treeNode, calcItem);
|
|
|
};
|
|
|
};
|
|
|
deleteUselessFees(treeNode, fnArr);
|
|
@@ -1195,7 +1195,7 @@ class CalcProgram {
|
|
|
// 计算叶子清单下的所有子结点、自身、所有父结点、公式引用结点(即跟该叶子清单相关的所有结点)。最后打包存储。
|
|
|
calcLeafAndSave(treeNode){
|
|
|
let me = this;
|
|
|
- if(!treeNodeTools.isLeafBill(treeNode)) return;
|
|
|
+ if(!nodeTools.isLeafBill(treeNode)) return;
|
|
|
if (treeNode.children && treeNode.children.length > 0) {
|
|
|
let changedNodes = [];
|
|
|
for (let child of treeNode.children){
|
|
@@ -1250,7 +1250,7 @@ class CalcProgram {
|
|
|
|
|
|
// 排除指定项的综合合价计算(用于带循环计算的情况)
|
|
|
getTotalFee(excludeNodes){
|
|
|
- excludeNodes.push(treeNodeTools.getNodeByFlag(fixedFlag.ENGINEERINGCOST));
|
|
|
+ excludeNodes.push(nodeTools.getNodeByFlag(fixedFlag.ENGINEERINGCOST));
|
|
|
let me = this;
|
|
|
let rst = 0;
|
|
|
|
|
@@ -1261,7 +1261,7 @@ class CalcProgram {
|
|
|
}
|
|
|
else{
|
|
|
if (!excludeNodes.includes(node) && node.sourceType != ModuleNames.ration_glj) {
|
|
|
- rst = (rst + treeNodeTools.getFee(node, 'common.totalFee')).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ rst = (rst + nodeTools.getFee(node, 'common.totalFee')).toDecimal(decimalObj.bills.totalPrice);
|
|
|
};
|
|
|
}
|
|
|
}*/
|
|
@@ -1273,7 +1273,7 @@ class CalcProgram {
|
|
|
}
|
|
|
else{
|
|
|
if (node.sourceType != ModuleNames.ration_glj) {
|
|
|
- rst = (rst + treeNodeTools.getFee(node, 'common.totalFee')).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ rst = (rst + nodeTools.getFee(node, 'common.totalFee')).toDecimal(decimalObj.bills.totalPrice);
|
|
|
};
|
|
|
}
|
|
|
}
|