瀏覽代碼

材料出库单/生产总订单-主数量辅数量相互转换

jingbb 10 月之前
父節點
當前提交
9000d1383f

+ 22 - 2
src/views/production/materialprocurement/modules/materialProcurementAdd.vue

@@ -146,12 +146,12 @@
             </template>
             <template slot="quantity" slot-scope="text, record, index">
                 <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules1.quantity">
-                    <a-input placeholder="请输入" v-model="record.quantity" @blur="chengQuantity(record)"></a-input>
+                    <a-input placeholder="请输入" v-model="record.quantity" @blur="chengQuantity(record)" @change="getUnQuan(record)"></a-input>
                 </a-form-model-item>
             </template>
             <template slot="unQuantity" slot-scope="text, record, index">
                 <a-form-model-item  :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules1.unQuantity">
-                    <a-input placeholder="请输入" v-model="record.unQuantity" @blur="chengQuantity(record)"></a-input>
+                    <a-input placeholder="请输入" v-model="record.unQuantity" @blur="chengQuantity(record)" @change="getQuan(record)"></a-input>
                 </a-form-model-item>
             </template>
             <template slot="rate" slot-scope="text, record, index">
@@ -315,6 +315,7 @@
             visible:false,
             form:{state:"开立"},
             defaultMethod:'add',
+            disableMixinCreated:'1',
             formTable:{
                 dataSource:[],
             },
@@ -614,6 +615,22 @@
                 this.formTable.dataSource = [] 
                 this.form={}
             },
