黄梓星 2 жил өмнө
parent
commit
4b51c91bf7

+ 47 - 65
src/views/purchase/PurchaseDemandList/add.vue

@@ -162,7 +162,6 @@
           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"/>
@@ -199,31 +198,6 @@
               </el-form-item>
             </template>
           </el-table-column>
-          <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" @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>
-                <!-- <el-input v-model="scope.row.reservedProportion"/> -->
-              </el-form-item>
-            </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
-            <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
-              </el-form-item>
-            </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip label="预留数量" align="center"  prop="reservedQty" width="150px">
-            <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-input readonly size="small" v-model="scope.row.reservedQty"/>
-              </el-form-item>
-            </template>
-          </el-table-column>
           <el-table-column show-overflow-tooltip label="采购员名称" align="center" prop="buyerName" width="120px"/>
           <el-table-column show-overflow-tooltip label="采购员" align="center"  prop="buyer"/>
           <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
@@ -260,11 +234,36 @@
               </el-form-item>
             </template>
           </el-table-column>
+            <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" @change="getYLSL(scope)">
+                    <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
+                    </el-option>
+                  </el-select>
+                  <!-- <el-input v-model="scope.row.reservedProportion"/> -->
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
+              <template slot-scope="scope">
+                <el-form-item class="hang">
+                  <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column show-overflow-tooltip label="预留数量" align="center"  prop="reservedQty" width="150px">
+              <template slot-scope="scope">
+                <el-form-item class="hang">
+                  <el-input readonly size="small" v-model="scope.row.reservedQty"/>
+                </el-form-item>
+              </template>
+            </el-table-column>
           <el-table-column show-overflow-tooltip label="月均销量" align="center"  prop="averageQtyMonth" width="120px"/>
           <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" @blur="getYL(scope.$index, scope.row.qty)"/>
+                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @input="getYLSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -540,11 +539,11 @@ export default {
         isPage: true,
         title: '',
       },
-      referConditionMx: {
-        type: '',
-        isPage: true,
-        title: '',
-      },
+      // referCondition: {
+      //   type: '',
+      //   isPage: true,
+      //   title: '',
+      // },
       tableIndex: null,
       orgOptions: [],
       personOptions: [],
@@ -602,25 +601,8 @@ export default {
       }
     },
     // 获取预留数量
-    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
-      }
+    getYLSL(scope) {
+      scope.row.reservedQty = scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty
     },
     copy() {
       this.$modal.msgSuccess("复制成功");
@@ -902,25 +884,25 @@ export default {
         this.deptOptions = selection
         this.basicForm.demandDept = selection[0].id
       }
-      // if(this.referConditionMx.type == 'DEPT_PARAM') {
+      // if(this.referCondition.type == 'DEPT_PARAM') {
       //   this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
       //   this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
       // }
-      if(this.referConditionMx.title == '选择收货仓库') {
+      if(this.referCondition.title == '选择收货仓库') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
       }
-      if(this.referConditionMx.title == '选择收货货位') {
+      if(this.referCondition.title == '选择收货货位') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
       }
-      if(this.referConditionMx.title == '选择补单供应商') {
+      if(this.referCondition.title == '选择补单供应商') {
         this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].code
         this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
       }
-      if(this.referConditionMx.title == '选择收货地址') {
+      if(this.referCondition.title == '选择收货地址') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
         this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
@@ -1002,21 +984,21 @@ export default {
     // 明细行选择业务部门参照带出业务部门数据
     chooseDept(index, type, isPage, title) {
       this.tableIndex = index
-      this.referConditionMx.type = type
-      this.referConditionMx.isPage = isPage
-      this.referConditionMx.title = title
-      this.$refs.refer.init(this.referConditionMx)
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.refer.init(this.referCondition)
     },
     // 明细行选择业务部门参照带出业务部门数据
     choosehuoWei(index, type, isPage, title, stordocId) {
       this.tableIndex = index
-      this.referConditionMx.type = type
-      this.referConditionMx.isPage = isPage
-      this.referConditionMx.title = title
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
       // 选择收货货位前先选择收货仓库
       if(stordocId) {
-        this.referConditionMx.stordocId = stordocId
-        this.$refs.refer.init(this.referConditionMx)
+        this.referCondition.stordocId = stordocId
+        this.$refs.refer.init(this.referCondition)
       } else {
         this.$modal.msgWarning("请先选择收货仓库");
       }

+ 9 - 2
src/views/purchase/transferOrder/add.vue

@@ -254,7 +254,7 @@
           <el-table-column show-overflow-tooltip label="数量" align="center" prop="qty" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input :readonly="sonDisable" size="small" v-model="scope.row.qty"/>
+                <el-input :readonly="sonDisable" clearable size="small" v-model="scope.row.qty" @input="getSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -263,7 +263,7 @@
           <el-table-column show-overflow-tooltip label="主数量" align="center" prop="mainQty" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input :readonly="sonDisable" size="small" v-model="scope.row.mainQty"/>
+                <el-input :readonly="sonDisable" clearable size="small" v-model="scope.row.mainQty" @input="getZSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -716,6 +716,13 @@ export default {
     }
   },
   methods: {
+    // 输入数量或者主数量同步改变
+    getZSL(scope) {
+      scope.row.qty = scope.row.mainQty
+    },
+    getSL(scope) {
+      scope.row.mainQty = scope.row.qty
+    },
     copy() {
 
     },