|
@@ -833,7 +833,13 @@ let analyzer = {
|
|
|
let expr = me.standard(dispExpr);
|
|
|
return refLineToID(expr, calcTemplate);
|
|
|
},
|
|
|
- getCompiledExpr: function (expression) {
|
|
|
+ getDispExprUser: function (dispExpr, labourCoe) { // labourCoe 是 str 类型
|
|
|
+ let me = analyzer;
|
|
|
+ let expr = me.standard(dispExpr);
|
|
|
+ expr = expr.replace(/L/g, labourCoe);
|
|
|
+ return expr;
|
|
|
+ },
|
|
|
+ getCompiledExpr: function (expression, labourCoe) { // labourCoe 是 str 类型
|
|
|
let me = analyzer;
|
|
|
let rst = expression;
|
|
|
let atIDArr = me.getAtIDArr(rst);
|
|
@@ -847,6 +853,7 @@ let analyzer = {
|
|
|
};
|
|
|
rst = rst.replace(/\[/g, "$CE.base('");
|
|
|
rst = rst.replace(/\]/g, "')");
|
|
|
+ rst = rst.replace(/L/g, labourCoe);
|
|
|
return rst;
|
|
|
}
|
|
|
};
|
|
@@ -1060,22 +1067,20 @@ class CalcProgram {
|
|
|
let private_compile_items = function() {
|
|
|
for (let idx of template.compiledSeq) {
|
|
|
let item = template.calcItems[idx];
|
|
|
- item.dispExprUser = item.dispExpr; // 用于界面显示。disExpr是公式模板,不允许修改:人工系数占位符被修改后变成数值,第二次无法正确替换。
|
|
|
+
|
|
|
+ let lc = 0;
|
|
|
+ if (item.labourCoeID) lc = me.compiledLabourCoes[item.labourCoeID].coe.toString();
|
|
|
+ // 用于界面显示。disExpr是公式模板,不允许修改:人工系数占位符被修改后变成数值,第二次无法正确替换。
|
|
|
+ item.dispExprUser = analyzer.getDispExprUser(item.dispExpr, lc);
|
|
|
if (item.expression == 'HJ')
|
|
|
item.compiledExpr = '$CE.HJ()'
|
|
|
else
|
|
|
- item.compiledExpr = analyzer.getCompiledExpr(item.expression);
|
|
|
-
|
|
|
- if (item.labourCoeID){
|
|
|
- let lc = me.compiledLabourCoes[item.labourCoeID].coe;
|
|
|
- item.dispExprUser = item.dispExpr.replace(/L/gi, lc.toString());
|
|
|
- item.compiledExpr = item.compiledExpr.replace(/L/gi, lc.toString());
|
|
|
- };
|
|
|
+ item.compiledExpr = analyzer.getCompiledExpr(item.expression, lc);
|
|
|
|
|
|
if (item.feeRateID) {
|
|
|
let orgFeeRate = item.feeRate;
|
|
|
- let cmf = me.compiledFeeRates[item.feeRateID];
|
|
|
- item.feeRate = cmf?cmf.rate:100;
|
|
|
+ let cfr = me.compiledFeeRates[item.feeRateID];
|
|
|
+ item.feeRate = cfr ? cfr.rate : 100;
|
|
|
|
|
|
if (!orgFeeRate || (orgFeeRate && orgFeeRate != item.feeRate)){
|
|
|
me.saveForReports.push({templatesID: template.ID, calcItem: item});
|