yangyin
2024-12-13 a6266ae4d5e642eaca0f28d107cf6ce72cd618d6
src/views/project/yw/dataManage/workFlowMgr/WorkFlowIndex.vue
@@ -194,14 +194,12 @@
};
// 更新树形结构和工作流列表
const updateSampleListsAndGroupNames = (tree_Data, work_Data) => {
   console.log('🚀 ~ work_Data:', work_Data);
   let new_tree_Data = [];
   tree_Data.forEach((node, index) => {
      if (node.group_type == OptClassificationMap[classificationEnum.Knowledge]) {
         new_tree_Data.push(node);
      }
   });
   console.log('🚀 ~ new_tree_Data:', new_tree_Data);
   // 为每个节点关联工作流数据
   new_tree_Data.forEach((node) => {
      node.sampleList = work_Data
@@ -225,9 +223,8 @@
      ParentID: 'p_group_id',
      Children: 'children',
   });
   // 合并子节点的工作流列表,并更新组名
   byParentData.forEach((item) => {
   const updatedByParentData = byParentData.reduce((accumulator, item) => {
      // 处理子节点,累加sampleList
      if (item.children && item.children.length > 0) {
         item.children.forEach((child_node) => {
            item.sampleList = item.sampleList.concat(child_node.sampleList);
@@ -235,9 +232,13 @@
      }
      // 移除旧的计数并添加新的计数
      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) => {