Przeglądaj źródła

Merge branch 'master' into kdwc-web

dedsudiyu 2 lat temu
rodzic
commit
74fa07bba5
1 zmienionych plików z 20 dodań i 17 usunięć
  1. 20 17
      src/views/securityCheck/checkRecord/addCheck.vue

+ 20 - 17
src/views/securityCheck/checkRecord/addCheck.vue

@@ -374,23 +374,26 @@ export default {
     },
     treeselect(){
       treeselect().then( data => {
-        // let list = [];
-        // for(let i=0;i<data.data[0].children.length;i++){
-        //   let obj = {
-        //     id:data.data[0].children[i].id,
-        //     label:data.data[0].children[i].label,
-        //   }
-        //   list.push(obj);
-        //   for(let o=0;o<data.data[0].children[i].children.length;o++){
-        //     let obj = {
-        //       id:data.data[0].children[i].children[o].id,
-        //       label:data.data[0].children[i].children[o].label,
-        //     }
-        //     list.push(obj);
-        //   }
-        // }
-        // this.inspectionUnitArrayData = list;
-        this.inspectionUnitArrayData = this.toArray(data.data);
+        let list = [];
+        for(let i=0;i<data.data[0].children.length;i++){
+          let obj = {
+            id:data.data[0].children[i].id,
+            label:data.data[0].children[i].label,
+          }
+          if(data.data[0].children[i].children){
+            for(let o=0;o<data.data[0].children[i].children.length;o++){
+              let objOne = {
+                id:data.data[0].children[i].children[o].id,
+                label:data.data[0].children[i].children[o].label,
+              }
+              list.push(objOne);
+            }
+          }else{
+            list.push(obj);
+          }
+        }
+        this.inspectionUnitArrayData = list;
+        // this.inspectionUnitArrayData = this.toArray(data.data);
       });
     },
     toArray(data){