feat(测试计划): 测试计划详情-接口场景部分联调&功能用例调整
This commit is contained in:
parent
13ff8addf2
commit
8f3dc0b489
|
@ -8,11 +8,13 @@ import {
|
||||||
batchCopyPlanUrl,
|
batchCopyPlanUrl,
|
||||||
batchDeletePlanUrl,
|
batchDeletePlanUrl,
|
||||||
BatchDisassociateApiCaseUrl,
|
BatchDisassociateApiCaseUrl,
|
||||||
|
BatchDisassociateApiScenarioUrl,
|
||||||
BatchDisassociateCaseUrl,
|
BatchDisassociateCaseUrl,
|
||||||
BatchEditTestPlanUrl,
|
BatchEditTestPlanUrl,
|
||||||
batchMovePlanUrl,
|
batchMovePlanUrl,
|
||||||
BatchRunCaseUrl,
|
BatchRunCaseUrl,
|
||||||
BatchUpdateApiCaseExecutorUrl,
|
BatchUpdateApiCaseExecutorUrl,
|
||||||
|
BatchUpdateApiScenarioExecutorUrl,
|
||||||
BatchUpdateCaseExecutorUrl,
|
BatchUpdateCaseExecutorUrl,
|
||||||
ConfigScheduleUrl,
|
ConfigScheduleUrl,
|
||||||
copyTestPlanUrl,
|
copyTestPlanUrl,
|
||||||
|
@ -20,6 +22,7 @@ import {
|
||||||
DeleteScheduleTaskUrl,
|
DeleteScheduleTaskUrl,
|
||||||
DeleteTestPlanModuleUrl,
|
DeleteTestPlanModuleUrl,
|
||||||
DisassociateApiCaseUrl,
|
DisassociateApiCaseUrl,
|
||||||
|
DisassociateApiScenarioUrl,
|
||||||
DisassociateCaseUrl,
|
DisassociateCaseUrl,
|
||||||
dragPlanOnGroupUrl,
|
dragPlanOnGroupUrl,
|
||||||
ExecuteHistoryUrl,
|
ExecuteHistoryUrl,
|
||||||
|
@ -28,10 +31,13 @@ import {
|
||||||
GenerateReportUrl,
|
GenerateReportUrl,
|
||||||
GetApiCaseModuleCountUrl,
|
GetApiCaseModuleCountUrl,
|
||||||
GetApiCaseModuleUrl,
|
GetApiCaseModuleUrl,
|
||||||
|
GetApiScenarioModuleCountUrl,
|
||||||
|
GetApiScenarioModuleUrl,
|
||||||
GetAssociatedBugUrl,
|
GetAssociatedBugUrl,
|
||||||
GetFeatureCaseModuleCountUrl,
|
GetFeatureCaseModuleCountUrl,
|
||||||
GetFeatureCaseModuleUrl,
|
GetFeatureCaseModuleUrl,
|
||||||
GetPlanDetailApiCaseListUrl,
|
GetPlanDetailApiCaseListUrl,
|
||||||
|
GetPlanDetailApiScenarioListUrl,
|
||||||
GetPlanDetailFeatureCaseListUrl,
|
GetPlanDetailFeatureCaseListUrl,
|
||||||
GetPlanMinderUrl,
|
GetPlanMinderUrl,
|
||||||
getStatisticalCountUrl,
|
getStatisticalCountUrl,
|
||||||
|
@ -47,6 +53,7 @@ import {
|
||||||
planPassRateUrl,
|
planPassRateUrl,
|
||||||
RunFeatureCaseUrl,
|
RunFeatureCaseUrl,
|
||||||
SortApiCaseUrl,
|
SortApiCaseUrl,
|
||||||
|
SortApiScenarioUrl,
|
||||||
SortFeatureCaseUrl,
|
SortFeatureCaseUrl,
|
||||||
TestPlanAndGroupCopyUrl,
|
TestPlanAndGroupCopyUrl,
|
||||||
TestPlanApiAssociatedPageUrl,
|
TestPlanApiAssociatedPageUrl,
|
||||||
|
@ -83,6 +90,7 @@ import type {
|
||||||
PlanDetailApiCaseQueryParams,
|
PlanDetailApiCaseQueryParams,
|
||||||
PlanDetailApiCaseTreeParams,
|
PlanDetailApiCaseTreeParams,
|
||||||
PlanDetailApiScenarioItem,
|
PlanDetailApiScenarioItem,
|
||||||
|
PlanDetailApiScenarioQueryParams,
|
||||||
PlanDetailBugItem,
|
PlanDetailBugItem,
|
||||||
PlanDetailExecuteHistoryItem,
|
PlanDetailExecuteHistoryItem,
|
||||||
PlanDetailFeatureCaseItem,
|
PlanDetailFeatureCaseItem,
|
||||||
|
@ -216,8 +224,8 @@ export function getFeatureCaseModuleCount(data: PlanDetailFeatureCaseListQueryPa
|
||||||
return MSR.post({ url: GetFeatureCaseModuleCountUrl, data });
|
return MSR.post({ url: GetFeatureCaseModuleCountUrl, data });
|
||||||
}
|
}
|
||||||
// 计划详情-功能用例模块树
|
// 计划详情-功能用例模块树
|
||||||
export function getFeatureCaseModule(planId: string) {
|
export function getFeatureCaseModule(data: PlanDetailApiCaseTreeParams) {
|
||||||
return MSR.get<ModuleTreeNode[]>({ url: `${GetFeatureCaseModuleUrl}/${planId}` });
|
return MSR.post<ModuleTreeNode[]>({ url: GetFeatureCaseModuleUrl, data });
|
||||||
}
|
}
|
||||||
// 计划详情-功能用例列表-取消关联用例
|
// 计划详情-功能用例列表-取消关联用例
|
||||||
export function disassociateCase(data: DisassociateCaseParams) {
|
export function disassociateCase(data: DisassociateCaseParams) {
|
||||||
|
@ -295,13 +303,33 @@ export function batchDisassociateApiCase(data: BatchApiCaseParams) {
|
||||||
export function batchUpdateApiCaseExecutor(data: BatchUpdateApiCaseExecutorParams) {
|
export function batchUpdateApiCaseExecutor(data: BatchUpdateApiCaseExecutorParams) {
|
||||||
return MSR.post({ url: BatchUpdateApiCaseExecutorUrl, data });
|
return MSR.post({ url: BatchUpdateApiCaseExecutorUrl, data });
|
||||||
}
|
}
|
||||||
// 计划详情-接口场景列表 TODO 联调
|
// 计划详情-接口场景列表
|
||||||
export function getPlanDetailApiScenarioList(data: PlanDetailFeatureCaseListQueryParams) {
|
export function getPlanDetailApiScenarioList(data: PlanDetailApiScenarioQueryParams) {
|
||||||
return MSR.post<CommonList<PlanDetailApiScenarioItem>>({ url: GetPlanDetailFeatureCaseListUrl, data });
|
return MSR.post<CommonList<PlanDetailApiScenarioItem>>({ url: GetPlanDetailApiScenarioListUrl, data });
|
||||||
}
|
}
|
||||||
// 计划详情-接口场景列表-批量更新执行人 TODO 联调
|
// 计划详情-接口场景模块树
|
||||||
|
export function getApiScenarioModule(data: PlanDetailApiCaseTreeParams) {
|
||||||
|
return MSR.post<ModuleTreeNode[]>({ url: GetApiScenarioModuleUrl, data });
|
||||||
|
}
|
||||||
|
// 计划详情-接口场景-获取模块数量
|
||||||
|
export function getApiScenarioModuleCount(data: PlanDetailApiScenarioQueryParams) {
|
||||||
|
return MSR.post({ url: GetApiScenarioModuleCountUrl, data });
|
||||||
|
}
|
||||||
|
// 计划详情-接口场景列表-拖拽排序
|
||||||
|
export const sortApiScenario = (data: SortApiCaseParams) => {
|
||||||
|
return MSR.post({ url: SortApiScenarioUrl, data });
|
||||||
|
};
|
||||||
|
// 计划详情-接口场景列表-取消关联用例
|
||||||
|
export function disassociateApiScenario(data: DisassociateCaseParams) {
|
||||||
|
return MSR.post({ url: DisassociateApiScenarioUrl, data });
|
||||||
|
}
|
||||||
|
// 计划详情-接口场景列表-批量取消关联用例
|
||||||
|
export function batchDisassociateApiScenario(data: BatchApiCaseParams) {
|
||||||
|
return MSR.post({ url: BatchDisassociateApiScenarioUrl, data });
|
||||||
|
}
|
||||||
|
// 计划详情-接口场景列表-批量更新执行人
|
||||||
export function batchUpdateApiScenarioExecutor(data: BatchUpdateApiCaseExecutorParams) {
|
export function batchUpdateApiScenarioExecutor(data: BatchUpdateApiCaseExecutorParams) {
|
||||||
return MSR.post({ url: BatchUpdateApiCaseExecutorUrl, data });
|
return MSR.post({ url: BatchUpdateApiScenarioExecutorUrl, data });
|
||||||
}
|
}
|
||||||
// 计划详情-执行历史 TODO 联调
|
// 计划详情-执行历史 TODO 联调
|
||||||
export function getPlanDetailExecuteHistory(data: PlanDetailFeatureCaseListQueryParams) {
|
export function getPlanDetailExecuteHistory(data: PlanDetailFeatureCaseListQueryParams) {
|
||||||
|
|
|
@ -96,6 +96,7 @@ export const ConfigScheduleUrl = '/test-plan/schedule-config';
|
||||||
export const ExecutePlanUrl = '/test-plan-execute/start';
|
export const ExecutePlanUrl = '/test-plan-execute/start';
|
||||||
// 测试计划-删除定时任务
|
// 测试计划-删除定时任务
|
||||||
export const DeleteScheduleTaskUrl = 'test-plan/schedule-config-delete';
|
export const DeleteScheduleTaskUrl = 'test-plan/schedule-config-delete';
|
||||||
|
|
||||||
// 计划详情-接口用例列表
|
// 计划详情-接口用例列表
|
||||||
export const GetPlanDetailApiCaseListUrl = '/test-plan/api/case/page';
|
export const GetPlanDetailApiCaseListUrl = '/test-plan/api/case/page';
|
||||||
// 计划详情-接口用例模块树
|
// 计划详情-接口用例模块树
|
||||||
|
@ -110,5 +111,21 @@ export const DisassociateApiCaseUrl = '/test-plan/api/case/disassociate';
|
||||||
export const BatchDisassociateApiCaseUrl = '/test-plan/api/case/batch/disassociate';
|
export const BatchDisassociateApiCaseUrl = '/test-plan/api/case/batch/disassociate';
|
||||||
// 计划详情-接口用例列表-批量更新执行人
|
// 计划详情-接口用例列表-批量更新执行人
|
||||||
export const BatchUpdateApiCaseExecutorUrl = '/test-plan/api/case/batch/update/executor';
|
export const BatchUpdateApiCaseExecutorUrl = '/test-plan/api/case/batch/update/executor';
|
||||||
|
|
||||||
|
// 计划详情-接口场景列表
|
||||||
|
export const GetPlanDetailApiScenarioListUrl = '/test-plan/api/scenario/page';
|
||||||
|
// 计划详情-接口场景模块树
|
||||||
|
export const GetApiScenarioModuleUrl = '/test-plan/api/scenario/tree';
|
||||||
|
// 计划详情-接口场景-获取模块数量
|
||||||
|
export const GetApiScenarioModuleCountUrl = '/test-plan/api/scenario/module/count';
|
||||||
|
// 计划详情-接口场景列表-拖拽排序
|
||||||
|
export const SortApiScenarioUrl = '/test-plan/api/scenario/sort';
|
||||||
|
// 计划详情-接口场景列表-取消关联用例
|
||||||
|
export const DisassociateApiScenarioUrl = '/test-plan/api/scenario/disassociate';
|
||||||
|
// 计划详情-接口场景列表-批量取消关联用例
|
||||||
|
export const BatchDisassociateApiScenarioUrl = '/test-plan/api/scenario/batch/disassociate';
|
||||||
|
// 计划详情-接口场景列表-批量更新执行人
|
||||||
|
export const BatchUpdateApiScenarioExecutorUrl = '/test-plan/api/scenario/batch/update/executor';
|
||||||
|
|
||||||
// 测试规划脑图
|
// 测试规划脑图
|
||||||
export const GetPlanMinderUrl = '/test-plan/mind/data';
|
export const GetPlanMinderUrl = '/test-plan/mind/data';
|
||||||
|
|
|
@ -266,6 +266,7 @@ export interface PlanDetailApiCaseQueryParams extends TableQueryParams, TestPlan
|
||||||
versionId?: string;
|
versionId?: string;
|
||||||
refId?: string;
|
refId?: string;
|
||||||
collectionId?: string;
|
collectionId?: string;
|
||||||
|
treeType?: 'MODULE' | 'COLLECTION'; // 视图类型:模块是MODULE,测试集是COLLECTION
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlanDetailApiCaseTreeParams {
|
export interface PlanDetailApiCaseTreeParams {
|
||||||
|
@ -298,7 +299,7 @@ export interface BatchApiCaseParams extends BatchActionQueryParams {
|
||||||
testPlanId: string;
|
testPlanId: string;
|
||||||
moduleIds?: string[];
|
moduleIds?: string[];
|
||||||
collectionId?: string; // 测试集id
|
collectionId?: string; // 测试集id
|
||||||
protocols: string[];
|
protocols?: string[]; // 接口用例传protocols 接口场景不传
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BatchUpdateApiCaseExecutorParams extends BatchApiCaseParams {
|
export interface BatchUpdateApiCaseExecutorParams extends BatchApiCaseParams {
|
||||||
|
@ -309,24 +310,34 @@ export interface SortApiCaseParams extends DragSortParams {
|
||||||
testCollectionId: string; // 测试集id
|
testCollectionId: string; // 测试集id
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 联调
|
// 计划详情-接口场景
|
||||||
|
export interface PlanDetailApiScenarioQueryParams extends TableQueryParams, TestPlanBaseParams {
|
||||||
|
scenarioId?: string;
|
||||||
|
moduleIds?: string[];
|
||||||
|
versionId?: string;
|
||||||
|
refId?: string;
|
||||||
|
collectionId?: string;
|
||||||
|
treeType?: 'MODULE' | 'COLLECTION'; // 视图类型:模块是MODULE,测试集是COLLECTION
|
||||||
|
}
|
||||||
|
|
||||||
export interface PlanDetailApiScenarioItem {
|
export interface PlanDetailApiScenarioItem {
|
||||||
id: string;
|
id: string;
|
||||||
num: string;
|
num: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
priority: string;
|
||||||
|
projectId: string;
|
||||||
|
projectName: string;
|
||||||
|
environmentId: string;
|
||||||
|
environmentName: string;
|
||||||
moduleId: string;
|
moduleId: string;
|
||||||
versionName: string;
|
|
||||||
createUser: string;
|
createUser: string;
|
||||||
createUserName: string;
|
createUserName: string;
|
||||||
lastExecResult: LastExecuteResults;
|
lastExecResult: LastExecuteResults;
|
||||||
lastExecTime: number;
|
lastExecTime: number;
|
||||||
executeUser: string;
|
executeUser: string;
|
||||||
executeUserName: string;
|
executeUserName: string;
|
||||||
bugCount: number;
|
lastExecReportId: string; // 报告id
|
||||||
customFields: customFieldsItem[]; // 自定义字段集合
|
testPlanCollectionId: string; // 测试集id
|
||||||
caseId: string;
|
|
||||||
testPlanId: string;
|
|
||||||
lastExecResultReportId: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行历史 TODO 联调
|
// 执行历史 TODO 联调
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
function showReport(record: PlanDetailApiScenarioItem) {
|
function showReport(record: PlanDetailApiScenarioItem) {
|
||||||
reportVisible.value = true;
|
reportVisible.value = true;
|
||||||
apiReportId.value = record.lastExecResultReportId; // TODO 联调
|
apiReportId.value = record.lastExecReportId;
|
||||||
}
|
}
|
||||||
|
|
||||||
await tableStore.initColumn(TableKeyEnum.TEST_PLAN_REPORT_DETAIL_BUG, columns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.TEST_PLAN_REPORT_DETAIL_BUG, columns, 'drawer');
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
|
|
||||||
function showReport(record: PlanDetailApiScenarioItem) {
|
function showReport(record: PlanDetailApiScenarioItem) {
|
||||||
reportVisible.value = true;
|
reportVisible.value = true;
|
||||||
apiReportId.value = record.lastExecResultReportId; // TODO 联调
|
apiReportId.value = record.lastExecReportId;
|
||||||
}
|
}
|
||||||
|
|
||||||
await tableStore.initColumn(TableKeyEnum.TEST_PLAN_REPORT_DETAIL_BUG, columns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.TEST_PLAN_REPORT_DETAIL_BUG, columns, 'drawer');
|
||||||
|
|
|
@ -349,6 +349,7 @@
|
||||||
return {
|
return {
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
filter: propsRes.value.filter,
|
filter: propsRes.value.filter,
|
||||||
|
treeType: props.treeType,
|
||||||
...commonParams,
|
...commonParams,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
:tree-type="props.treeType"
|
:tree-type="props.treeType"
|
||||||
:modules-count="modulesCount"
|
:modules-count="modulesCount"
|
||||||
:module-name="moduleName"
|
:module-name="moduleName"
|
||||||
:repeat-case="props.repeatCase"
|
|
||||||
:active-module="activeFolderId"
|
:active-module="activeFolderId"
|
||||||
:offspring-ids="offspringIds"
|
:offspring-ids="offspringIds"
|
||||||
:module-tree="moduleTree"
|
:module-tree="moduleTree"
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
import type { PlanDetailApiCaseQueryParams } from '@/models/testPlan/testPlan';
|
import type { PlanDetailApiCaseQueryParams } from '@/models/testPlan/testPlan';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
repeatCase: boolean;
|
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
treeType: 'MODULE' | 'COLLECTION';
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<CaseLevel :case-level="filterContent.value" />
|
<CaseLevel :case-level="filterContent.value" />
|
||||||
</template>
|
</template>
|
||||||
<template #caseLevel="{ record }">
|
<template #caseLevel="{ record }">
|
||||||
<CaseLevel :case-level="record.caseLevel" />
|
<CaseLevel :case-level="record.priority" />
|
||||||
</template>
|
</template>
|
||||||
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_EXECUTE_RESULT]="{ filterContent }">
|
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_EXECUTE_RESULT]="{ filterContent }">
|
||||||
<ExecuteResult :execute-result="filterContent.key" />
|
<ExecuteResult :execute-result="filterContent.key" />
|
||||||
|
@ -101,11 +101,11 @@
|
||||||
import ReportDrawer from '@/views/test-plan/testPlan/detail/reportDrawer.vue';
|
import ReportDrawer from '@/views/test-plan/testPlan/detail/reportDrawer.vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
batchDisassociateCase,
|
batchDisassociateApiScenario,
|
||||||
batchUpdateApiScenarioExecutor,
|
batchUpdateApiScenarioExecutor,
|
||||||
disassociateCase,
|
disassociateApiScenario,
|
||||||
getPlanDetailApiScenarioList,
|
getPlanDetailApiScenarioList,
|
||||||
sortFeatureCase,
|
sortApiScenario,
|
||||||
} from '@/api/modules/test-plan/testPlan';
|
} from '@/api/modules/test-plan/testPlan';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useModal from '@/hooks/useModal';
|
import useModal from '@/hooks/useModal';
|
||||||
|
@ -116,18 +116,14 @@
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { DragSortParams, ModuleTreeNode } from '@/models/common';
|
import { DragSortParams, ModuleTreeNode } from '@/models/common';
|
||||||
import type { PlanDetailApiScenarioItem, PlanDetailFeatureCaseListQueryParams } from '@/models/testPlan/testPlan';
|
import type { PlanDetailApiScenarioItem, PlanDetailApiScenarioQueryParams } from '@/models/testPlan/testPlan';
|
||||||
import { LastExecuteResults } from '@/enums/caseEnum';
|
import { LastExecuteResults } from '@/enums/caseEnum';
|
||||||
import { ApiTestRouteEnum } from '@/enums/routeEnum';
|
import { ApiTestRouteEnum } from '@/enums/routeEnum';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||||
|
|
||||||
import { casePriorityOptions } from '@/views/api-test/components/config';
|
import { casePriorityOptions } from '@/views/api-test/components/config';
|
||||||
import {
|
import { executionResultMap, getModules } from '@/views/case-management/caseManagementFeature/components/utils';
|
||||||
executionResultMap,
|
|
||||||
getCaseLevels,
|
|
||||||
getModules,
|
|
||||||
} from '@/views/case-management/caseManagementFeature/components/utils';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modulesCount: Record<string, number>; // 模块数量统计对象
|
modulesCount: Record<string, number>; // 模块数量统计对象
|
||||||
|
@ -137,10 +133,11 @@
|
||||||
planId: string;
|
planId: string;
|
||||||
moduleTree: ModuleTreeNode[];
|
moduleTree: ModuleTreeNode[];
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'getModuleCount', params: PlanDetailFeatureCaseListQueryParams): void;
|
(e: 'getModuleCount', params: PlanDetailApiScenarioQueryParams): void;
|
||||||
(e: 'refresh'): void;
|
(e: 'refresh'): void;
|
||||||
(e: 'initModules'): void;
|
(e: 'initModules'): void;
|
||||||
}>();
|
}>();
|
||||||
|
@ -187,7 +184,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'case.caseLevel',
|
title: 'case.caseLevel',
|
||||||
dataIndex: 'caseLevel',
|
dataIndex: 'priority',
|
||||||
slotName: 'caseLevel',
|
slotName: 'caseLevel',
|
||||||
filterConfig: {
|
filterConfig: {
|
||||||
options: casePriorityOptions,
|
options: casePriorityOptions,
|
||||||
|
@ -234,7 +231,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'report.detail.api.executeEnv',
|
title: 'report.detail.api.executeEnv',
|
||||||
dataIndex: 'executeEnv',
|
dataIndex: 'environmentName',
|
||||||
width: 150,
|
width: 150,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
},
|
},
|
||||||
|
@ -280,21 +277,11 @@
|
||||||
return {
|
return {
|
||||||
...record,
|
...record,
|
||||||
lastExecResult: record.lastExecResult ?? LastExecuteResults.PENDING,
|
lastExecResult: record.lastExecResult ?? LastExecuteResults.PENDING,
|
||||||
caseLevel: getCaseLevels(record.customFields),
|
|
||||||
moduleId: getModules(record.moduleId, props.moduleTree),
|
moduleId: getModules(record.moduleId, props.moduleTree),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.canEdit,
|
|
||||||
(val) => {
|
|
||||||
tableProps.value.draggableCondition = hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && val;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
immediate: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
|
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
|
||||||
watch(
|
watch(
|
||||||
() => hasOperationPermission.value,
|
() => hasOperationPermission.value,
|
||||||
|
@ -339,12 +326,14 @@
|
||||||
}
|
}
|
||||||
return moduleIds;
|
return moduleIds;
|
||||||
}
|
}
|
||||||
|
const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule));
|
||||||
async function getTableParams(isBatch: boolean) {
|
async function getTableParams(isBatch: boolean) {
|
||||||
const selectModules = await getModuleIds();
|
const selectModules = await getModuleIds();
|
||||||
const commonParams = {
|
const commonParams = {
|
||||||
testPlanId: props.planId,
|
testPlanId: props.planId,
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
moduleIds: selectModules,
|
moduleIds: selectModules,
|
||||||
|
collectionId: collectionId.value,
|
||||||
};
|
};
|
||||||
if (isBatch) {
|
if (isBatch) {
|
||||||
return {
|
return {
|
||||||
|
@ -356,12 +345,27 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
treeType: props.treeType,
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
filter: propsRes.value.filter,
|
filter: propsRes.value.filter,
|
||||||
...commonParams,
|
...commonParams,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
[() => props.canEdit, () => props.treeType, () => collectionId.value.length],
|
||||||
|
() => {
|
||||||
|
tableProps.value.draggableCondition =
|
||||||
|
hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) &&
|
||||||
|
props.canEdit &&
|
||||||
|
props.treeType === 'COLLECTION' &&
|
||||||
|
!!collectionId.value.length;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
async function loadCaseList() {
|
async function loadCaseList() {
|
||||||
const tableParams = await getTableParams(false);
|
const tableParams = await getTableParams(false);
|
||||||
setLoadListParams(tableParams);
|
setLoadListParams(tableParams);
|
||||||
|
@ -393,7 +397,7 @@
|
||||||
const reportId = ref('');
|
const reportId = ref('');
|
||||||
function showReport(record: PlanDetailApiScenarioItem) {
|
function showReport(record: PlanDetailApiScenarioItem) {
|
||||||
reportVisible.value = true;
|
reportVisible.value = true;
|
||||||
reportId.value = record.lastExecResultReportId; // TODO 联调
|
reportId.value = record.lastExecReportId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableSelected = ref<(string | number)[]>([]); // 表格选中的
|
const tableSelected = ref<(string | number)[]>([]); // 表格选中的
|
||||||
|
@ -422,8 +426,7 @@
|
||||||
// 拖拽排序
|
// 拖拽排序
|
||||||
async function handleDragChange(params: DragSortParams) {
|
async function handleDragChange(params: DragSortParams) {
|
||||||
try {
|
try {
|
||||||
// TODO 联调
|
await sortApiScenario({ ...params, testCollectionId: collectionId.value });
|
||||||
await sortFeatureCase({ ...params, testPlanId: props.planId });
|
|
||||||
Message.success(t('caseManagement.featureCase.sortSuccess'));
|
Message.success(t('caseManagement.featureCase.sortSuccess'));
|
||||||
loadCaseList();
|
loadCaseList();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -437,8 +440,7 @@
|
||||||
async function handleDisassociateCase(record: PlanDetailApiScenarioItem, done?: () => void) {
|
async function handleDisassociateCase(record: PlanDetailApiScenarioItem, done?: () => void) {
|
||||||
try {
|
try {
|
||||||
disassociateLoading.value = true;
|
disassociateLoading.value = true;
|
||||||
// TODO 联调
|
await disassociateApiScenario({ testPlanId: props.planId, id: record.id });
|
||||||
await disassociateCase({ testPlanId: props.planId, id: record.id });
|
|
||||||
if (done) {
|
if (done) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
@ -467,8 +469,7 @@
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
const tableParams = await getTableParams(true);
|
const tableParams = await getTableParams(true);
|
||||||
// TODO 联调
|
await batchDisassociateApiScenario({
|
||||||
await batchDisassociateCase({
|
|
||||||
selectIds: tableSelected.value as string[],
|
selectIds: tableSelected.value as string[],
|
||||||
selectAll: batchParams.value.selectAll,
|
selectAll: batchParams.value.selectAll,
|
||||||
excludeIds: batchParams.value?.excludeIds || [],
|
excludeIds: batchParams.value?.excludeIds || [],
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
import MsTree from '@/components/business/ms-tree/index.vue';
|
import MsTree from '@/components/business/ms-tree/index.vue';
|
||||||
import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
|
import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
|
||||||
|
|
||||||
import { getFeatureCaseModule } from '@/api/modules/test-plan/testPlan';
|
import { getApiScenarioModule } from '@/api/modules/test-plan/testPlan';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { mapTree } from '@/utils';
|
import { mapTree } from '@/utils';
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modulesCount?: Record<string, number>; // 模块数量统计对象
|
modulesCount?: Record<string, number>; // 模块数量统计对象
|
||||||
selectedKeys: string[]; // 选中的节点 key
|
selectedKeys: string[]; // 选中的节点 key
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
||||||
|
@ -83,7 +84,18 @@
|
||||||
|
|
||||||
const activeFolder = ref<string>('all');
|
const activeFolder = ref<string>('all');
|
||||||
const allCount = ref(0);
|
const allCount = ref(0);
|
||||||
const isExpandAll = ref(false);
|
const isExpandAll = ref<boolean | undefined>(false);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.treeType,
|
||||||
|
(val) => {
|
||||||
|
if (val === 'COLLECTION') {
|
||||||
|
isExpandAll.value = undefined;
|
||||||
|
} else {
|
||||||
|
isExpandAll.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function setActiveFolder(id: string) {
|
function setActiveFolder(id: string) {
|
||||||
activeFolder.value = id;
|
activeFolder.value = id;
|
||||||
|
@ -99,8 +111,7 @@
|
||||||
async function initModules() {
|
async function initModules() {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
// TODO 联调
|
const res = await getApiScenarioModule({ testPlanId: route.query.id as string, treeType: props.treeType });
|
||||||
const res = await getFeatureCaseModule(route.query.id as string);
|
|
||||||
folderTree.value = mapTree<ModuleTreeNode>(res, (node) => {
|
folderTree.value = mapTree<ModuleTreeNode>(res, (node) => {
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
ref="caseTreeRef"
|
ref="caseTreeRef"
|
||||||
:modules-count="modulesCount"
|
:modules-count="modulesCount"
|
||||||
:selected-keys="selectedKeys"
|
:selected-keys="selectedKeys"
|
||||||
|
:tree-type="props.treeType"
|
||||||
@folder-node-select="handleFolderNodeSelect"
|
@folder-node-select="handleFolderNodeSelect"
|
||||||
@init="initModuleTree"
|
@init="initModuleTree"
|
||||||
/>
|
/>
|
||||||
|
@ -13,9 +14,9 @@
|
||||||
<CaseTable
|
<CaseTable
|
||||||
ref="caseTableRef"
|
ref="caseTableRef"
|
||||||
:plan-id="planId"
|
:plan-id="planId"
|
||||||
|
:tree-type="props.treeType"
|
||||||
:modules-count="modulesCount"
|
:modules-count="modulesCount"
|
||||||
:module-name="moduleName"
|
:module-name="moduleName"
|
||||||
:repeat-case="props.repeatCase"
|
|
||||||
:active-module="activeFolderId"
|
:active-module="activeFolderId"
|
||||||
:offspring-ids="offspringIds"
|
:offspring-ids="offspringIds"
|
||||||
:module-tree="moduleTree"
|
:module-tree="moduleTree"
|
||||||
|
@ -36,14 +37,14 @@
|
||||||
import CaseTable from './components/scenarioTable.vue';
|
import CaseTable from './components/scenarioTable.vue';
|
||||||
import CaseTree from './components/scenarioTree.vue';
|
import CaseTree from './components/scenarioTree.vue';
|
||||||
|
|
||||||
import { getFeatureCaseModuleCount } from '@/api/modules/test-plan/testPlan';
|
import { getApiScenarioModuleCount } from '@/api/modules/test-plan/testPlan';
|
||||||
|
|
||||||
import { ModuleTreeNode } from '@/models/common';
|
import { ModuleTreeNode } from '@/models/common';
|
||||||
import type { PlanDetailFeatureCaseListQueryParams } from '@/models/testPlan/testPlan';
|
import type { PlanDetailApiScenarioQueryParams } from '@/models/testPlan/testPlan';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
repeatCase: boolean;
|
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -54,10 +55,9 @@
|
||||||
|
|
||||||
const planId = ref(route.query.id as string);
|
const planId = ref(route.query.id as string);
|
||||||
const modulesCount = ref<Record<string, any>>({});
|
const modulesCount = ref<Record<string, any>>({});
|
||||||
async function getModuleCount(params: PlanDetailFeatureCaseListQueryParams) {
|
async function getModuleCount(params: PlanDetailApiScenarioQueryParams) {
|
||||||
try {
|
try {
|
||||||
// TODO 联调
|
modulesCount.value = await getApiScenarioModuleCount(params);
|
||||||
modulesCount.value = await getFeatureCaseModuleCount(params);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -90,8 +90,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCaseTableList() {
|
function getCaseTableList() {
|
||||||
initModules();
|
nextTick(() => {
|
||||||
caseTableRef.value?.loadCaseList();
|
initModules();
|
||||||
|
caseTableRef.value?.loadCaseList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
@ -180,6 +180,7 @@
|
||||||
planId: string;
|
planId: string;
|
||||||
moduleTree: ModuleTreeNode[];
|
moduleTree: ModuleTreeNode[];
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -321,16 +322,6 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.canEdit,
|
|
||||||
(val) => {
|
|
||||||
tableProps.value.draggableCondition = hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && val;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
immediate: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const batchActions = {
|
const batchActions = {
|
||||||
baseAction: [
|
baseAction: [
|
||||||
{
|
{
|
||||||
|
@ -372,12 +363,14 @@
|
||||||
}
|
}
|
||||||
return moduleIds;
|
return moduleIds;
|
||||||
}
|
}
|
||||||
|
const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule));
|
||||||
async function getTableParams(isBatch: boolean) {
|
async function getTableParams(isBatch: boolean) {
|
||||||
const selectModules = await getModuleIds();
|
const selectModules = await getModuleIds();
|
||||||
const commonParams = {
|
const commonParams = {
|
||||||
testPlanId: props.planId,
|
testPlanId: props.planId,
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
moduleIds: selectModules,
|
moduleIds: selectModules,
|
||||||
|
collectionId: collectionId.value,
|
||||||
};
|
};
|
||||||
if (isBatch) {
|
if (isBatch) {
|
||||||
return {
|
return {
|
||||||
|
@ -391,10 +384,25 @@
|
||||||
return {
|
return {
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
filter: propsRes.value.filter,
|
filter: propsRes.value.filter,
|
||||||
|
treeType: props.treeType,
|
||||||
...commonParams,
|
...commonParams,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
[() => props.canEdit, () => props.treeType, () => collectionId.value.length],
|
||||||
|
() => {
|
||||||
|
tableProps.value.draggableCondition =
|
||||||
|
hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) &&
|
||||||
|
props.canEdit &&
|
||||||
|
props.treeType === 'COLLECTION' &&
|
||||||
|
!!collectionId.value.length;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
async function loadCaseList() {
|
async function loadCaseList() {
|
||||||
const tableParams = await getTableParams(false);
|
const tableParams = await getTableParams(false);
|
||||||
setLoadListParams(tableParams);
|
setLoadListParams(tableParams);
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modulesCount?: Record<string, number>; // 模块数量统计对象
|
modulesCount?: Record<string, number>; // 模块数量统计对象
|
||||||
selectedKeys: string[]; // 选中的节点 key
|
selectedKeys: string[]; // 选中的节点 key
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
||||||
|
@ -83,7 +84,18 @@
|
||||||
|
|
||||||
const activeFolder = ref<string>('all');
|
const activeFolder = ref<string>('all');
|
||||||
const allCount = ref(0);
|
const allCount = ref(0);
|
||||||
const isExpandAll = ref(false);
|
const isExpandAll = ref<boolean | undefined>(false);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.treeType,
|
||||||
|
(val) => {
|
||||||
|
if (val === 'COLLECTION') {
|
||||||
|
isExpandAll.value = undefined;
|
||||||
|
} else {
|
||||||
|
isExpandAll.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function setActiveFolder(id: string) {
|
function setActiveFolder(id: string) {
|
||||||
activeFolder.value = id;
|
activeFolder.value = id;
|
||||||
|
@ -102,7 +114,7 @@
|
||||||
async function initModules() {
|
async function initModules() {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await getFeatureCaseModule(route.query.id as string);
|
const res = await getFeatureCaseModule({ testPlanId: route.query.id as string, treeType: props.treeType });
|
||||||
folderTree.value = mapTree<ModuleTreeNode>(res, (node) => {
|
folderTree.value = mapTree<ModuleTreeNode>(res, (node) => {
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<div class="p-[16px]">
|
<div class="p-[16px]">
|
||||||
<CaseTree
|
<CaseTree
|
||||||
ref="caseTreeRef"
|
ref="caseTreeRef"
|
||||||
|
:tree-type="props.treeType"
|
||||||
:modules-count="modulesCount"
|
:modules-count="modulesCount"
|
||||||
:selected-keys="selectedKeys"
|
:selected-keys="selectedKeys"
|
||||||
@folder-node-select="handleFolderNodeSelect"
|
@folder-node-select="handleFolderNodeSelect"
|
||||||
|
@ -14,10 +15,10 @@
|
||||||
<template #second>
|
<template #second>
|
||||||
<CaseTable
|
<CaseTable
|
||||||
ref="caseTableRef"
|
ref="caseTableRef"
|
||||||
|
:tree-type="props.treeType"
|
||||||
:plan-id="planId"
|
:plan-id="planId"
|
||||||
:modules-count="modulesCount"
|
:modules-count="modulesCount"
|
||||||
:module-name="moduleName"
|
:module-name="moduleName"
|
||||||
:repeat-case="props.repeatCase"
|
|
||||||
:active-module="activeFolderId"
|
:active-module="activeFolderId"
|
||||||
:offspring-ids="offspringIds"
|
:offspring-ids="offspringIds"
|
||||||
:module-tree="moduleTree"
|
:module-tree="moduleTree"
|
||||||
|
@ -44,8 +45,8 @@
|
||||||
import type { PlanDetailFeatureCaseListQueryParams } from '@/models/testPlan/testPlan';
|
import type { PlanDetailFeatureCaseListQueryParams } from '@/models/testPlan/testPlan';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
repeatCase: boolean;
|
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
|
treeType: 'MODULE' | 'COLLECTION';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -91,8 +92,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCaseTableList() {
|
function getCaseTableList() {
|
||||||
initModules();
|
nextTick(() => {
|
||||||
caseTableRef.value?.loadCaseList();
|
initModules();
|
||||||
|
caseTableRef.value?.loadCaseList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
<FeatureCase
|
<FeatureCase
|
||||||
v-if="activeTab === 'featureCase'"
|
v-if="activeTab === 'featureCase'"
|
||||||
ref="featureCaseRef"
|
ref="featureCaseRef"
|
||||||
:repeat-case="detail.repeatCase"
|
:tree-type="treeType"
|
||||||
:can-edit="detail.status !== 'ARCHIVED'"
|
:can-edit="detail.status !== 'ARCHIVED'"
|
||||||
@refresh="initDetail"
|
@refresh="initDetail"
|
||||||
/>
|
/>
|
||||||
|
@ -114,14 +114,13 @@
|
||||||
v-if="activeTab === 'apiCase'"
|
v-if="activeTab === 'apiCase'"
|
||||||
ref="apiCaseRef"
|
ref="apiCaseRef"
|
||||||
:tree-type="treeType"
|
:tree-type="treeType"
|
||||||
:repeat-case="detail.repeatCase"
|
|
||||||
:can-edit="detail.status !== 'ARCHIVED'"
|
:can-edit="detail.status !== 'ARCHIVED'"
|
||||||
@refresh="initDetail"
|
@refresh="initDetail"
|
||||||
/>
|
/>
|
||||||
<ApiScenario
|
<ApiScenario
|
||||||
v-if="activeTab === 'apiScenario'"
|
v-if="activeTab === 'apiScenario'"
|
||||||
ref="apiScenarioRef"
|
ref="apiScenarioRef"
|
||||||
:repeat-case="detail.repeatCase"
|
:tree-type="treeType"
|
||||||
:can-edit="detail.status !== 'ARCHIVED'"
|
:can-edit="detail.status !== 'ARCHIVED'"
|
||||||
@refresh="initDetail"
|
@refresh="initDetail"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue