diff --git a/frontend/src/assets/svg/case_total.svg b/frontend/src/assets/svg/case_total.svg new file mode 100644 index 0000000000..b3ed349219 --- /dev/null +++ b/frontend/src/assets/svg/case_total.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/src/assets/svg/plan_total.svg b/frontend/src/assets/svg/plan_total.svg new file mode 100644 index 0000000000..b207724db2 --- /dev/null +++ b/frontend/src/assets/svg/plan_total.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/frontend/src/components/pure/ms-table/base-table.vue b/frontend/src/components/pure/ms-table/base-table.vue index e4d693b2dd..a6aab654c2 100644 --- a/frontend/src/components/pure/ms-table/base-table.vue +++ b/frontend/src/components/pure/ms-table/base-table.vue @@ -46,6 +46,7 @@ v-if="attrs.selectorType === 'checkbox'" :value="getChecked(record)" :indeterminate="getIndeterminate(record)" + :disabled="isDisabledChildren(record)" @click.stop @change="rowSelectChange(record)" /> @@ -329,6 +330,10 @@ excludeKeys: Set; selectorStatus: SelectAllEnum; actionConfig?: BatchActionConfig; + disabledConfig?: { + disabledChildren?: boolean; + parentKey?: string; + }; noDisable?: boolean; showSetting?: boolean; columns: MsTableColumn; @@ -737,6 +742,14 @@ return false; } + function isDisabledChildren(record: TableData) { + if (!props.disabledConfig?.disabledChildren) { + return false; + } + // 子级禁用 + return !!record[props.disabledConfig.parentKey || 'parent']; + } + onMounted(async () => { await initColumn(); batchLeft.value = getBatchLeft(); diff --git a/frontend/src/config/testPlan.ts b/frontend/src/config/testPlan.ts index 3e57508779..f03f79137a 100644 --- a/frontend/src/config/testPlan.ts +++ b/frontend/src/config/testPlan.ts @@ -1,5 +1,7 @@ +import { cloneDeep } from 'lodash-es'; + import type { PassRateCountDetail, planStatusType, TestPlanDetail } from '@/models/testPlan/testPlan'; -import type { PlanReportDetail, StatusListType } from '@/models/testPlan/testPlanReport'; +import type { countDetail, PlanReportDetail, StatusListType } from '@/models/testPlan/testPlanReport'; import { LastExecuteResults } from '@/enums/caseEnum'; // TODO: 对照后端字段 // 测试计划详情 @@ -55,6 +57,14 @@ export const defaultExecuteForm = { planCommentFileIds: [], notifier: [] as string[], }; + +export const defaultCount: countDetail = { + success: 0, + error: 0, + fakeError: 0, + block: 0, + pending: 0, +}; // 报告详情 export const defaultReportDetail: PlanReportDetail = { id: '', @@ -68,20 +78,10 @@ export const defaultReportDetail: PlanReportDetail = { executeRate: 0, // 执行完成率 bugCount: 0, caseTotal: 0, - executeCount: { - success: 0, - error: 0, - fakeError: 0, - block: 0, - pending: 0, - }, - functionalCount: { - success: 0, - error: 0, - fakeError: 0, - block: 0, - pending: 0, - }, + executeCount: cloneDeep(defaultCount), + functionalCount: cloneDeep(defaultCount), + apiCaseCount: cloneDeep(defaultCount), + apiScenarioCount: cloneDeep(defaultCount), }; export const statusConfig: StatusListType[] = [ @@ -102,15 +102,14 @@ export const statusConfig: StatusListType[] = [ key: 'SUCCESS', }, // TODO 这个版本不展示误报 - // { - // label: 'common.fakeError', - // value: 'fakeError', - // color: '#FFC14E', - // class: 'bg-[rgb(var(--warning-6))]', - // rateKey: 'requestFakeErrorRate', - // key: 'FAKE_ERROR', - // }, - + { + label: 'common.fakeError', + value: 'fakeError', + color: '#FFC14E', + class: 'bg-[rgb(var(--warning-6))]', + rateKey: 'requestFakeErrorRate', + key: 'FAKE_ERROR', + }, { label: 'common.block', value: 'block', diff --git a/frontend/src/models/testPlan/testPlanReport.ts b/frontend/src/models/testPlan/testPlanReport.ts index 22377882b6..7abd6d387f 100644 --- a/frontend/src/models/testPlan/testPlanReport.ts +++ b/frontend/src/models/testPlan/testPlanReport.ts @@ -19,11 +19,12 @@ export interface PlanReportDetail { caseTotal: number; executeCount: countDetail; functionalCount: countDetail; - // TOTO 这个版本不展示场景和接口 - // apiCaseCount: countDetail; // 接口场景用例分析-用例数 - // apiScenarioCount: countDetail; // 接口场景用例分析-用例数 + apiCaseCount: countDetail; // 接口场景用例分析-用例数 + apiScenarioCount: countDetail; // 接口场景用例分析-用例数 } +export type AnalysisType = 'FUNCTIONAL' | 'API' | 'SCENARIO'; + export interface ReportMetricsItemModel { unit: string; value: number | string; diff --git a/frontend/src/views/test-plan/report/component/reportList.vue b/frontend/src/views/test-plan/report/component/reportList.vue index 1c19f6b3e1..5f90de1a54 100644 --- a/frontend/src/views/test-plan/report/component/reportList.vue +++ b/frontend/src/views/test-plan/report/component/reportList.vue @@ -3,8 +3,8 @@
{{ t('report.all') }} - {{ t('report.independent') }} - {{ t('report.collection') }} + {{ t('report.detail.testReport') }} + {{ t('report.detail.testPlanGroupReport') }}
+ + +
+
{{ t('common.fail') }}
+ + + {{ addCommasToNumber(countDetailData.fakeError) }} + + + {{ statusExecuteRate.errorRateResult }} + +
@@ -88,16 +100,18 @@ import MsColorLine from '@/components/pure/ms-color-line/index.vue'; - import { statusConfig } from '@/config/testPlan'; + import { defaultCount, statusConfig } from '@/config/testPlan'; import { useI18n } from '@/hooks/useI18n'; import { addCommasToNumber } from '@/utils'; - import type { countDetail, PlanReportDetail } from '@/models/testPlan/testPlanReport'; + import type { AnalysisType, countDetail, PlanReportDetail } from '@/models/testPlan/testPlanReport'; const { t } = useI18n(); + const props = defineProps<{ detail: PlanReportDetail; status: keyof countDetail; + type: AnalysisType; }>(); const defaultStatus = { @@ -113,8 +127,15 @@ return statusConfig.find((e) => e.value === props.status) || defaultStatus; }); + const analysisTypeMap: Record = { + FUNCTIONAL: 'functionalCount', + API: 'apiCaseCount', + SCENARIO: 'apiScenarioCount', + }; + const countDetailData = computed(() => { - return props.detail.functionalCount; + const countKey = analysisTypeMap[props.type] as keyof PlanReportDetail; + return props.detail[countKey] ? (props.detail[countKey] as countDetail) : defaultCount; }); const colorData = computed(() => { diff --git a/frontend/src/views/test-plan/report/detail/component/planDetail.vue b/frontend/src/views/test-plan/report/detail/component/planDetail.vue index 59c819ace6..e320711174 100644 --- a/frontend/src/views/test-plan/report/detail/component/planDetail.vue +++ b/frontend/src/views/test-plan/report/detail/component/planDetail.vue @@ -1,16 +1,5 @@