diff --git a/frontend/src/features/usage/components/IntervalTimelineCard.vue b/frontend/src/features/usage/components/IntervalTimelineCard.vue index 938331a..357dcc0 100644 --- a/frontend/src/features/usage/components/IntervalTimelineCard.vue +++ b/frontend/src/features/usage/components/IntervalTimelineCard.vue @@ -2,9 +2,9 @@

{{ title }}

-
+
@@ -14,6 +14,9 @@ /> {{ item.name }}
+ + +{{ hiddenLegendCount }} 更多 +
@@ -92,6 +95,9 @@ const hasMultipleGroups = computed(() => { } }) +// 图例最多显示数量 +const MAX_LEGEND_ITEMS = 6 + // 图例项(管理员显示用户,普通用户显示模型) const legendItems = computed(() => { if (props.isAdmin && timelineData.value?.users) { @@ -114,6 +120,16 @@ const legendItems = computed(() => { return [] }) +// 显示的图例项(限制数量) +const displayLegendItems = computed(() => { + return legendItems.value.slice(0, MAX_LEGEND_ITEMS) +}) + +// 隐藏的图例数量 +const hiddenLegendCount = computed(() => { + return Math.max(0, legendItems.value.length - MAX_LEGEND_ITEMS) +}) + // 格式化模型名称,使其更简洁 function formatModelName(model: string): string { // 常见的简化规则