Преглед на файлове

bug:默认数据添加失败修复

reaper преди 4 години
родител
ревизия
21ce96537a
променени са 1 файла, в които са добавени 14 реда и са изтрити 13 реда
  1. 14 13
      src/components/cdssManage/plan/AddPlan.vue

+ 14 - 13
src/components/cdssManage/plan/AddPlan.vue

@@ -93,8 +93,8 @@
             width: 60px;
           }
         }
-        .list_right1{
-          width: calc(100% );
+        .list_right1 {
+          width: calc(100%);
         }
       }
     }
@@ -294,7 +294,7 @@
                           </div>
                         </div>
                       </div>
-                      <div v-else style="width:100%">
+                      <div v-else style="width: 100%">
                         <div
                           class="list_right list_right1"
                           v-for="child in item.list"
@@ -620,16 +620,17 @@ export default {
           this.form.planDetailSub.push(item);
         } else {
           // 第一层数据存在,验证第二层
-          item.planDetails.forEach((child) => {
-            const childIndex = this.form.planDetailSub[
-              oneIndex
-            ].planDetails.findIndex((it) => it.name === child.name);
-            // 第二层数据不存在,直接添加进去
-            if (childIndex === -1) {
-              child.status = 0;
-              this.form.planDetailSub[oneIndex].planDetails.push(child);
-            }
-          });
+          item.planDetails &&
+            item.planDetails.forEach((child) => {
+              const childIndex = this.form.planDetailSub[
+                oneIndex
+              ].planDetails.findIndex((it) => it.name === child.name);
+              // 第二层数据不存在,直接添加进去
+              if (childIndex === -1) {
+                child.status = 0;
+                this.form.planDetailSub[oneIndex].planDetails.push(child);
+              }
+            });
         }
       });
       // 排序