黄梓星 2 жил өмнө
parent
commit
93197658b5

+ 8 - 4
src/views/purchase/PurchaseDemandList/add.vue

@@ -162,6 +162,7 @@
           fit
           max-height="300"
           @selection-change="handleSelectionChange"
+          :key="refreshData"
         >
           <el-table-column show-overflow-tooltip type="selection"/>
           <el-table-column show-overflow-tooltip label="序号" type="index" align="center"/>
@@ -263,7 +264,7 @@
           <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center"  prop="qty" width="120px">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
-                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @change="getYL(scope.$index, scope.row.qty)"/>
+                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @blur="getYL(scope.$index, scope.row.qty)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -549,7 +550,9 @@ export default {
       personOptions: [],
       deptOptions: [],
       customerOptions: [],
-      isBDXQ: false
+      isBDXQ: false,
+      // 刷新表格数据
+      refreshData: 0
     }
   },
   created() {
@@ -610,10 +613,11 @@ export default {
     },
     // 实际业务需求量获取
     getYL(index, val) {
-      if (val && this.basicForm.puDemandItemList[index].reservedProportion) {
+      if (this.basicForm.puDemandItemList[index].qty && this.basicForm.puDemandItemList[index].reservedProportion) {
         let newVal = this.basicForm.puDemandItemList[index].reservedProportion.replace('%', '')
         newVal = newVal/100
-        this.basicForm.puDemandItemList[index].reservedQty = val * newVal
+        // this.$set(this.basicForm.puDemandItemList[index].reservedQty, this.basicForm.puDemandItemList[index].qty * newVal)
+        this.basicForm.puDemandItemList[index].reservedQty = this.basicForm.puDemandItemList[index].qty * newVal
       } else {
         this.basicForm.puDemandItemList[index].reservedQty = null
       }