修复工作空间结果日期重复问题
This commit is contained in:
@@ -308,9 +308,18 @@ const loadMoreWorkspace = async () => {
|
||||
return;
|
||||
}
|
||||
workspacePage.value = nextPage;
|
||||
// 追加新数据到现有 treeNodes
|
||||
const newNodes = buildTreeNodes(newTree);
|
||||
treeNodes.value = [...treeNodes.value, ...newNodes];
|
||||
// 合并跨页重复的日期分组
|
||||
const lastExisting = treeNodes.value[treeNodes.value.length - 1];
|
||||
const firstNew = newNodes[0];
|
||||
if (lastExisting && firstNew && lastExisting.label === firstNew.label) {
|
||||
const existingIds = new Set((lastExisting.children || []).map((c) => c.backendId));
|
||||
const uniqueChildren = (firstNew.children || []).filter((c) => !existingIds.has(c.backendId));
|
||||
lastExisting.children!.push(...uniqueChildren);
|
||||
treeNodes.value.push(...newNodes.slice(1));
|
||||
} else {
|
||||
treeNodes.value = [...treeNodes.value, ...newNodes];
|
||||
}
|
||||
} catch {
|
||||
// 错误已由全局拦截器处理
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user