Ver código fonte

采购需求单需求计划和业务类型联动重新调整V2

黄梓星 1 ano atrás
pai
commit
62565e2edd
1 arquivos alterados com 17 adições e 11 exclusões
  1. 17 11
      src/views/purchase/PurchaseDemandList/add.vue

+ 17 - 11
src/views/purchase/PurchaseDemandList/add.vue

@@ -6,7 +6,7 @@
       <el-row :gutter="10">
         <el-col :span="1.5">
           <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
-            <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="mini" style="width: 200px">
+            <el-select clearable v-model="basicForm.billType" @change="changeBillType(basicForm.billType)" :disabled="sonDisable" size="mini" style="width: 200px">
               <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
               </el-option>
             </el-select>
@@ -44,7 +44,7 @@
 
         <el-col :span="1.5">
           <el-form-item label="需求计划" prop="planType" :rules="{ required: true, message: '请选择需求计划', trigger: 'blur' }">
-            <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType()">
+            <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType(basicForm.planType)">
               <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
               </el-option>
             </el-select>
@@ -837,14 +837,17 @@ export default {
       }
     },
     // 改变需求计划改变需求日期
-    changeplanType() {
+    changeplanType(val) {
       this.dafaultDate()
-      if (this.basicForm.planType == 'JJXQ') {
+      console.log(val)
+      if (val == 'JJXQ') {
         this.basicForm.billType = 'JJXQ'
       } else {
-        this.basicForm.billType = 'BDXQ'
+        if (this.basicForm.billType == 'JJXQ') {
+          this.basicForm.billType = ''
+        }
       }
-      if (this.basicForm.planType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
+      if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
         this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
       } else {
         this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'N'})
@@ -868,8 +871,9 @@ export default {
       })
     },
     // 更改业务类型调整明细行内补单或紧急标识
-    changeBillType() {
-      if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
+    changeBillType(val) {
+      console.log(val)
+      if (val == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
         this.isBDXQ = true
         this.BDZT = false
         this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
@@ -882,12 +886,14 @@ export default {
           item.additionalSupplierName = null
         })
       }
-      if (this.basicForm.billType == 'JJXQ') {
+      if (val == 'JJXQ') {
         this.basicForm.planType = 'JJXQ'
       } else {
-        this.basicForm.planType = 'ZJH'
+        if (this.basicForm.planType == 'JJXQ') {
+          this.basicForm.planType = ''
+        }
       }
-      if (this.basicForm.billType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
+      if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
         this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
       } else {
         this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })