yangyin
2024-12-16 999edd29f1ca3d1560693a0259650069d1b7e29b
src/views/project/yw/dataManage/workFlowMgr/WorkFlowIndex.vue
@@ -136,7 +136,6 @@
import { useCompRef } from '/@/utils/types';
import { convertListToTree, debounce, travelTree } from '/@/utils/util';
import { SupervisorPublished, supervisorPublishedMap } from '/@/views/project/yw/lowCode/sqlAmis/types';
import { OptClassificationMap, classificationEnum } from '/@/views/types/metrics';
//#region ====================== 左侧树数据,tree init ======================
const leftTreeRef = useCompRef(LeftTreeByMgr);
const treeLoading = ref(false);
@@ -196,9 +195,7 @@
const updateSampleListsAndGroupNames = (tree_Data, work_Data) => {
   let new_tree_Data = [];
   tree_Data.forEach((node, index) => {
      if (node.group_type == OptClassificationMap[classificationEnum.Knowledge]) {
         new_tree_Data.push(node);
      }
      new_tree_Data.push(node);
   });
   // 为每个节点关联工作流数据
   new_tree_Data.forEach((node) => {
@@ -223,17 +220,22 @@
      ParentID: 'p_group_id',
      Children: 'children',
   });
   // 合并子节点的工作流列表,并更新组名
   byParentData.forEach((item) => {
   const updatedByParentData = byParentData.reduce((accumulator, item) => {
      // 处理子节点,累加sampleList
      if (item.children && item.children.length > 0) {
         item.sampleList = item.children.reduce((acc, child_node) => acc.concat(child_node.sampleList), []);
         item.children.forEach((child_node) => {
            item.sampleList = item.sampleList.concat(child_node.sampleList);
         });
      }
      // 移除旧的计数并添加新的计数
      item.group_name = item.group_name.replace(/ \([^)]*\)$/, '') + ` (${item.sampleList.length})`;
   });
      // 将当前项添加到累加器中
      accumulator.push(item);
      // 返回累加器
      return accumulator;
   }, []); // 初始化累加器为空数组
   return byParentData;
   return updatedByParentData;
};
// 插入一条数据时调用
const addDataAndRecalculateGroupNames = (new_tree_Data, work_Data, newWorkData) => {