瀏覽代碼

'改下单制,下单页面'

魏志佳 4 年之前
父節點
當前提交
5e5c442ce7
共有 1 個文件被更改,包括 31 次插入17 次删除
  1. 31 17
      src/views/modules/workBench/placeOrder.vue

+ 31 - 17
src/views/modules/workBench/placeOrder.vue

@@ -306,7 +306,7 @@
                         </div>
                         <div class="input-item"> 
                             <a-form-model-item ref="materialAmountDay"  prop="materialAmountDay">
-                                <a-input-number :min="1" :max="500"  @change="materialAmountDayChange" v-model="form.materialAmountDay"  />
+                                <a-input-number :min="1" :max="500"  @blur="materialAmountDayChange" v-model="form.materialAmountDay"  />
                             </a-form-model-item>
                         </div>
                     </div>
@@ -464,7 +464,7 @@ export default {
             },
             rules: {
                 orderTitle: [
-                    { required: true, message: '请填写订单名称', trigger: 'blur' },
+                    { required: true, message: '请填写订单标题', trigger: 'blur' },
                     { min: 2, message: '长度不得小于2', trigger: 'blur' },
                 ],
                 sysPackage: [
@@ -551,34 +551,40 @@ export default {
                 this.form.realAmount=0
             }else{
                 if(this.form.materialAmount){
-                    this.form.cutAmount=this.form.materialAmount/2;
-                    this.form.realAmount=this.form.materialAmount/2;
+                    this.form.cutAmount=Math.ceil(this.form.materialAmount/2);
+                    this.form.realAmount=Math.floor(this.form.materialAmount/2);
                 }
                 
             }
         },
         materialAmountDayChange(e){
             console.log(e);
-            if(e>this.form.materialAmount&&this.form.materialAmount){
+            if(e.target.value>this.form.materialAmount&&this.form.materialAmount){
                 this.$message.error('日均产量不能大于素材总量')
                 this.form.materialAmountDay=this.form.materialAmount
             }else if(!this.form.materialAmount){
                  this.$message.error('请先填写素材总量')
-                this.form.materialAmountDay=0
+                this.form.materialAmountDay=undefined
             }
             
         },
         materialTypeChange(e){
             console.log(e.target.value)
             if(e.target.value==1){
-                this.form.realAmount=this.form.materialAmount;
+                this.form.realAmount=this.form.materialAmount?this.form.materialAmount:undefined;
                 this.form.cutAmount=0
             }else if(e.target.value==2){
-                this.form.cutAmount=this.form.materialAmount;
+                this.form.cutAmount=this.form.materialAmount?this.form.materialAmount:undefined;
                 this.form.realAmount=0
-            }else{
-                this.form.cutAmount=this.form.materialAmount/2;
-                this.form.realAmount=this.form.materialAmount/2;
+            }else if(e.target.value==3){
+                if(this.form.materialAmount){
+                    this.form.cutAmount=Math.ceil(this.form.materialAmount/2);
+                    this.form.realAmount=Math.floor(this.form.materialAmount/2);
+                }else{
+                    this.form.cutAmount=undefined;
+                    this.form.realAmount=undefined;
+                }
+                
             }
         },
         realAmountChange(val){
@@ -589,18 +595,26 @@ export default {
                     this.form.realAmount=this.form.materialAmount-1
                 }
                 this.form.cutAmount=this.form.materialAmount-this.form.realAmount
+            }else{
+                this.form.cutAmount=undefined;
+                this.form.realAmount=undefined;
             }
             
         },
         cutAmountChange(val){
             console.log(val);
-            if(this.form.realAmount==null){
-                console.log(1)
-                if(val>this.form.materialAmount){
-                    this.$message.error('数量输入有误,不能超过素材总量哦');
-                    this.form.cutAmount=this.form.materialAmount-1
+            if(this.form.materialAmount){
+                if(this.form.realAmount==null){
+                    console.log(1)
+                    if(val>this.form.materialAmount){
+                        this.$message.error('数量输入有误,不能超过素材总量哦');
+                        this.form.cutAmount=this.form.materialAmount-1
+                    }
+                    this.form.realAmount=this.form.materialAmount-this.form.cutAmount
                 }
-                this.form.realAmount=this.form.materialAmount-this.form.cutAmount
+            }else{
+                this.form.cutAmount=undefined;
+                this.form.realAmount=undefined;
             }
             
         },