From 17a955b2e0fe3d985f558a8f2f4412b219b8f8b9 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 28 Jun 2024 17:59:06 +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=E8=AF=A6=E6=83=85=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/test-plan/testPlan/detail/index.vue | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/test-plan/testPlan/detail/index.vue b/frontend/src/views/test-plan/testPlan/detail/index.vue index 1b73efcb64..0af5b03321 100644 --- a/frontend/src/views/test-plan/testPlan/detail/index.vue +++ b/frontend/src/views/test-plan/testPlan/detail/index.vue @@ -46,7 +46,8 @@ v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && detail.status !== 'ARCHIVED'" type="button" status="default" - @click="editorCopyHandler(true)" + :loading="copyLoading" + @click="copyHandler" > {{ t('common.copy') }} @@ -166,6 +167,7 @@ getPlanPassRate, getTestPlanDetail, getTestPlanModule, + testPlanAndGroupCopy, } from '@/api/modules/test-plan/testPlan'; import { defaultDetailCount, testPlanDefaultDetail } from '@/config/testPlan'; import { useI18n } from '@/hooks/useI18n'; @@ -178,6 +180,7 @@ import { ModuleTreeNode } from '@/models/common'; import type { PassRateCountDetail, TestPlanDetail, TestPlanItem } from '@/models/testPlan/testPlan'; + import { TestPlanRouteEnum } from '@/enums/routeEnum'; const userStore = useUserStore(); const appStore = useAppStore(); @@ -475,6 +478,29 @@ done(); } + // 复制 TODO:待联调 + const copyLoading = ref(false); + async function copyHandler() { + copyLoading.value = true; + try { + const res = await testPlanAndGroupCopy(route.query.id as string); + Message.success(t('common.copySuccess')); + router.push({ + name: TestPlanRouteEnum.TEST_PLAN_INDEX_DETAIL, + // TODO 后台需要补id + query: { + id: res.id, + }, + }); + initDetail(); + initPlanTree(); + } catch (error) { + console.log(error); + } finally { + copyLoading.value = false; + } + } + onBeforeMount(() => { if (route.query.type === 'featureCase') { activeTab.value = 'featureCase';