seimin преди 1 година
родител
ревизия
a2fbbbe93b
променени са 2 файла, в които са добавени 36 реда и са изтрити 6 реда
  1. 1 1
      components/selectNum/selectNum.vue
  2. 35 5
      pages/medicalWaste/medicalWasteBind/medicalWasteBind.vue

+ 1 - 1
components/selectNum/selectNum.vue

@@ -70,7 +70,7 @@
70 70
     methods: {
71 71
       onKeyInput: function(event) {
72 72
         this.$nextTick(() => {
73
-        	this.num = parseInt(event.target.value, 10);
73
+        	this.num = Math.abs(parseInt(event.target.value, 10));
74 74
         })
75 75
       },
76 76
       // 确定

+ 35 - 5
pages/medicalWaste/medicalWasteBind/medicalWasteBind.vue

@@ -44,7 +44,7 @@
44 44
           重量:
45 45
         </view>
46 46
         <view class="Scanning_cont_list_desc">
47
-          <input class="deptInput" type="digit" placeholder-style="color:#C3BFBF;font-size:28rpx;padding:8rpx;line-height:1;" @blur="blurWeight" v-model="weight" />kg
47
+          <input class="deptInput" type="digit" placeholder-style="color:#C3BFBF;font-size:28rpx;padding:8rpx;line-height:1;" @input="inputWeight" v-model="weight" />kg
48 48
         </view>
49 49
       </view>
50 50
       <view class="Scanning_cont_list">
@@ -79,7 +79,7 @@
79 79
         remark: '',
80 80
         deptId: null,
81 81
         deptName: '',
82
-        weight: 0,
82
+        weight: '',
83 83
         medicalWasteTypes: [],
84 84
         medicalWasteTypeIndex: 0,
85 85
         hosId: uni.getStorageSync('userData').user.currentHospital.id,
@@ -175,7 +175,7 @@
175 175
                           // 新增
176 176
                           this.id = undefined;
177 177
                           this.queryObj.qrcode = res.code;
178
-                          this.weight = 0;
178
+                          this.weight = '';
179 179
                           this.medicalWasteTypeIndex = 0;
180 180
                           this.remark = '';
181 181
                         }
@@ -265,6 +265,36 @@
265 265
           });
266 266
           return;
267 267
         }
268
+        if(this.weight === ''){
269
+          uni.showModal({
270
+            title: "提示",
271
+            content: "请填写重量!",
272
+            showCancel: false,
273
+            success: function(res) {
274
+              if (res.confirm) {
275
+                console.log("用户点击确定");
276
+              } else if (res.cancel) {
277
+                console.log("用户点击取消");
278
+              }
279
+            },
280
+          });
281
+          return;
282
+        }
283
+        if(!(/^\d+(\.\d{1,2})?$/.test(this.weight))){
284
+          uni.showModal({
285
+            title: "提示",
286
+            content: "重量只支持最多两位小数!",
287
+            showCancel: false,
288
+            success: function(res) {
289
+              if (res.confirm) {
290
+                console.log("用户点击确定");
291
+              } else if (res.cancel) {
292
+                console.log("用户点击取消");
293
+              }
294
+            },
295
+          });
296
+          return;
297
+        }
268 298
         let postData = {
269 299
             clinicalWasteTypeId: this.medicalWasteTypes[this.medicalWasteTypeIndex].id,
270 300
             weight: +this.weight,
@@ -308,8 +338,8 @@
308 338
           url: `/pages/search/search?type=medicalWasteBind&code=${this.queryObj.qrcode}&remark=${this.remark}&weight=${this.weight}&medicalWasteTypeIndex=${this.medicalWasteTypeIndex}`,
309 339
         });
310 340
       },
311
-      blurWeight(){
312
-        this.weight = Math.abs(this.weight).toFixed(2)
341
+      inputWeight(){
342
+        this.weight = this.weight ? Math.abs(parseFloat(this.weight)) : '';
313 343
       },
314 344
       bindMedicalWasteType: function(e) {
315 345
           console.log('picker发送选择改变,携带值为', e.detail.value)