Browse Source

修复表达式%问题

ellisran 1 year ago
parent
commit
334468781c

+ 1 - 1
app/public/js/change_information_set.js

@@ -872,7 +872,7 @@ $(document).ready(() => {
                     const [valid, msg] = this._checkExprValid(expr);
                     if (!valid) return [valid, msg];
                     data.expr = expr;
-                    data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr);
+                    data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr.replace('%', '/100'));
                     // const ce = new CalcEvalMin();
                     // data.quantity = ce.eval(expr);
                     // console.log(data.quantity);

+ 1 - 1
app/public/js/material_checklist.js

@@ -875,7 +875,7 @@ $(document).ready(() => {
                         const [valid, msg] = this._checkExprValid(expr);
                         if (!valid) return [valid, msg];
                         data.expr = expr;
-                        data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr);
+                        data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr.replace('%', '/100'));
                     }
                 } else {
                     data.quantity = 0;

+ 1 - 1
app/public/js/material_list.js

@@ -1518,7 +1518,7 @@ $(document).ready(() => {
                         const [valid, msg] = this._checkExprValid(expr);
                         if (!valid) return [valid, msg];
                         data.expr = expr;
-                        data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr);
+                        data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr.replace('%', '/100'));
                         // const ce = new CalcEvalMin();
                         // data.quantity = ce.eval(expr);
                         // console.log(data.quantity);