| | |
| | | }; |
| | | // 更新树形结构和工作流列表 |
| | | 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 |
| | |
| | | // 合并子节点的工作流列表,并更新组名 |
| | | byParentData.forEach((item) => { |
| | | 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})`; |