Explorar o código

装箱单成衣输入框小数校验

jbb %!s(int64=2) %!d(string=hai) anos
pai
achega
39b39d9a14
Modificáronse 1 ficheiros con 124 adicións e 39 borrados
  1. 124 39
      src/views/packing-list/packinglist-clothes/clothesAddDrawer.vue

+ 124 - 39
src/views/packing-list/packinglist-clothes/clothesAddDrawer.vue

@@ -453,7 +453,7 @@ export default {
           title: '净净重',
           key: 'netWeightToo',
           width: 120,
-          type: JVXETypes.normal,
+          type: JVXETypes.inputNumber,
         },
         {
           title: '单价',
@@ -774,50 +774,135 @@ export default {
                this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
                return;
              }
+
+            //是否未填
+             var Valuable=[
+               {key:'startingBoxNumber',value:'起始箱号'},
+               {key:'endCaseNumber',value:'结束箱号'},
+               {key:'netWeight',value:'净重/箱'},
+               {key:'piecesBox',value:'件数/箱'},
+               {key:'grossWeight',value:'毛重/箱'},
+               {key:'outerBoxLength',value:'外箱长度'},
+               {key:'outerBoxWidth',value:'外箱宽度'},
+               {key:'outerBoxHeight',value:'外箱高度'},
+               {key:'netWeightToo',value:'净净重'},
+               ]
+             for(var j=0 ; j<Valuable.length;j++){
+                if(tableRow[Valuable[j].key] == null || tableRow[Valuable[j].key] == "" || tableRow[Valuable[j].key] == undefined){
+                  this.$message.error('第'+(i+1)+'行'+Valuable[j].value+'未填,无法保存');
+                  return
+                }
+             }
+             //是否为整
+             var integer = [
+               {key:'startingBoxNumber',value:'起始箱号'},
+               {key:'piecesBox',value:'件数/箱'},
+               {key:'endCaseNumber',value:'结束箱号'},
+             ]
+             for(var v=0 ; v<integer.length;v++){
+                if(!Number.isInteger(Number(tableRow[integer[v].key]))){
+                  this.$message.error('第'+(i+1)+'行'+integer[v].value+'不为整数,无法保存');
+                  return
+                }
+             }
+
+             //判断小数位数
+              var Several = [
+               {key:'netWeight',value:'净重/箱'},
+               {key:'grossWeight',value:'毛重/箱'},
+             ]
+              for(var s=0 ; s<Several.length;s++){
+                var position = tableRow[Several[s].key].toString().indexOf('.') + 1;   //小数点的位置
+                var digit = tableRow[Several[s].key].toString().length - position;  //小数的位数
+                if(digit > 2){
+                 this.$message.error('第'+(i+1)+'行'+Several[s].value+'小数超过两位,无法保存');
+                 return 
+              }
+             }
+
             if(tableRow.startingBoxNumber > tableRow.endCaseNumber) {
               this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
               return;
             }
-            if (tableRow.startingBoxNumber == ""){
-              this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
-              return;
-           }
-           if (tableRow.endCaseNumber == ""){
-               this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
-                return;
-            }
+          //   if (tableRow.startingBoxNumber == ""){
+          //     this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
+          //     return;
+          //  }
+           //起始箱数判断
+          //  if(!Number.isInteger(Number(tableRow.startingBoxNumber))){
+          //     this.$message.error('第'+(i+1)+'行起始箱号不为整数,无法保存');
+          //     return
+          //  }
+          //  if (tableRow.endCaseNumber == ""){
+          //      this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
+          //       return;
+          //   }
+            //结束箱数小数判断
+          //  if(!Number.isInteger(Number(tableRow.endCaseNumber))){
+          //     this.$message.error('第'+(i+1)+'行结束箱号不为整数,无法保存');
+          //     return
+          //   }
            if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
               this.$message.error('第'+(i+1)+'行箱数,无法保存');
               return;
            }
-           if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
-             this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
-             return;
-           }
-           if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
-             this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
-             return;
-           }
-          if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
-            this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
-             return;
-            } 
-          if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
-             this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
-             return;
-           }
-          if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
-            this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
-            return;
-          }
-          if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
-            this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
-            return;
-           }
-          if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
-             this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
-            return;
-          }
+          //  if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
+          //    this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
+          //    return;
+          //  }
+           //净重/箱小数判断
+          // if(!Number.isInteger(Number(tableRow.netWeight))){
+          //   var position = tableRow.netWeight.toString().indexOf('.') + 1;   //小数点的位置
+          //   var digit = tableRow.netWeight.toString().length - position;  //小数的位数
+          //   if(digit > 2){
+          //     this.$message.error('第'+(i+1)+'行净重/箱超过两位小数,无法保存');
+          //     return 
+          //   }
+          //  }
+          //  if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
+          //    this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
+          //    return;
+          //  }
+           //件数/箱小数判断
+          //  if(!Number.isInteger(tableRow.piecesBox)){
+          //    for (var i=0; i<this.sizeFields.length; i++){
+          //      if (!Number.isInteger(tableRow[this.sizeFields[i]]) ){
+          //        this.$message.error('第'+(i+1)+'行'+this.sizeFields[i]+'不为整数,无法保存');
+          //        return;
+          //      }
+          //    }
+          // }
+          // if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
+          //   this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
+          //    return;
+          //   } 
+            //毛重/箱小数判断
+          // if(!Number.isInteger(Number(tableRow.grossWeight))){
+          //    var position = tableRow.grossWeight.toString().indexOf('.') + 1;   //小数点的位置
+          //     var digit = tableRow.grossWeight.toString().length - position;  //小数的位数
+          //     if(digit > 2){
+          //        this.$message.error('第'+(i+1)+'行毛重/箱超过两位小数,无法保存');
+          //        return 
+          //     }
+          // }
+          // if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
+          //    this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
+          //    return;
+          //  }
+          // if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
+          //   this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
+          //   return;
+          // // }
+          // if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
+          //   this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
+          //   return;
+          //  }
+          // if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
+          //    this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
+          //   return;
+          // }
+
+          //尺码赋值
           for (var j=0; j<tableRow.sizeTables.length; j++){
            var sizeTable = tableRow.sizeTables[j];
             var field = 'size-'+sizeTable.size;
@@ -1034,7 +1119,7 @@ export default {
           title: '净净重',
           key: 'netWeightToo',
           width: 120,
-          type: JVXETypes.normal,
+          type: JVXETypes.inputNumber,
         },
         {
           title: '单价',
@@ -1074,7 +1159,7 @@ export default {
     // 分页、排序、筛选变化时触发
     handleTableChange(pagination, filters, sorter) {
       this.queryParam.pageNo = pagination.current
-      this.getAnnList()
+      this.referCallback()
     }
   }
 }