From ff68f2090efc1726b7b6913f03e26507bcce4f40 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Thu, 21 Nov 2024 18:40:48 +0800 Subject: [PATCH] =?UTF-8?q?style(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B7=A5=E4=BD=9C=E5=8F=B0=E9=A5=BC=E5=9B=BE=E5=A4=9A?= =?UTF-8?q?=E4=BD=99tooltip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workbench/homePage/components/ratioPie.vue | 16 +++++++++++++--- frontend/src/views/workbench/homePage/utils.ts | 12 ++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) 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, + }, })); // 计算总数和图例格式