|
@@ -861,6 +861,7 @@ let baseFigureTemplate = {
|
|
|
'ZGCLFFZM': function (tender) {//暂估材料费(从子目汇总)
|
|
|
const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
|
|
|
let bill = calcBase.fixedBills[calcBase.fixedFlag.ENGINEERINGCOST]['bill'];
|
|
|
+ projectObj.project.calcProgram.calculate(cbTools.getNodeByID(bill.ID), false, false, true);
|
|
|
if(cbTools.isUnDef(bill)) return 0;
|
|
|
if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
|
|
|
return cbTools.isDef(bill.feesIndex.estimate) && cbTools.isDef(bill.feesIndex.estimate[totalFeeType]) ? bill.feesIndex.estimate[totalFeeType] : 0;
|
|
@@ -1066,16 +1067,19 @@ let cbAnalyzer = {
|
|
|
let cnExps = cbParser.getCN(exp);
|
|
|
let expFigures = cbParser.getFigure(exp);
|
|
|
if(cnExps.length !== expFigures.length){
|
|
|
+ throw '清单基数必须要用花括号{}括起来'
|
|
|
return false;
|
|
|
}
|
|
|
for(let i = 0, len = cnExps.length; i < len; i++){
|
|
|
if(cnExps[i] !== expFigures[i]){
|
|
|
+ throw '清单基数必须要用花括号{}括起来'
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
//基数存在性
|
|
|
for(let i = 0, len = expFigures.length; i < len; i++){
|
|
|
if(cbTools.isUnDef(baseFigures[expFigures[i]])){
|
|
|
+ throw `清单基数{${expFigures[i]}}不存在`;
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -1151,7 +1155,7 @@ let cbAnalyzer = {
|
|
|
return stack;
|
|
|
}
|
|
|
},
|
|
|
- //四则运算合法性,前端控制不允许重复出现运算符,这里主要判断()的使用问题,这里再判断一次,控制行引用只能F
|
|
|
+ //四则运算合法性,控制不允许重复出现运算符,这里再判断一次,控制行引用只能F
|
|
|
arithmeticLegal: function (exp) {
|
|
|
let ilegalRex = /[\+,\-,\*,\/]{2}/g;
|
|
|
let rex2 = /[{]{2}/g;
|
|
@@ -1164,7 +1168,25 @@ let cbAnalyzer = {
|
|
|
//
|
|
|
legalExp: function (node) {
|
|
|
let exp = this.standar(node.data.userCalcBase);
|
|
|
- if(this.inputLegal(exp)){
|
|
|
+ if(!this.inputLegal(exp)){
|
|
|
+ throw '表达式含有无效字符';
|
|
|
+ }
|
|
|
+ if(!this.arithmeticLegal(exp)){
|
|
|
+ throw '表达式含有无效字符';
|
|
|
+ }
|
|
|
+ if(!this.baseLegal(cbTools.getFigure(node), exp)){
|
|
|
+ throw '清单基数不合法';
|
|
|
+ }
|
|
|
+ if(!this.fLegal(calcBase.project.mainTree.items, exp)){
|
|
|
+ throw '行引用不合法';
|
|
|
+ }
|
|
|
+ //转换成ID引用
|
|
|
+ exp = cbParser.toIDExpr(exp);
|
|
|
+ if(this.cycleCalc(node, cbTools.getFigure(node), exp)){
|
|
|
+ throw '出现循环计算';
|
|
|
+ }
|
|
|
+ return exp;
|
|
|
+ /* if(this.inputLegal(exp)){
|
|
|
if(this.arithmeticLegal(exp)){
|
|
|
if(this.baseLegal(cbTools.getFigure(node), exp)){
|
|
|
if(this.fLegal(calcBase.project.mainTree.items, exp)){
|
|
@@ -1180,7 +1202,7 @@ let cbAnalyzer = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return null;*/
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1470,13 +1492,13 @@ let calcBase = {
|
|
|
let calcExp = $CBP.percentToNum(compileExp);
|
|
|
let calcBaseValue = eval(calcExp);
|
|
|
if(!cbTools.isNum(calcBaseValue)){
|
|
|
- throw '表达式不正确';
|
|
|
+ throw '基数计算结果不为数值';
|
|
|
}
|
|
|
//调价
|
|
|
let tenderCalcExp = calcExp.replace(new RegExp('base', 'g'), 'tenderBase');
|
|
|
let tenderCalcBaseValue = eval(tenderCalcExp);
|
|
|
if(!cbTools.isNum(tenderCalcBaseValue)){
|
|
|
- throw '表达式不正确';
|
|
|
+ throw '调价基数计算结果不为数值';
|
|
|
}
|
|
|
|
|
|
//存储
|
|
@@ -1487,6 +1509,9 @@ let calcBase = {
|
|
|
node.changed = true;
|
|
|
}
|
|
|
catch (err){
|
|
|
+ if(typeof err === 'object'){
|
|
|
+ err = '表达式不正确'
|
|
|
+ }
|
|
|
alert(err);
|
|
|
}
|
|
|
}
|