From 8dc9e2b022781bed6f8ea20d9a77c3df5688616a Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 29 Nov 2024 14:39:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=BC=98=E5=8C=96=E5=B7=A5=E4=BD=9C=E5=8F=B0=E9=A5=BC?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/config/workbench.ts | 10 +- .../components/apiAndScenarioCase.vue | 6 +- .../homePage/components/apiCount.vue | 1 - .../homePage/components/caseCount.vue | 1 - .../homePage/components/caseReviewedCount.vue | 1 - .../homePage/components/defectCount.vue | 1 - .../homePage/components/legendPieChart.vue | 2 +- .../homePage/components/passRatePie.vue | 6 +- .../homePage/components/ratioPie.vue | 148 ++++++++++++++---- .../homePage/components/relatedCaseCount.vue | 1 - .../homePage/components/testPlanCount.vue | 7 +- .../src/views/workbench/homePage/utils.ts | 35 +++-- 12 files changed, 155 insertions(+), 64 deletions(-) diff --git a/frontend/src/config/workbench.ts b/frontend/src/config/workbench.ts index 9d1039472b..d8ea0f3325 100644 --- a/frontend/src/config/workbench.ts +++ b/frontend/src/config/workbench.ts @@ -243,8 +243,8 @@ export const commonRatePieOptions = { title: { show: true, text: '', - left: 26, - top: '20%', + left: 40, + top: '26%', textStyle: { fontSize: 12, fontWeight: 'normal', @@ -276,16 +276,14 @@ export const commonRatePieOptions = { name: '', type: 'pie', color: [], - padAngle: 2, - radius: ['85%', '100%'], - center: [30, '50%'], + radius: ['65%', '80%'], + center: [44, '50%'], avoidLabelOverlap: false, label: { show: false, position: 'center', }, emphasis: { - scale: false, // 禁用放大效果 label: { show: false, fontSize: 40, diff --git a/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue b/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue index 74990a090b..ef13db42f5 100644 --- a/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue +++ b/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue @@ -173,7 +173,7 @@ const coverTitleConfig = computed(() => { return { name: t('workbench.homePage.apiCoverage'), - color: ['#EDEDF1', '#00C261'], + color: ['#D4D4D8', '#00C261'], tooltipText: props.item.key === WorkCardEnum.API_CASE_COUNT ? t('workbench.homePage.apiCaseCountCoverRateTooltip') @@ -185,12 +185,12 @@ return props.item.key === WorkCardEnum.API_CASE_COUNT ? { name: t('workbench.homePage.caseExecutionRate'), - color: ['#EDEDF1', '#00C261'], + color: ['#D4D4D8', '#00C261'], tooltipText: t('workbench.homePage.apiCaseCountExecuteRateTooltip'), } : { name: t('workbench.homePage.sceneExecutionRate'), - color: ['#EDEDF1', '#00C261'], + color: ['#D4D4D8', '#00C261'], tooltipText: t('workbench.homePage.scenarioCaseCountExecuteRateTooltip'), }; }); diff --git a/frontend/src/views/workbench/homePage/components/apiCount.vue b/frontend/src/views/workbench/homePage/components/apiCount.vue index 497e773bfa..39b6c617f0 100644 --- a/frontend/src/views/workbench/homePage/components/apiCount.vue +++ b/frontend/src/views/workbench/homePage/components/apiCount.vue @@ -31,7 +31,6 @@ diff --git a/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue b/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue index ff6f349608..d43b3665fe 100644 --- a/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue +++ b/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue @@ -27,7 +27,6 @@ diff --git a/frontend/src/views/workbench/homePage/components/defectCount.vue b/frontend/src/views/workbench/homePage/components/defectCount.vue index e40641954e..83bedc29a6 100644 --- a/frontend/src/views/workbench/homePage/components/defectCount.vue +++ b/frontend/src/views/workbench/homePage/components/defectCount.vue @@ -28,7 +28,6 @@ :has-permission="hasPermission" :tooltip-text="tooltip" :options="legacyOptions" - :size="60" :value-list="legacyValueList" /> diff --git a/frontend/src/views/workbench/homePage/components/legendPieChart.vue b/frontend/src/views/workbench/homePage/components/legendPieChart.vue index 531d6201a8..ab356be227 100644 --- a/frontend/src/views/workbench/homePage/components/legendPieChart.vue +++ b/frontend/src/views/workbench/homePage/components/legendPieChart.vue @@ -8,7 +8,7 @@
- +
@@ -30,7 +30,6 @@ const props = defineProps<{ options: Record; - size: number; tooltipText?: string; hasPermission: boolean; loading?: boolean; @@ -43,8 +42,9 @@ diff --git a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue index 6820713030..f2d79ca506 100644 --- a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue +++ b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue @@ -27,7 +27,6 @@ :options="relatedOptions" :has-permission="hasPermission" tooltip-text="workbench.homePage.associateCaseCoverRateTooltip" - :size="60" :value-list="coverRateValueList" />
diff --git a/frontend/src/views/workbench/homePage/components/testPlanCount.vue b/frontend/src/views/workbench/homePage/components/testPlanCount.vue index eda2313173..7594e45456 100644 --- a/frontend/src/views/workbench/homePage/components/testPlanCount.vue +++ b/frontend/src/views/workbench/homePage/components/testPlanCount.vue @@ -24,12 +24,7 @@
- +
diff --git a/frontend/src/views/workbench/homePage/utils.ts b/frontend/src/views/workbench/homePage/utils.ts index e28351a976..9142413cda 100644 --- a/frontend/src/views/workbench/homePage/utils.ts +++ b/frontend/src/views/workbench/homePage/utils.ts @@ -364,15 +364,25 @@ export function handlePieData( ) { const options: Record = getPieCharOptions(key); const lastStatusPercentList = statusPercentList ?? []; - options.series.data = lastStatusPercentList.map((item) => ({ - name: item.status, - value: item.count, - tooltip: { - ...toolTipConfig, - position: 'right', - show: !!hasPermission, - }, - })); + const hasDataLength = lastStatusPercentList.filter((e) => Number(e.count) > 0).length; + const pieBorderWidth = hasDataLength === 1 ? 0 : 2; + + options.series.data = + hasDataLength > 0 + ? lastStatusPercentList.map((item) => ({ + name: item.status, + value: item.count, + tooltip: { + ...toolTipConfig, + position: 'right', + show: !!hasPermission, + }, + itemStyle: { + borderWidth: pieBorderWidth, + borderColor: '#ffffff', + }, + })) + : []; // 计算总数和图例格式 const tempObject: Record = {}; @@ -407,13 +417,20 @@ export function handleUpdateTabPie( const countList = list || []; let lastCountList: { value: number | string; label: string; name: string }[] = []; if (hasPermission) { + const pieBorderWidth = countList.slice(1).filter((e) => Number(e.count) > 0).length === 1 ? 0 : 1; + lastCountList = countList.slice(1).map((item) => { return { value: item.count, label: item.name, name: item.name, + itemStyle: { + borderWidth: pieBorderWidth, + borderColor: '#ffffff', + }, }; }); + options.series.data = lastCountList.every((e) => e.value === 0) ? [] : lastCountList; options.title.text = countList[0].name ?? '';