+            //改变主数量计算辅数量
+            getUnQuan(record){
+                record.rate = 0.5
+                if(record.rate){
+                    var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
+                    this.$set(record,'unQuantity',num)
+                }
+            },
+            //改变辅数量计算主数量
+            getQuan(record){
+                record.rate = 0.5
+                if(record.rate){
+                    var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
+                    this.$set(record,'quantity',numUn)
+                }
+            },
             handleOk(){
                 this.$refs.form.validate(success => {
                     if (success) {
@@ -761,6 +778,9 @@
               this.$set(recoerd,'unit',data.unit )
               this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
               this.$set(recoerd,'inventory',data.ID )
+              this.$set(recoerd,'quantity','' )
+              this.$set(recoerd,'unQuantity','')
+              this.$set(recoerd,'rate',data.rate)
               this.$refs.formRef.clearValidate(['inventoryName']);
             },
             okDataDeparment(data){

+ 25 - 3
src/views/production/productionTotalOrder/modules/SurplusMaterials.vue

@@ -36,12 +36,12 @@
                 </template>
                 <template slot="quantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
-                        <a-input placeholder="请输入" v-model="record.quantity" ></a-input>
+                        <a-input placeholder="请输入" v-model="record.quantity" @change="changeQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="unQuantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
-                        <a-input placeholder="请输入" v-model="record.unQuantity" ></a-input>
+                        <a-input placeholder="请输入" v-model="record.unQuantity" @change="changeUnQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="model" slot-scope="text, record, index">
@@ -277,7 +277,7 @@
                     dataIndex: 'unQuantity',
                     ellipsis: true,
                     scopedSlots: { customRender: 'unQuantity' } ,
-                    slots:{title:'quantityTitle'},
+                    slots:{title:'unQuantityTitle'},
                 },
                 {
                     title: '规格',
@@ -475,6 +475,7 @@
                     ellipsis: true
                 },
           ],
+        disableMixinCreated:'1',
         rules:{
             quantity:{required:true,message:"不可为空"},
             unQuantity:{required:true,message:"不可为空"},
@@ -495,6 +496,24 @@
         addList(projectCode,projectName){
             this.form.dataSource.unshift({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
         },
+        //改变主数量计算辅数量
+        changeQuantity(record){
+            record.rate = 0.5
+            if(record.rate){
+                var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
+                this.$set(record,'unQuantity',num)
+            }
+            
+        },
+        //改变辅数量计算主数量
+        changeUnQuantity(record){
+            record.rate = 0.5
+            if(record.rate){
+                var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
+                this.$set(record,'quantity',numUn)
+            }
+            
+        },
         validateList(){
             let flag = null
             this.$refs.formRef.validate(valid =>{
@@ -531,6 +550,9 @@
             this.$set(recoerd,'unit',data.unit)
             this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
             this.$set(recoerd,'inventory',data.ID )
+            this.$set(recoerd,'quantity','' )
+            this.$set(recoerd,'unQuantity','')
+            this.$set(recoerd,'rate',data.rate)
         },
         //杂发/杂收
         sendOrReceive(data){

+ 20 - 2
src/views/production/productionTotalOrder/modules/material.vue

@@ -36,12 +36,12 @@
                 </template>
                 <template slot="quantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
-                        <a-input placeholder="请输入" v-model="record.quantity"  @blur="changeQuantity(record)"></a-input>
+                        <a-input placeholder="请输入" v-model="record.quantity"  @blur="changeQuantity(record)" @change="getUnQuan(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="unQuantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
-                        <a-input placeholder="请输入" v-model="record.unQuantity"  @blur="changeUQuantity(record)"></a-input>
+                        <a-input placeholder="请输入" v-model="record.unQuantity"  @blur="changeUQuantity(record)" @change="getQuan(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="model" slot-scope="text, record, index">
@@ -192,6 +192,7 @@
             dataSource:[],
         },
         planOrg:'',
+        disableMixinCreated:'1',
         columns: [
                 {
                     title: '行号',
@@ -514,6 +515,20 @@
                 this.$message.warning('主数量不可小于已执行主数量!')
             }
         },
+        //改变主数量计算辅数量
+        getUnQuan(record){
+            if(record.rate){
+                var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
+                this.$set(record,'unQuantity',num)
+            }
+        },
+        //改变辅数量计算主数量
+        getQuan(record){
+            if(record.rate){
+                var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
+                this.$set(record,'quantity',numUn)
+            }
+        },
         changeUQuantity(record){
             if(record.unQuantity&&record.unQuantityExecute&&(Number(record.unQuantity)<Number(record.unQuantityExecute))){
                 record.unQuantity = ''
@@ -537,6 +552,9 @@
             this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
             this.$set(recoerd,'attribute',data.Code1 )
             this.$set(recoerd,'inventory',data.ID )
+            this.$set(recoerd,'quantity','' )
+            this.$set(recoerd,'unQuantity','')
+            this.$set(recoerd,'rate',data.rate)
         },
     },
   

+ 22 - 2
src/views/production/productionTotalOrder/modules/productDetails.vue

@@ -56,12 +56,12 @@
                 </template> 
                 <template slot="quantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
-                        <a-input placeholder="请输入" v-model="record.quantity" ></a-input>
+                        <a-input placeholder="请输入" v-model="record.quantity" @change="changeQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="unQuantity" slot-scope="text, record, index">
                     <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
-                        <a-input placeholder="请输入" v-model="record.unQuantity" ></a-input>
+                        <a-input placeholder="请输入" v-model="record.unQuantity" @change="changeUnQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="quantityExecuteIn" slot-scope="text, record, index">
@@ -236,6 +236,7 @@
         form:{
             dataSource:[],
         },
+        disableMixinCreated:'1',
         columns: [
                 {
                     title: '行号',
@@ -559,6 +560,22 @@
         addList(projectCode,projectName){
             this.form.dataSource.unshift({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
         },
+        //改变主数量计算辅数量
+        changeQuantity(record){
+            if(record.rate){
+                var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
+                this.$set(record,'unQuantity',num)
+            }
+            
+        },
+        //改变辅数量计算主数量
+        changeUnQuantity(record){
+            if(record.rate){
+                var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
+                this.$set(record,'quantity',numUn)
+            }
+            
+        },
         onSearchInven(record){
             if(!this.planOrg||this.planOrg==''){
                 this.$message.warning('请选择生产组织!')
@@ -587,6 +604,9 @@
             this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
             this.$set(recoerd,'attribute',data.Code1 )
             this.$set(recoerd,'inventory',data.ID )
+            this.$set(recoerd,'quantity','' )
+            this.$set(recoerd,'unQuantity','')
+            this.$set(recoerd,'rate',data.rate)
         },
         delectRow(){
             if( this.selectedRowKeys.length==0){

+ 1 - 0
src/views/production/productionTotalOrder/productionTotalOrderList.vue

@@ -183,6 +183,7 @@
               queryParam:{},
               selectedRowKeys:[],
               selectedRows:[],
+              disableMixinCreated:'1',
               documentData:[],
               orderDate:[],
               toggleSearchStatus:false,