style(测试计划): 测试计划报告暗黑模式样式style

This commit is contained in:
xinxin.wu 2024-12-18 16:26:55 +08:00 committed by 刘瑞斌
parent bf926559b0
commit 4d3b9f3c5c
5 changed files with 66 additions and 25 deletions

View File

@ -33,7 +33,7 @@
</SystemTrigger>
<SystemTrigger :is-preview="true">
<div class="analysis min-w-[330px]">
<ExecuteAnalysis :detail="detail" hide-title no-block />
<ExecuteAnalysis :detail="detail" hide-title no-block :animation="true" />
</div>
<template #content>
<div class="arco-table-filters-content px-[8px] py-[4px]">

View File

@ -68,9 +68,9 @@
>
<a-tooltip :mouse-enter-delay="300" :content="t(item.label)" position="top">
<div class="flex items-center justify-between">
<div :class="`${getLabelClass(item)} custom-card-item-label one-line-text max-w-[calc(100%-14px)]`">{{
t(item.label)
}}</div>
<div :class="`${getLabelClass(item)} custom-card-item-label one-line-text max-w-[calc(100%-14px)]`">
{{ t(item.label) }}
</div>
<icon-close
v-if="item.type !== FieldTypeEnum.SYSTEM"
:style="{ 'font-size': '14px' }"

View File

@ -13,8 +13,10 @@
import SetReportChart from '@/views/api-test/report/component/case/setReportChart.vue';
import getVisualThemeColor from '@/config/chartTheme';
import { commonConfig, seriesConfig, statusConfig, toolTipConfig } from '@/config/testPlan';
import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store';
import type { LegendData } from '@/models/apiTest/report';
import type { PlanReportDetail, StatusListType } from '@/models/testPlan/testPlanReport';
@ -23,6 +25,7 @@
const { t } = useI18n();
const appStore = useAppStore();
const props = defineProps<{
detail: PlanReportDetail;
hideTitle?: boolean;
@ -33,7 +36,7 @@
const legendData = ref<LegendData[]>([]);
//
const executeCharOptions = ref({
const executeCharOptions = ref<Record<string, any>>({
...commonConfig,
tooltip: {
...toolTipConfig,
@ -88,19 +91,38 @@
function initExecuteOptions() {
const pieBorderWidth =
statusConfig.filter((e) => Number(props.detail.executeCount[e.value]) > 0).length === 1 ? 0 : 2;
executeCharOptions.value.series.data = statusConfig
const lastExecuteData: Record<string, any>[] = statusConfig
.filter((item) => props.detail.executeCount[item.value] > 0)
.map((item: StatusListType) => {
const color = item.color === '#D4D4D8' ? getVisualThemeColor('initItemStyleColor') : item.color;
const itemColor = props.animation ? color : item.color;
return {
value: props.detail.executeCount[item.value] || 0,
name: t(item.label),
itemStyle: {
color: item.color,
color: itemColor,
borderWidth: pieBorderWidth,
borderColor: '#ffffff',
borderColor: props.animation ? getVisualThemeColor('itemStyleBorderColor') : '#ffffff',
},
};
});
executeCharOptions.value.series.data = lastExecuteData.length
? lastExecuteData
: [
{
value: 1,
tooltip: {
show: false,
},
itemStyle: {
color: props.animation ? getVisualThemeColor('initItemStyleColor') : '#D4D4D8',
},
},
];
legendData.value = statusConfig.map((item: StatusListType) => {
const rate = (props.detail.executeCount[item.value] / props.detail.caseTotal) * 100;
return {
@ -122,7 +144,7 @@
});
watchEffect(() => {
if (Object.keys(props.detail).length > 0) {
if (Object.keys(props.detail).length > 0 || appStore.isDarkTheme) {
initExecuteOptions();
}
});

View File

@ -18,7 +18,7 @@
</SystemTrigger>
<SystemTrigger :is-preview="props.isPreview">
<div :class="`${getAnalysisHover} analysis min-w-[410px]`">
<ExecuteAnalysis :detail="detail" />
<ExecuteAnalysis :detail="detail" :animation="true" />
</div>
<template #content>
<div class="arco-table-filters-content px-[8px] py-[4px]">{{ t('report.detail.systemInternalTooltip') }}</div>
@ -220,6 +220,7 @@
import TestSetTableIndex from '@/views/test-plan/report/detail/component/system-card/testTableIndex.vue';
import { getReportLayout, updateReportDetail } from '@/api/modules/test-plan/report';
import getVisualThemeColor from '@/config/chartTheme';
import {
commonConfig,
defaultCount,
@ -230,6 +231,7 @@
} from '@/config/testPlan';
import { useI18n } from '@/hooks/useI18n';
import useLeaveUnSaveTip from '@/hooks/useLeaveUnSaveTip';
import { useAppStore } from '@/store';
import { addCommasToNumber } from '@/utils';
import { UpdateReportDetailParams } from '@/models/testPlan/report';
@ -248,6 +250,8 @@
const { t } = useI18n();
const appStore = useAppStore();
const route = useRoute();
const props = defineProps<{
detailInfo: PlanReportDetail;
@ -296,7 +300,7 @@
const shareId = ref<string>(route.query.shareId as string);
//
const functionCaseOptions = ref({
const functionCaseOptions = ref<Record<string, any>>({
...commonConfig,
tooltip: {
...toolTipConfig,
@ -315,7 +319,7 @@
},
});
//
const apiCaseOptions = ref({
const apiCaseOptions = ref<Record<string, any>>({
...commonConfig,
tooltip: {
...toolTipConfig,
@ -334,7 +338,7 @@
},
});
//
const scenarioCaseOptions = ref({
const scenarioCaseOptions = ref<Record<string, any>>({
...commonConfig,
tooltip: {
...toolTipConfig,
@ -360,19 +364,35 @@
const { success } = caseCountDetail;
const valueList = success ? statusConfig : passRateData;
const chartBorderWidth = valueList.filter((e) => Number(caseCountDetail[e.value]) > 0).length === 1 ? 0 : 2;
return valueList
const lastValueList = valueList
.filter((item) => caseCountDetail[item.value] > 0)
.map((item: StatusListType) => {
const color = item.color === '#D4D4D8' ? getVisualThemeColor('initItemStyleColor') : item.color;
return {
value: caseCountDetail[item.value] || 0,
name: t(item.label),
itemStyle: {
color: success ? item.color : '#D4D4D8',
color: success ? color : getVisualThemeColor('initItemStyleColor'),
borderWidth: chartBorderWidth,
borderColor: '#ffffff',
borderColor: getVisualThemeColor('itemStyleBorderColor'),
},
};
});
return lastValueList.length
? lastValueList
: [
{
value: 1,
tooltip: {
show: false,
},
itemStyle: {
color: getVisualThemeColor('initItemStyleColor'),
},
},
];
}
//
@ -664,6 +684,14 @@
handleUpdateReportDetail(newCurrentItem);
}
}
watch(
() => appStore.isDarkTheme,
() => {
initOptionsData();
}
);
defineExpose({
setIsSave,
});

View File

@ -1,13 +1,4 @@
import { TableSortable } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es';
import type { MsTableColumn } from '@/components/pure/ms-table/type';
import type { countDetail } from '@/models/testPlan/testPlanReport';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { casePriorityOptions, lastReportStatusListOptions } from '@/views/api-test/components/config';
import { executionResultMap } from '@/views/case-management/caseManagementFeature/components/utils';
export function getSummaryDetail(detailCount: countDetail) {
if (detailCount) {