diff --git a/frontend/src/views/workbench/homePage/components/ratioPie.vue b/frontend/src/views/workbench/homePage/components/ratioPie.vue index c622336f59..98f2b30116 100644 --- a/frontend/src/views/workbench/homePage/components/ratioPie.vue +++ b/frontend/src/views/workbench/homePage/components/ratioPie.vue @@ -63,8 +63,7 @@ bottom: 40, }, tooltip: { - ...toolTipConfig, - show: !!props.hasPermission, + show: true, }, legend: { orient: 'vertical', @@ -80,6 +79,9 @@ formatter: (name: any) => { return `{a|${name}} {b|${addCommasToNumber(1022220)}}`; }, + tooltip: { + show: false, + }, }, textStyle: { rich: { @@ -138,7 +140,15 @@ function initOptions() { const { name, color } = props.rateConfig; - options.value.series.data = [...props.data.slice(1)]; + options.value.series.data = [...props.data.slice(1)].map((e) => { + return { + ...e, + tooltip: { + ...toolTipConfig, + show: !!props.hasPermission, + }, + }; + }); options.value.legend.formatter = (seriousName: string) => { const item = props.data.find((e) => e.name === seriousName); diff --git a/frontend/src/views/workbench/homePage/utils.ts b/frontend/src/views/workbench/homePage/utils.ts index a8ce89ed23..471cc318ba 100644 --- a/frontend/src/views/workbench/homePage/utils.ts +++ b/frontend/src/views/workbench/homePage/utils.ts @@ -293,12 +293,7 @@ export function getPieCharOptions(key: WorkCardEnum, hasPermission: boolean) { textAlign: 'center', // 确保副标题居中 }, color: colorMapConfig[key], - tooltip: { - ...toolTipConfig, - trigger: 'item', - position: 'right', - show: !!hasPermission, - }, + tooltip: { show: true }, legend: { width: '100%', height: 128, @@ -470,6 +465,11 @@ export function handlePieData( options.series.data = lastStatusPercentList.map((item) => ({ name: item.status, value: item.count, + tooltip: { + ...toolTipConfig, + position: 'right', + show: !!hasPermission, + }, })); // 计算总数和图例格式