瀏覽代碼

修复bug

laiguoran 3 年之前
父節點
當前提交
e4c857ef97
共有 2 個文件被更改,包括 11 次插入4 次删除
  1. 3 2
      app/controller/material_controller.js
  2. 8 2
      app/view/material/audit_modal.ejs

+ 3 - 2
app/controller/material_controller.js

@@ -560,10 +560,11 @@ module.exports = app => {
                 }
                 const newDecimalUp = parseInt(data.up);
                 const newDecimalTp = parseInt(data.tp);
-                if (newDecimalUp > 6 || newDecimalUp < 0) {
+                console.log(newDecimalUp, newDecimalTp);
+                if (ctx.app._.isNaN(newDecimalUp) || newDecimalUp > 6 || newDecimalUp < 0) {
                     throw '单价小数位数设置不能大于6或小于0';
                 }
-                if (newDecimalTp > 6 || newDecimalTp < 0) {
+                if (ctx.app._.isNaN(newDecimalTp) || newDecimalTp > 6 || newDecimalTp < 0) {
                     throw '金额小数位数设置不能大于6或小于0';
                 }
                 if (ctx.material.decimal.up === newDecimalUp && ctx.material.decimal.tp === newDecimalTp) {

+ 8 - 2
app/view/material/audit_modal.ejs

@@ -780,11 +780,17 @@
     function checkSetDecimal() {
         const up = parseInt($('#decimal_up').val());
         const tp = parseInt($('#decimal_tp').val());
-        if(up > 6 || up < 0) {
+        let flag = false;
+        if(_.isNaN(up) || up > 6 || up < 0) {
             toastr.error('单价小数位数设置不能大于6或小于0');
+            flag = true;
         }
-        if(tp > 6 || tp < 0) {
+        if(_.isNaN(tp) || tp > 6 || tp < 0) {
             toastr.error('金额小数位数设置不能大于6或小于0');
+            flag = true;
+        }
+        if (flag) {
+            return false;
         }
     }
 </script>