소스 검색

资料归集,显示至问题

MaiXinRong 2 년 전
부모
커밋
8f135dae59
1개의 변경된 파일13개의 추가작업 그리고 6개의 파일을 삭제
  1. 13 6
      app/public/js/file_detail.js

+ 13 - 6
app/public/js/file_detail.js

@@ -316,13 +316,20 @@ $(document).ready(function() {
             })
             })
         }
         }
         expandByCustom(fun) {
         expandByCustom(fun) {
-            this.expandCache = [];
+            const self = this;
+            const expandCache = [];
+            const expandChildren = function(children) {
+                for (const child of children) {
+                    if (!child.children || child.children.length === 0) continue;
+                    const expand = fun(child);
+                    if (expand) expandCache.push(child.id);
+                    self.filingTree.expandNode(child, expand, false, false);
+                    expandChildren(child.children);
+                }
+            };
             const nodes = this.filingTree.getNodes();
             const nodes = this.filingTree.getNodes();
-            for (const node of nodes) {
-                const expand = fun(node);
-                if (expand) this.expandCache.push(node.id);
-                this.filingTree.expandNode(node, expand, false, false);
-            }
+            expandChildren(nodes);
+            this.expandCache = expandCache;
             setLocalCache(this.expandKey, this.expandCache.join(','));
             setLocalCache(this.expandKey, this.expandCache.join(','));
         }
         }
         moveFiling(node, tree_pid, tree_order) {
         moveFiling(node, tree_pid, tree_order) {