From e8ffc7b3b3e8f9a8892b956ca3702140bc184869 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 3 Jul 2024 19:16:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=8A=A5=E5=91=8A=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=8F=8A=E9=A2=84=E8=A7=88=E9=A1=B5=E9=9D=A2=E5=88=9D=E7=A8=BF?= =?UTF-8?q?=E5=BE=85=E8=81=94=E8=B0=83&=E8=AE=A1=E5=88=92=E7=BB=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pure/ms-rich-text/MsRichText.vue | 11 +- frontend/src/enums/routeEnum.ts | 1 + frontend/src/enums/testPlanReportEnum.ts | 11 + frontend/src/hooks/useDoubleClick.ts | 31 + .../models/projectManagement/taskCenter.ts | 10 + frontend/src/models/testPlan/report.ts | 1 + .../src/models/testPlan/testPlanReport.ts | 20 + .../src/router/routes/modules/testPlan.ts | 13 +- .../api-test/report/component/scenarioCom.vue | 2 +- .../components/addStep.vue | 5 +- .../taskCenter/component/testPlan.vue | 41 +- .../report/detail/component/config.vue | 375 ++++++++++ .../component/custom-card/customRichText.vue | 87 +++ .../report/detail/component/planDetail.vue | 448 ------------ .../detail/component/planGroupDetail.vue | 185 ----- .../detail/component/planOrGroupReport.vue | 38 - .../report/detail/component/reportConfig.ts | 175 +++++ .../{ => system-card}/ReportMetricsItem.vue | 0 .../{ => system-card}/apiAndScenarioTable.vue | 37 +- .../component/{ => system-card}/bugTable.vue | 14 +- .../{ => system-card}/executeAnalysis.vue | 0 .../{ => system-card}/featureCaseTable.vue | 71 +- .../planDetailHeaderRight.vue | 0 .../{ => system-card}/reportDetailTable.vue | 17 +- .../{ => system-card}/reportHeader.vue | 2 +- .../component/{ => system-card}/summary.vue | 61 +- .../component/system-card/systemTrigger.vue | 29 + .../report/detail/component/viewReport.vue | 663 ++++++++++++++++++ .../test-plan/report/detail/configReport.vue | 101 +++ .../report/detail/{index.vue => detail.vue} | 14 +- .../report/detail/sharePlanReportIndex.vue | 13 +- .../views/test-plan/report/locale/en-US.ts | 15 +- .../views/test-plan/report/locale/zh-CN.ts | 15 +- .../testPlan/components/planExpandRow.vue | 81 +++ .../testPlan/components/planTable.vue | 94 +-- .../detail/executionHistory/index.vue | 53 +- .../detail/featureCase/detail/index.vue | 9 +- .../views/test-plan/testPlan/detail/index.vue | 69 +- .../testPlan/detail/reportDrawer.vue | 12 +- .../views/test-plan/testPlan/locale/en-US.ts | 4 +- .../views/test-plan/testPlan/locale/zh-CN.ts | 2 + 41 files changed, 1979 insertions(+), 851 deletions(-) create mode 100644 frontend/src/enums/testPlanReportEnum.ts create mode 100644 frontend/src/hooks/useDoubleClick.ts create mode 100644 frontend/src/views/test-plan/report/detail/component/config.vue create mode 100644 frontend/src/views/test-plan/report/detail/component/custom-card/customRichText.vue delete mode 100644 frontend/src/views/test-plan/report/detail/component/planDetail.vue delete mode 100644 frontend/src/views/test-plan/report/detail/component/planGroupDetail.vue delete mode 100644 frontend/src/views/test-plan/report/detail/component/planOrGroupReport.vue create mode 100644 frontend/src/views/test-plan/report/detail/component/reportConfig.ts rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/ReportMetricsItem.vue (100%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/apiAndScenarioTable.vue (84%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/bugTable.vue (82%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/executeAnalysis.vue (100%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/featureCaseTable.vue (67%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/planDetailHeaderRight.vue (100%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/reportDetailTable.vue (88%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/reportHeader.vue (94%) rename frontend/src/views/test-plan/report/detail/component/{ => system-card}/summary.vue (80%) create mode 100644 frontend/src/views/test-plan/report/detail/component/system-card/systemTrigger.vue create mode 100644 frontend/src/views/test-plan/report/detail/component/viewReport.vue create mode 100644 frontend/src/views/test-plan/report/detail/configReport.vue rename frontend/src/views/test-plan/report/detail/{index.vue => detail.vue} (56%) create mode 100644 frontend/src/views/test-plan/testPlan/components/planExpandRow.vue diff --git a/frontend/src/components/pure/ms-rich-text/MsRichText.vue b/frontend/src/components/pure/ms-rich-text/MsRichText.vue index 7ac833a719..ecbbfa393b 100644 --- a/frontend/src/components/pure/ms-rich-text/MsRichText.vue +++ b/frontend/src/components/pure/ms-rich-text/MsRichText.vue @@ -100,6 +100,7 @@ placeholder: 'editor.placeholder', draggable: false, autoHeight: true, + editable: true, } ); @@ -137,6 +138,14 @@ if (props.raw !== editor.value?.getHTML()) { editor.value?.commands.setContent(props.raw); } + } + ); + + watch( + () => props.editable, + (val) => { + // 更新富文本的可编辑配置 + editor.value?.setOptions({ editable: val }); }, { immediate: true, @@ -347,7 +356,7 @@ }), ], autofocus: false, - editable: !props.editable, + editable: props.editable, onUpdate: () => { debounceOnUpdate(); }, diff --git a/frontend/src/enums/routeEnum.ts b/frontend/src/enums/routeEnum.ts index 1523183752..6121fb7a64 100644 --- a/frontend/src/enums/routeEnum.ts +++ b/frontend/src/enums/routeEnum.ts @@ -62,6 +62,7 @@ export enum TestPlanRouteEnum { TEST_PLAN = 'testPlan', TEST_PLAN_INDEX = 'testPlanIndex', TEST_PLAN_INDEX_DETAIL = 'testPlanIndexDetail', + TEST_PLAN_INDEX_CONFIG = 'testPlanIndexConfig', TEST_PLAN_INDEX_DETAIL_FEATURE_CASE_DETAIL = 'testPlanIndexDetailFeatureCaseDetail', TEST_PLAN_REPORT = 'testPlanReport', TEST_PLAN_REPORT_DETAIL = 'testPlanReportDetail', diff --git a/frontend/src/enums/testPlanReportEnum.ts b/frontend/src/enums/testPlanReportEnum.ts new file mode 100644 index 0000000000..666528e333 --- /dev/null +++ b/frontend/src/enums/testPlanReportEnum.ts @@ -0,0 +1,11 @@ +export enum ReportCardTypeEnum { + SUMMARY = 'SUMMARY', // 报告总结 + BUG_DETAIL = 'BUG_DETAIL', // 缺陷明细 + FUNCTIONAL_DETAIL = 'FUNCTIONAL_DETAIL', // 功能用例明细 + API_CASE_DETAIL = 'API_CASE_DETAIL', // 接口用例明细 + SCENARIO_CASE_DETAIL = 'SCENARIO_CASE_DETAIL', // 场景用例明细 + SUB_PLAN_DETAIL = 'SUB_PLAN_DETAIL', // 计划组子计划详情 + CUSTOM_CARD = 'CUSTOM_CARD', // 自定义卡片 +} + +export default {}; diff --git a/frontend/src/hooks/useDoubleClick.ts b/frontend/src/hooks/useDoubleClick.ts new file mode 100644 index 0000000000..d0d9a46afc --- /dev/null +++ b/frontend/src/hooks/useDoubleClick.ts @@ -0,0 +1,31 @@ +import { ref } from 'vue'; + +/** + * @description 用于自定义双击事件 + */ +export default function useDoubleClick(callback: () => void) { + const count = ref(0); + const lastClickTime = ref(0); + const DOUBLE_CLICK_THRESHOLD = 300; // 300毫秒 + + function handleClick() { + const currentTime = new Date().getTime(); + const timeDiff = currentTime - lastClickTime.value; + + if (timeDiff < DOUBLE_CLICK_THRESHOLD) { + count.value++; + } else { + count.value = 1; + } + lastClickTime.value = currentTime; + + if (count.value >= 2) { + callback(); + count.value = 0; + } + } + + return { + handleClick, + }; +} diff --git a/frontend/src/models/projectManagement/taskCenter.ts b/frontend/src/models/projectManagement/taskCenter.ts index 41b1b3417d..fb18f4fcfd 100644 --- a/frontend/src/models/projectManagement/taskCenter.ts +++ b/frontend/src/models/projectManagement/taskCenter.ts @@ -1,4 +1,7 @@ // 实时 + +import { testPlanTypeEnum } from '@/enums/testPlanEnum'; + export interface RealTaskCenterApiCaseItem { organizationName: string; // 所属组织 projectName: string; @@ -14,6 +17,13 @@ export interface RealTaskCenterApiCaseItem { operationTime: string; integrated: boolean; // 是否为集合报告 } + +export interface TestPlanTaskCenterItem extends RealTaskCenterApiCaseItem { + children: TestPlanTaskCenterItem[]; + childrenCount: number; + groupId: string; + type: keyof typeof testPlanTypeEnum; +} // 定时任务 export interface TimingTaskCenterApiCaseItem { organizationName: string; diff --git a/frontend/src/models/testPlan/report.ts b/frontend/src/models/testPlan/report.ts index 52c5d7ad84..9965df599c 100644 --- a/frontend/src/models/testPlan/report.ts +++ b/frontend/src/models/testPlan/report.ts @@ -34,4 +34,5 @@ export interface ApiOrScenarioCaseItem { executeUser: string; bugCount: number; reportId: string; + projectId: string; } diff --git a/frontend/src/models/testPlan/testPlanReport.ts b/frontend/src/models/testPlan/testPlanReport.ts index 3f17505069..605c72de81 100644 --- a/frontend/src/models/testPlan/testPlanReport.ts +++ b/frontend/src/models/testPlan/testPlanReport.ts @@ -1,3 +1,5 @@ +import { ReportCardTypeEnum } from '@/enums/testPlanReportEnum'; + export interface countDetail { success: number; error: number; @@ -28,8 +30,11 @@ export interface PlanReportDetail { apiBugCount: number; // 接口用例明细bug总数 scenarioBugCount: number; // 场景用例明细bug总数 testPlanName: string; + resultStatus?: string; // 报告结果 } +export type detailCountKey = 'functionalCount' | 'apiCaseCount' | 'apiScenarioCount'; + export type AnalysisType = 'FUNCTIONAL' | 'API' | 'SCENARIO'; export interface ReportMetricsItemModel { @@ -49,3 +54,18 @@ export interface StatusListType { rateKey: string; key: string; } + +export interface configItem { + id: string; + value: ReportCardTypeEnum; + label: string; + content?: string; + system: boolean; + enableEdit: boolean; +} + +export interface customValueForm { + content?: string; + label: string; + richTextTmpFileIds?: string[]; +} diff --git a/frontend/src/router/routes/modules/testPlan.ts b/frontend/src/router/routes/modules/testPlan.ts index bd5338cee9..65ae29f0ed 100644 --- a/frontend/src/router/routes/modules/testPlan.ts +++ b/frontend/src/router/routes/modules/testPlan.ts @@ -41,7 +41,7 @@ const TestPlan: AppRouteRecordRaw = { { path: 'testPlanReportDetail', name: TestPlanRouteEnum.TEST_PLAN_REPORT_DETAIL, - component: () => import('@/views/test-plan/report/detail/index.vue'), + component: () => import('@/views/test-plan/report/detail/detail.vue'), meta: { locale: 'menu.apiTest.reportDetail', roles: ['PROJECT_TEST_PLAN_REPORT:READ'], @@ -77,6 +77,17 @@ const TestPlan: AppRouteRecordRaw = { ], }, }, + // 自定义配置报告 + { + path: 'testPlanIndexConfig', + name: TestPlanRouteEnum.TEST_PLAN_INDEX_CONFIG, + component: () => import('@/views/test-plan/report/detail/configReport.vue'), + meta: { + locale: 'testPlan.planConfigReport', + roles: ['PROJECT_TEST_PLAN_REPORT:READ'], + isTopMenu: false, + }, + }, // 测试计划-测试计划详情-功能用例详情 { path: 'testPlanIndexDetailFeatureCaseDetail', diff --git a/frontend/src/views/api-test/report/component/scenarioCom.vue b/frontend/src/views/api-test/report/component/scenarioCom.vue index 2610c44d13..dddc999163 100644 --- a/frontend/src/views/api-test/report/component/scenarioCom.vue +++ b/frontend/src/views/api-test/report/component/scenarioCom.vue @@ -56,7 +56,7 @@ import ReportDetailHeader from './reportDetailHeader.vue'; import reportInfoHeader from './step/reportInfoHeaders.vue'; import TiledList from './tiledList.vue'; - import ReportMetricsItem from '@/views/test-plan/report/detail/component/ReportMetricsItem.vue'; + import ReportMetricsItem from '@/views/test-plan/report/detail/component/system-card/ReportMetricsItem.vue'; import { toolTipConfig } from '@/config/testPlan'; import { useI18n } from '@/hooks/useI18n'; diff --git a/frontend/src/views/case-management/caseManagementFeature/components/addStep.vue b/frontend/src/views/case-management/caseManagementFeature/components/addStep.vue index bbe8b1f700..af07d72e54 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/addStep.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/addStep.vue @@ -33,7 +33,9 @@ v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE']) && !props.isDisabledTestPlan" #actualResult="{ record }" > +
{{ record.actualResult }}
diff --git a/frontend/src/views/test-plan/report/detail/component/executeAnalysis.vue b/frontend/src/views/test-plan/report/detail/component/system-card/executeAnalysis.vue similarity index 100% rename from frontend/src/views/test-plan/report/detail/component/executeAnalysis.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/executeAnalysis.vue diff --git a/frontend/src/views/test-plan/report/detail/component/featureCaseTable.vue b/frontend/src/views/test-plan/report/detail/component/system-card/featureCaseTable.vue similarity index 67% rename from frontend/src/views/test-plan/report/detail/component/featureCaseTable.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/featureCaseTable.vue index 6b35800780..f57a02e093 100644 --- a/frontend/src/views/test-plan/report/detail/component/featureCaseTable.vue +++ b/frontend/src/views/test-plan/report/detail/component/system-card/featureCaseTable.vue @@ -8,31 +8,60 @@ + + + + diff --git a/frontend/src/views/test-plan/report/detail/component/planDetailHeaderRight.vue b/frontend/src/views/test-plan/report/detail/component/system-card/planDetailHeaderRight.vue similarity index 100% rename from frontend/src/views/test-plan/report/detail/component/planDetailHeaderRight.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/planDetailHeaderRight.vue diff --git a/frontend/src/views/test-plan/report/detail/component/reportDetailTable.vue b/frontend/src/views/test-plan/report/detail/component/system-card/reportDetailTable.vue similarity index 88% rename from frontend/src/views/test-plan/report/detail/component/reportDetailTable.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/reportDetailTable.vue index 48a55beba8..1478871bde 100644 --- a/frontend/src/views/test-plan/report/detail/component/reportDetailTable.vue +++ b/frontend/src/views/test-plan/report/detail/component/system-card/reportDetailTable.vue @@ -23,7 +23,7 @@ @@ -49,6 +49,9 @@ import { PlanReportStatus } from '@/enums/reportEnum'; import { RouteEnum } from '@/enums/routeEnum'; import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; + import { ReportCardTypeEnum } from '@/enums/testPlanReportEnum'; + + import { detailTableExample } from '@/views/test-plan/report/detail/component/reportConfig'; const { openNewPage } = useOpenNewPage(); @@ -57,9 +60,13 @@ const props = defineProps<{ reportId: string; shareId?: string; - currentMode: string; + isPreview?: boolean; }>(); + const innerCurrentMode = defineModel('currentMode', { + default: 'drawer', + }); + const statusResultOptions = computed(() => { return Object.keys(PlanReportStatus).map((key) => { return { @@ -132,8 +139,10 @@ } watchEffect(() => { - if (props.reportId) { + if (props.reportId && props.isPreview) { loadReportDetailList(); + } else { + propsRes.value.data = detailTableExample[ReportCardTypeEnum.SUB_PLAN_DETAIL]; } }); @@ -143,7 +152,7 @@ function openReport(record: PlanReportDetail) { independentReportId.value = record.id; - if (props.currentMode === 'drawer') { + if (innerCurrentMode.value === 'drawer') { reportVisible.value = true; } else { openNewPage(RouteEnum.TEST_PLAN_REPORT_DETAIL, { diff --git a/frontend/src/views/test-plan/report/detail/component/reportHeader.vue b/frontend/src/views/test-plan/report/detail/component/system-card/reportHeader.vue similarity index 94% rename from frontend/src/views/test-plan/report/detail/component/reportHeader.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/reportHeader.vue index 729f19e891..867d855bf0 100644 --- a/frontend/src/views/test-plan/report/detail/component/reportHeader.vue +++ b/frontend/src/views/test-plan/report/detail/component/system-card/reportHeader.vue @@ -17,7 +17,7 @@ import { ref } from 'vue'; import MsCard from '@/components/pure/ms-card/index.vue'; - import PlanDetailHeaderRight from '@/views/test-plan/report/detail/component/planDetailHeaderRight.vue'; + import PlanDetailHeaderRight from '@/views/test-plan/report/detail/component/system-card/planDetailHeaderRight.vue'; import type { PlanReportDetail } from '@/models/testPlan/testPlanReport'; diff --git a/frontend/src/views/test-plan/report/detail/component/summary.vue b/frontend/src/views/test-plan/report/detail/component/system-card/summary.vue similarity index 80% rename from frontend/src/views/test-plan/report/detail/component/summary.vue rename to frontend/src/views/test-plan/report/detail/component/system-card/summary.vue index f9b96e35ff..5b434b1fab 100644 --- a/frontend/src/views/test-plan/report/detail/component/summary.vue +++ b/frontend/src/views/test-plan/report/detail/component/system-card/summary.vue @@ -1,45 +1,41 @@ diff --git a/frontend/src/views/test-plan/report/detail/component/system-card/systemTrigger.vue b/frontend/src/views/test-plan/report/detail/component/system-card/systemTrigger.vue new file mode 100644 index 0000000000..a319caf197 --- /dev/null +++ b/frontend/src/views/test-plan/report/detail/component/system-card/systemTrigger.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/frontend/src/views/test-plan/report/detail/component/viewReport.vue b/frontend/src/views/test-plan/report/detail/component/viewReport.vue new file mode 100644 index 0000000000..366c89df92 --- /dev/null +++ b/frontend/src/views/test-plan/report/detail/component/viewReport.vue @@ -0,0 +1,663 @@ + + + + + diff --git a/frontend/src/views/test-plan/report/detail/configReport.vue b/frontend/src/views/test-plan/report/detail/configReport.vue new file mode 100644 index 0000000000..9508b0483a --- /dev/null +++ b/frontend/src/views/test-plan/report/detail/configReport.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/frontend/src/views/test-plan/report/detail/index.vue b/frontend/src/views/test-plan/report/detail/detail.vue similarity index 56% rename from frontend/src/views/test-plan/report/detail/index.vue rename to frontend/src/views/test-plan/report/detail/detail.vue index 048b341485..8eac62afe9 100644 --- a/frontend/src/views/test-plan/report/detail/index.vue +++ b/frontend/src/views/test-plan/report/detail/detail.vue @@ -1,20 +1,21 @@ + + diff --git a/frontend/src/views/test-plan/testPlan/components/planTable.vue b/frontend/src/views/test-plan/testPlan/components/planTable.vue index 0aa1fd667f..138b9d43eb 100644 --- a/frontend/src/views/test-plan/testPlan/components/planTable.vue +++ b/frontend/src/views/test-plan/testPlan/components/planTable.vue @@ -97,29 +97,12 @@ -->