Browse Source

修复零部件dvp计划编辑dvp零部件编号重复控制套报错

zhangjie 10 months ago
parent
commit
e946ee5630
1 changed files with 21 additions and 12 deletions
  1. 21 12
      src/views/componentsDVP/dvpPlan/editModal/editDvp.vue

+ 21 - 12
src/views/componentsDVP/dvpPlan/editModal/editDvp.vue

@@ -9,7 +9,7 @@
               <a-select-option
                 v-for='item in partInfoList'
                 :key='item.id'
-                :value='item.partCode'
+                :value='item.id'
               >
                 {{ item.partCode }}
               </a-select-option>
@@ -23,7 +23,7 @@
               <a-select-option
                 v-for='item in cascadeList'
                 :key='item.id'
-                :value='item.partName'
+                :value='item.id'
               >
                 {{ item.partName }}
               </a-select-option>
@@ -272,6 +272,7 @@ export default {
      * @param val
      */
     cascadeSelect(val, options) {
+      this.editParam.partName = [];
       if (options && options.length > 0) {
         this.cascadeList = [];
         options.forEach( item => {
@@ -290,9 +291,17 @@ export default {
      * 保存
      */
     saveDvpEdit() {
+      // 零部件编号处理
+      let partCodeList = [];
+      if (this.editParam.partCode && this.editParam.partCode.length > 0) {
+        this.editParam.partCode.forEach(item => {
+          let data = this.partInfoList.find(val => { return val.id === item})?.partCode;
+          partCodeList.push(data);
+        })
+      }
       let data = {
         dvpId: this.$store.getters.dvpId,
-        partCodeList: this.editParam.partCode,
+        partCodeList: partCodeList,
         testType: this.editParam.testType,
         testSource: this.editParam.testSource,
         testProject: this.editParam.testProject,
@@ -309,15 +318,15 @@ export default {
         planEndTime: this.editParam.planEndTime,
         isPush: this.editParam.isPushTemplate || 1
       };
-      this.$api.planTestSave(data).then(res => {
-        if (res.flag) {
-          this.$message.success(res.message);
-          this.$emit("initData");
-          this.$emit("cancelEditDvp");
-        } else {
-          this.$message.error(res.message);
-        }
-      });
+      // this.$api.planTestSave(data).then(res => {
+      //   if (res.flag) {
+      //     this.$message.success(res.message);
+      //     this.$emit("initData");
+      //     this.$emit("cancelEditDvp");
+      //   } else {
+      //     this.$message.error(res.message);
+      //   }
+      // });
     },
 
     /**