Kaynağa Gözat

材料请购单-换算率不可更改

jingbb 1 yıl önce
ebeveyn
işleme
e5a89021a8

+ 12 - 4
src/views/production/materialprocurement/modules/materialProcurementAdd.vue

@@ -132,7 +132,7 @@
             </template>
             <template slot="quantity" slot-scope="text, record, index">
                 <a-form-model-item prop="quantity" class='sonItem'>
-                    <a-input placeholder="请输入" v-model="record.quantity"></a-input>
+                    <a-input placeholder="请输入" v-model="record.quantity" @blur="chengQuantity(record)"></a-input>
                 </a-form-model-item>
             </template>
             <template slot="rate" slot-scope="text, record, index">
@@ -147,7 +147,7 @@
             </template>
             <template slot="unQuantity" slot-scope="text, record, index">
                 <a-form-model-item prop="unQuantity" class='sonItem'>
-                    <a-input placeholder="请输入" v-model="record.unQuantity"></a-input>
+                    <a-input placeholder="请输入" v-model="record.unQuantity" @blur="chengQuantity(record)"></a-input>
                 </a-form-model-item>
             </template>
             <template slot="specs" slot-scope="text, record, index">
@@ -418,7 +418,6 @@
                     align:"center",
                     dataIndex: 'rate',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'rate' } 
 
                 },
                 {
@@ -696,7 +695,7 @@
                 })
             },
             addList(){
-                this.dataSource.unshift({rowNo: this.dataSource.length+1,projectCode:this.form.projectCode,projectName:this.form.projectName})
+                this.dataSource.unshift({rowNo: this.dataSource.length+1,projectCode:this.form.projectCode,projectName:this.form.projectName,rate:''})
             },
             onSearchProject(){
                 this.$refs.projectPopup.visible = true
@@ -724,6 +723,15 @@
                     item.projectName = data.Name
                 })
             },
+            chengQuantity(record){
+                if(record.quantity&&record.quantity!==''&&record.unQuantity&&record.unQuantity!==''){
+                    record.rate = ''
+                    var num = (Number(record.unQuantity)/Number(record.quantity)).toFixed(2)
+                    this.$set(record,'rate',num)
+                }else{
+                    record.rate = ''
+                }
+            },
             okDataInvent(data,recoerd){
               this.$set(recoerd,'inventoryCode',data.Code)
               this.$set(recoerd,'inventoryName',data.Name)