Browse Source

修改了合同页面备件明细新增价格校验条件

duanxiaoduan 1 year ago
parent
commit
206382b025
2 changed files with 9 additions and 24 deletions
  1. 0 0
      dist/index.html
  2. 9 24
      src/views/custom/contractManagement/index.vue

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


+ 9 - 24
src/views/custom/contractManagement/index.vue

@@ -2144,15 +2144,10 @@ export default {
               this.$message({ type: 'error', message: '计划量请输入正整数', duration: 2000 })
               return false
             }
-            if (parseFloat(this.tab1.detailsSpareParts.listAdd[i].price) == 0) {
-              this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
+            var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
+            if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
+              this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后两位', duration: 2000 })
               return false
-            } else {
-              var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,5})?$/
-              if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
-                this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
-                return false
-              }
             }
           }
         }
@@ -2247,15 +2242,10 @@ export default {
               this.$message({ type: 'error', message: '计划量请输入正整数', duration: 2000 })
               return false
             } else {
-              if (parseFloat(this.tab1.detailsSpareParts.listAdd[i].price) == 0) {
-                this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
+              var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
+              if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
+                this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后两位', duration: 2000 })
                 return false
-              } else {
-                var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,5})?$/
-                if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
-                  this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
-                  return false
-                }
               }
             }
           }
@@ -2561,15 +2551,10 @@ export default {
                 this.$message({ type: 'error', message: '计划量请输入正整数', duration: 2000 })
                 return false
               } else {
-                if (parseFloat(this.tab1.detailsSpareParts.listAdd[i].price) == 0) {
-                  this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
+                var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
+                if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
+                  this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后两位', duration: 2000 })
                   return false
-                } else {
-                  var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,5})?$/
-                  if (rulesPrice.test(this.tab1.detailsSpareParts.listAdd[i].price) == false) {
-                    this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
-                    return false
-                  }
                 }
               }
             }

Some files were not shown because too many files changed in this diff