style(工作台): 修复工作台饼图多余tooltip

This commit is contained in:
xinxin.wu 2024-11-21 18:40:48 +08:00 committed by 刘瑞斌
parent 454ccccea8
commit ff68f2090e
2 changed files with 19 additions and 9 deletions

View File

@ -63,8 +63,7 @@
bottom: 40, bottom: 40,
}, },
tooltip: { tooltip: {
...toolTipConfig, show: true,
show: !!props.hasPermission,
}, },
legend: { legend: {
orient: 'vertical', orient: 'vertical',
@ -80,6 +79,9 @@
formatter: (name: any) => { formatter: (name: any) => {
return `{a|${name}} {b|${addCommasToNumber(1022220)}}`; return `{a|${name}} {b|${addCommasToNumber(1022220)}}`;
}, },
tooltip: {
show: false,
},
}, },
textStyle: { textStyle: {
rich: { rich: {
@ -138,7 +140,15 @@
function initOptions() { function initOptions() {
const { name, color } = props.rateConfig; 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) => { options.value.legend.formatter = (seriousName: string) => {
const item = props.data.find((e) => e.name === seriousName); const item = props.data.find((e) => e.name === seriousName);

View File

@ -293,12 +293,7 @@ export function getPieCharOptions(key: WorkCardEnum, hasPermission: boolean) {
textAlign: 'center', // 确保副标题居中 textAlign: 'center', // 确保副标题居中
}, },
color: colorMapConfig[key], color: colorMapConfig[key],
tooltip: { tooltip: { show: true },
...toolTipConfig,
trigger: 'item',
position: 'right',
show: !!hasPermission,
},
legend: { legend: {
width: '100%', width: '100%',
height: 128, height: 128,
@ -470,6 +465,11 @@ export function handlePieData(
options.series.data = lastStatusPercentList.map((item) => ({ options.series.data = lastStatusPercentList.map((item) => ({
name: item.status, name: item.status,
value: item.count, value: item.count,
tooltip: {
...toolTipConfig,
position: 'right',
show: !!hasPermission,
},
})); }));
// 计算总数和图例格式 // 计算总数和图例格式