人生啊人生 3 hónapja
szülő
commit
61cda198ad

+ 30 - 7
user_web/src/view/admin/components/ManageSchool/ManageCollege.vue

@@ -185,13 +185,7 @@ const pageUpdateEvent = () => {
         // );
 
         let data = [];
-        
-        if (
-            dataOld["0"] != null && dataOld["0"] != undefined
-            && dataOld["0"]["children"] != null && dataOld["0"]["children"] != undefined
-        ) {
-            data = dataOld["0"]["children"];
-        }
+        data = idGetList(dataOld, props.configDb.id);
 
         pageDb = [];
         
@@ -216,6 +210,35 @@ const pageUpdateEvent = () => {
     
 }
 
+
+/**
+ * 找到对应id的children数据
+ * threeArray       当前树结构的数组
+ * id               找到指定id的值
+ * 成功返回数组结构,否则返回空数组
+ */
+const idGetList = (threeArray, id) => {
+
+    let retArray = [];
+
+    for (let i = 0; i < threeArray.length; i++) {
+        let thisThreeArray = threeArray[i];
+        if (thisThreeArray.id == id) {
+
+            if (thisThreeArray["children"] != null && thisThreeArray["children"] != undefined) {
+                let children = thisThreeArray["children"];
+                return children;
+            }
+
+        }
+
+    }
+    
+    return retArray;
+
+}
+
+
 /**
  * 因为接口不是标准的分页接口,是直接返回所有数据的
  * 这里进行单独处理,来展示第几页的数据