Ver código fonte

tree.vue界面功能修改

duy 6 dias atrás
pai
commit
9775567cd9
1 arquivos alterados com 1 adições e 102 exclusões
  1. 1 102
      src/views/manager/projectinfo/tree.vue

+ 1 - 102
src/views/manager/projectinfo/tree.vue

@@ -3075,108 +3075,7 @@ export default {
       
       }
     },
-     // 重新加载整棵树
-// async reloadEntireTree() {
-//   this.isNodeType = false;
-  
-//   // 1. 保存当前选中节点key和路径
-//   const tree = this.$refs.treeByType;
-//   if (!tree) return;
-  
-//   const currentKey = tree.getCurrentKey();
-//   let nodePath = [];
-//   if (currentKey) {
-//     const currentNode = tree.getNode(currentKey);
-//     if (currentNode) {
-//       // 获取选中节点的所有父节点路径
-//       let parent = currentNode.parent;
-//       while (parent && parent.level > 0) {
-//         nodePath.unshift(parent.data.id);
-//         parent = parent.parent;
-//       }
-//     }
-//   }
-  
-//   // 2. 清空缓存并记录所有已展开节点(用于后续重置)
-//   const previouslyExpandedNodes = [];
-//   const collectExpandedNodes = (node) => {
-//     if (node.expanded && node.level > 0) {
-//       previouslyExpandedNodes.push(node.data.id);
-//     }
-//     if (node.childNodes) {
-//       node.childNodes.forEach(collectExpandedNodes);
-//     }
-//   };
-//   collectExpandedNodes(tree.store.root);
-  
-//   this.cachedNodes.clear();
-  
-//   // 3. 清空根节点子节点
-//   const rootNode = tree.store.root;
-//   const rootId = rootNode.childNodes[0].data.id || 'root';
-//   await this.$nextTick();
-//   tree.updateKeyChildren(rootId, []);
-  
-//   // 4. 强制重新加载根节点
-//   const root = tree.getNode(rootId);
-//   if (root) {
-//     root.loaded = false;
-//     root.expand(); // 这会触发loadNodeByType
-//   }
-  
-//   // 5. 等待树重新加载完成
-//   await new Promise(resolve => {
-//     const checkLoaded = () => {
-//       if (root.loaded) {
-//         resolve();
-//       } else {
-//         setTimeout(checkLoaded, 50);
-//       }
-//     };
-//     checkLoaded();
-//   });
-  
-//   // 6. 重置其他节点的加载状态(使其下次展开时重新加载)
-//   previouslyExpandedNodes.forEach(nodeId => {
-//     // 跳过当前选中节点的路径节点
-//     if (!nodePath.includes(nodeId)) {
-//       const node = tree.getNode(nodeId);
-//       if (node) {
-//         node.loaded = false; // 标记为未加载
-//         node.expanded = false; // 关闭节点
-//         // 从缓存中移除(如果存在)
-//         this.cachedNodes.delete(nodeId);
-//       }
-//     }
-//   });
-  
-//   // 7. 恢复选中节点路径的展开状态
-//   this.defaultExpandedKeysType = [...nodePath];
-//   for (const key of nodePath) {
-//     const node = tree.getNode(key);
-//     if (node && !node.expanded) {
-//       node.expand();
-//       await new Promise(resolve => setTimeout(resolve, 100));
-//     }
-//   }
-  
-//   // 8. 恢复选中状态
-//   if (currentKey) {
-//     tree.setCurrentKey(currentKey);
-//     await this.$nextTick();
-    
-//     const currentNode = tree.getNode(currentKey);
-//     if (currentNode) {
-//       this.currentNodeData = currentNode.data;
-//       const highlightedEl = document.querySelector('.el-tree--highlight-current .is-current');
-//       this.formData = highlightedEl ? 
-//         [{...this.currentNodeData, tableName: this.currentNodeData.title}] : 
-//         [];
-//     } else {
-//       this.formData = [];
-//     }
-//   }
-// },
+
 async reloadEntireTree() {
   this.isNodeType = false;