Explorar el Código

限制字符长度

shenjj hace 7 años
padre
commit
e0f7c21885
Se han modificado 1 ficheros con 14 adiciones y 7 borrados
  1. 14 7
      components/applyPurchase/BatchPublish.vue

+ 14 - 7
components/applyPurchase/BatchPublish.vue

@@ -3,15 +3,15 @@
     <div class="batch-publish-top clearfix">
     <div class="batch-publish-top clearfix">
       <div class="w50">
       <div class="w50">
         <img src="/images/applyPurchase/batch-icon.png" alt="">
         <img src="/images/applyPurchase/batch-icon.png" alt="">
-        Bom名称:<input type="text" v-model="bomInfo.name" class="text" />
+        Bom名称:<input type="text" v-model="bomInfo.name" class="text"  maxlength="100"/>
         共上传<b class="blue-text">{{bomNumber.successImport || 0}}</b>个产品
         共上传<b class="blue-text">{{bomNumber.successImport || 0}}</b>个产品
         <!--,其中<span class="red-text">{{bomNumber.nullField || 0}}</span>个产品的必填项缺失,请在当前页完善信息-->
         <!--,其中<span class="red-text">{{bomNumber.nullField || 0}}</span>个产品的必填项缺失,请在当前页完善信息-->
       </div>
       </div>
       <div class="w50">
       <div class="w50">
-        采购套数:<input type="text" v-model="bomInfo.count" class="text"/>
+        采购套数:<input type="text" maxlength="5" v-model="bomInfo.count" class="text" @blur="countBlur(bomInfo.count)" />
       </div>
       </div>
       <div class="w50" style="padding-left: 62px;">
       <div class="w50" style="padding-left: 62px;">
-        规格:<input type="text" v-model="bomInfo.spec" class="text" />
+        规格:<input type="text" v-model="bomInfo.spec" class="text" maxlength="100"/>
       </div>
       </div>
       <div class="w50">
       <div class="w50">
         <span style="margin-right: 1px;">*截止时间: </span><el-date-picker
         <span style="margin-right: 1px;">*截止时间: </span><el-date-picker
@@ -225,7 +225,7 @@
             </div>
             </div>
           </td>
           </td>
           <td>
           <td>
-            <input type="text" class="form-control" v-model="modifyObj.amount" :class="{'error': !validObj.amount}" @blur="checkAmount" @input="onAmountInput">
+            <input type="text" maxlength="4" class="form-control" v-model="modifyObj.amount" :class="{'error': !validObj.amount}" @blur="checkAmount" @input="onAmountInput">
           </td>
           </td>
           <!--<td>
           <!--<td>
             <input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
             <input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
@@ -396,6 +396,11 @@
       }
       }
     },
     },
     methods: {
     methods: {
+      countBlur(item) {
+        if (this.bomInfo.count < 1 || this.bomInfo.count === '') {
+          this.bomInfo.count = 1
+        }
+      },
       getDate1: function () {
       getDate1: function () {
         this.bomInfo.endTime = this.bomInfo.endTime ? this.baseUtils.getFullDay(this.baseUtils.getClearDay(new Date(this.baseUtils.formatDate(new Date(this.bomInfo.endTime), 'yyyy-MM-dd')))) : null
         this.bomInfo.endTime = this.bomInfo.endTime ? this.baseUtils.getFullDay(this.baseUtils.getClearDay(new Date(this.baseUtils.formatDate(new Date(this.bomInfo.endTime), 'yyyy-MM-dd')))) : null
         this.bomInfo.flag = true
         this.bomInfo.flag = true
@@ -447,10 +452,11 @@
         } else if (!this.bomInfo.endTime || this.bomInfo.endTime === '') {
         } else if (!this.bomInfo.endTime || this.bomInfo.endTime === '') {
           this.$message.error('请选择截止时间')
           this.$message.error('请选择截止时间')
           return
           return
-        } else if (!this.bomInfo.spec || this.bomInfo.spec === '') {
-          this.$message.error('请输入规格')
-          return
         }
         }
+        // else if (!this.bomInfo.spec || this.bomInfo.spec === '') {
+        //   this.$message.error('请输入规格')
+        //   return
+        // }
         let bom = this.bomInfo
         let bom = this.bomInfo
         this.$http.post('/seek/bom/edit', bom).then(response => {
         this.$http.post('/seek/bom/edit', bom).then(response => {
           this.$http.post('/seek/confirmBom?bomId=' + Number(this.$route.params.id) + '&endTime=' + this.bomInfo.endTime.getTime() + '&count=' + this.bomInfo.count)
           this.$http.post('/seek/confirmBom?bomId=' + Number(this.$route.params.id) + '&endTime=' + this.bomInfo.endTime.getTime() + '&count=' + this.bomInfo.count)
@@ -1076,6 +1082,7 @@
       // noDetail
       // noDetail
       this.$http.get('/seek/bom/noDetail?bomId=' + this.$route.params.id).then(res => {
       this.$http.get('/seek/bom/noDetail?bomId=' + this.$route.params.id).then(res => {
         this.bomInfo = res.data
         this.bomInfo = res.data
+        this.bomInfo.count = this.bomInfo.count || 1
       })
       })
     }
     }
   }
   }