浏览代码

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002390 2 年之前
父节点
当前提交
ca7e735846
共有 1 个文件被更改,包括 28 次插入4 次删除
  1. 28 4
      src/views/purchase/PurchaseDemandList/add.vue

+ 28 - 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"/>
@@ -201,7 +202,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 +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"/>
+                <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() {
@@ -598,6 +601,27 @@ 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 (this.basicForm.puDemandItemList[index].qty && this.basicForm.puDemandItemList[index].reservedProportion) {
+        let newVal = this.basicForm.puDemandItemList[index].reservedProportion.replace('%', '')
+        newVal = newVal/100
+        // 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
+      }
+    },
     copy() {
       this.$modal.msgSuccess("复制成功");
       this.sonPageStu = 'add'
@@ -933,7 +957,7 @@ export default {
       this.basicForm.puDemandItemList[this.tableIndex].contacts = null
       this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
       this.basicForm.puDemandItemList[this.tableIndex].address = null
-      this.basicForm.puDemandItemList[this.tableIndex].priceType = null
+      this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
       this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
       this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
       this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null