Browse Source

验收问题修改

yangc 8 years ago
parent
commit
a2a7089d3f
1 changed files with 19 additions and 3 deletions
  1. 19 3
      components/applyPurchase/ApplyInfo.vue

+ 19 - 3
components/applyPurchase/ApplyInfo.vue

@@ -75,7 +75,7 @@
               <input type="number" v-model="sayPriceObj.minDay" @blur="onMinDayInput" class="form-control">&nbsp;-&nbsp;<input type="number" v-model="sayPriceObj.maxDay" @blur="onMaxDayInput" class="form-control">&nbsp;天
             </div>
             <div>
-              生产日期&nbsp;<input v-model="sayPriceObj.produceDate" type="text" class="form-control">
+              生产日期&nbsp;<input v-model="sayPriceObj.produceDate" @input="onProduceDateChange" type="text" class="form-control">
             </div>
             <div>
               <span @click="cancelSayPrice(purchaseMan)">取消</span>
@@ -90,6 +90,17 @@
   </div>
 </template>
 <script>
+  let getRealLen = function (str) {
+    let len = 0
+    for (let i = 0; i < str.length; i++) {
+      if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+        len += 2
+      } else {
+        len++
+      }
+    }
+    return len
+  }
   import Page from '~components/common/page/pageComponent.vue'
   export default {
     data () {
@@ -216,6 +227,11 @@
           this.sayPriceObj.maxDay = 0
         }
       },
+      onProduceDateChange: function () {
+        if (this.sayPriceObj.produceDate && getRealLen(this.sayPriceObj.produceDate) > 12) {
+          this.sayPriceObj.produceDate = this.sayPriceObj.produceDate.substring(0, this.sayPriceObj.produceDate.length - 1)
+        }
+      },
       searchList: function () {
         this.resetList()
       },
@@ -457,7 +473,7 @@
                   height: 26px;
                   border: 1px solid #5392f9;
                 }
-                /*select {
+                select {
                   position: absolute;
                   top: 19px;
                   width: 32px;
@@ -480,7 +496,7 @@
                   & + input {
                     padding-left: 34px;
                   }
-                }*/
+                }
                 div {
                   position: absolute;
                   top: 19px;