feat(测试计划): 测试计划详情复制补充

This commit is contained in:
xinxin.wu 2024-06-28 17:59:06 +08:00 committed by Craftsman
parent 08019abc70
commit 17a955b2e0
1 changed files with 27 additions and 1 deletions

View File

@ -46,7 +46,8 @@
v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && detail.status !== 'ARCHIVED'" v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && detail.status !== 'ARCHIVED'"
type="button" type="button"
status="default" status="default"
@click="editorCopyHandler(true)" :loading="copyLoading"
@click="copyHandler"
> >
<MsIcon type="icon-icon_copy_outlined" class="mr-[8px]" /> <MsIcon type="icon-icon_copy_outlined" class="mr-[8px]" />
{{ t('common.copy') }} {{ t('common.copy') }}
@ -166,6 +167,7 @@
getPlanPassRate, getPlanPassRate,
getTestPlanDetail, getTestPlanDetail,
getTestPlanModule, getTestPlanModule,
testPlanAndGroupCopy,
} from '@/api/modules/test-plan/testPlan'; } from '@/api/modules/test-plan/testPlan';
import { defaultDetailCount, testPlanDefaultDetail } from '@/config/testPlan'; import { defaultDetailCount, testPlanDefaultDetail } from '@/config/testPlan';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
@ -178,6 +180,7 @@
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
import type { PassRateCountDetail, TestPlanDetail, TestPlanItem } from '@/models/testPlan/testPlan'; import type { PassRateCountDetail, TestPlanDetail, TestPlanItem } from '@/models/testPlan/testPlan';
import { TestPlanRouteEnum } from '@/enums/routeEnum';
const userStore = useUserStore(); const userStore = useUserStore();
const appStore = useAppStore(); const appStore = useAppStore();
@ -475,6 +478,29 @@
done(); done();
} }
// TODO:
const copyLoading = ref<boolean>(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(() => { onBeforeMount(() => {
if (route.query.type === 'featureCase') { if (route.query.type === 'featureCase') {
activeTab.value = 'featureCase'; activeTab.value = 'featureCase';