src/views/archiveManagement/index.vue
@@ -201,15 +201,14 @@
    ElMessage.error("操作失败,请稍后重试");
  }
};
// 当前组件的数据
const initTreeData = ref([]); // 树形数据
const centerDialogVisible = (val) => {
  dialogVisible.value = val;
};
const tableSwitch = ref(false);
// 处理节点点击
const handleNodeClick = (data) => {
  initTreeData.value = data || [];
  console.log("点击节点", data);
  tableSwitch.value = true;
  // 切换节点时重置到第一页
  queryParams.current = 1;
@@ -227,7 +226,7 @@
    // 确保组件引用存在后再调用方法
    nextTick(() => {
      if (archiveDialogs.value && typeof archiveDialogs.value.initForm === 'function') {
        archiveDialogs.value.initForm(initTreeData); // 重置表单
        archiveDialogs.value.initForm(); // 重置表单
      }
    });
  } catch (error) {
@@ -489,15 +488,16 @@
    const hasChildren = data.children;
    const nodeKey = data.id || data;
    const node = treeRef.value?.getNode(nodeKey);
    const isExpanded = node?.expanded;
    // 如果有子级且未展开,先展开节点
    const isExpanded = node?.expanded; // 如果有子级且未展开,先展开节点
    if (hasChildren && !isExpanded) {
      if (treeRef.value && treeRef.value.store && treeRef.value.store.nodesMap[nodeKey]) {
      if (
          treeRef.value &&
          treeRef.value.store &&
          treeRef.value.store.nodesMap[nodeKey]
      ) {
        treeRef.value.store.nodesMap[nodeKey].expanded = true;
      }
    }
    const newNode = {
      name: "新子节点",
      isEdit: true,
@@ -508,12 +508,6 @@
    }
    data.children.push(newNode);
    newName.value = "新子节点";
    // 确保父节点展开
    if (node) {
      node.expanded = true;
      expandParentNodes(node);
    }
    // 根据是否需要展开来决定延迟时间
    const delay = hasChildren && !isExpanded ? 200 : 50;