Kaynağa Gözat

xzt433,301,266bug修改

黄梓星 2 yıl önce
ebeveyn
işleme
ee8680a66c
1 değiştirilmiş dosya ile 22 ekleme ve 2 silme
  1. 22 2
      src/views/purchase/PurchaseDemandList/add.vue

+ 22 - 2
src/views/purchase/PurchaseDemandList/add.vue

@@ -201,7 +201,7 @@
           <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion">
+                <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion" @change="getYLSL(scope.$index,scope.row.reservedProportion)">
                   <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
                   </el-option>
                 </el-select>
@@ -263,7 +263,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"/>
+                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @change="getYL(scope.$index, scope.row.qty)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -598,6 +598,26 @@ export default {
           return '总供应可满足'
       }
     },
+    // 获取预留数量
+    getYLSL(index,val) {
+      if (val) {
+      let newVal = val.replace('%', '')
+      newVal = newVal/100
+      this.basicForm.puDemandItemList[index].reservedQty = newVal * this.basicForm.puDemandItemList[index].qty
+      } else {
+        this.basicForm.puDemandItemList[index].reservedQty = null
+      }
+    },
+    // 实际业务需求量获取
+    getYL(index, val) {
+      if (val && this.basicForm.puDemandItemList[index].reservedProportion) {
+        let newVal = this.basicForm.puDemandItemList[index].reservedProportion.replace('%', '')
+        newVal = newVal/100
+        this.basicForm.puDemandItemList[index].reservedQty = val * newVal
+      } else {
+        this.basicForm.puDemandItemList[index].reservedQty = null
+      }
+    },
     copy() {
       this.$modal.msgSuccess("复制成功");
       this.sonPageStu = 'add'