Преглед изворни кода

fix(report): 新增兼容旧计算式的判断代码

lishihao пре 4 година
родитељ
комит
1d139a91cc
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      report/src/core/formulasFun.ts

+ 3 - 2
report/src/core/formulasFun.ts

@@ -48,13 +48,14 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
                 // 计算式集合,目前是放置打印信息的,用于配置属性的计算
                 let $ME = $CURRENT_RPT.formulas[execFmlIdx];
                 try {
+                    let newExpression=expression;
                     const { format } = $ME;
                     // console.log(expression);
                     //临时处理
                     if (expression.indexOf(`new Date(`)) {
-                        expression.replaceAll(`new Date(`, `new ReportDate(`)
+                        newExpression= expression.replaceAll(`new Date(`, `new ReportDate(`)
                     }
-                    eval(expression);
+                    eval(newExpression);
                 } catch (ex) {
                     console.log(ex);
                 }