fix(测试计划): 测试计划详情&更新测试计划-修改字段和细节

This commit is contained in:
teukkk 2024-06-17 11:40:56 +08:00 committed by Craftsman
parent 6690a55194
commit 67f1d63f8a
9 changed files with 17 additions and 69 deletions

View File

@ -23,8 +23,6 @@ import {
BatchRunApiCaseUrl,
BatchRunApiScenarioUrl,
BatchRunCaseUrl,
BatchUpdateApiCaseExecutorUrl,
BatchUpdateApiScenarioExecutorUrl,
BatchUpdateCaseExecutorUrl,
ConfigScheduleUrl,
copyTestPlanUrl,
@ -94,7 +92,6 @@ import type {
BatchExecutePlan,
BatchFeatureCaseParams,
BatchMoveApiCaseParams,
BatchUpdateApiCaseExecutorParams,
BatchUpdateCaseExecutorParams,
CreateTask,
DisassociateCaseParams,
@ -324,10 +321,6 @@ export function runApiCase(id: string, reportId?: string) {
export function batchDisassociateApiCase(data: BatchApiCaseParams) {
return MSR.post({ url: BatchDisassociateApiCaseUrl, data });
}
// 计划详情-接口用例列表-批量更新执行人
export function batchUpdateApiCaseExecutor(data: BatchUpdateApiCaseExecutorParams) {
return MSR.post({ url: BatchUpdateApiCaseExecutorUrl, data });
}
// 计划详情-接口用例列表-批量执行
export function batchRunApiCase(data: BatchApiCaseParams) {
return MSR.post({ url: BatchRunApiCaseUrl, data });
@ -372,10 +365,6 @@ export function disassociateApiScenario(data: DisassociateCaseParams) {
export function batchDisassociateApiScenario(data: BatchApiCaseParams) {
return MSR.post({ url: BatchDisassociateApiScenarioUrl, data });
}
// 计划详情-接口场景列表-批量更新执行人
export function batchUpdateApiScenarioExecutor(data: BatchUpdateApiCaseExecutorParams) {
return MSR.post({ url: BatchUpdateApiScenarioExecutorUrl, data });
}
// 计划详情-接口场景列表-批量执行
export function batchRunApiScenario(data: BatchApiCaseParams) {
return MSR.post({ url: BatchRunApiScenarioUrl, data });

View File

@ -117,8 +117,6 @@ export const RunApiCaseUrl = '/test-plan/api/case/run';
export const DisassociateApiCaseUrl = '/test-plan/api/case/disassociate';
// 计划详情-接口用例列表-批量取消关联用例
export const BatchDisassociateApiCaseUrl = '/test-plan/api/case/batch/disassociate';
// 计划详情-接口用例列表-批量更新执行人
export const BatchUpdateApiCaseExecutorUrl = '/test-plan/api/case/batch/update/executor';
// 计划详情-接口用例列表-批量执行
export const BatchRunApiCaseUrl = '/test-plan/api/case/batch/run';
// 计划详情-接口用例列表-批量移动
@ -142,8 +140,6 @@ export const RunApiScenarioUrl = '/test-plan/api/scenario/run';
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 BatchRunApiScenarioUrl = '/test-plan/api/scenario/batch/run';
// 计划详情-接口场景列表-批量移动

View File

@ -308,10 +308,6 @@ export interface BatchApiCaseParams extends BatchActionQueryParams {
protocols?: string[]; // 接口用例传protocols 接口场景不传
}
export interface BatchUpdateApiCaseExecutorParams extends BatchApiCaseParams {
userId: string; // 执行人id
}
export interface BatchMoveApiCaseParams extends BatchApiCaseParams {
targetCollectionId: string; // 测试集id
}
@ -348,6 +344,7 @@ export interface PlanDetailApiScenarioItem {
executeUserName: string;
lastExecReportId: string; // 报告id
testPlanCollectionId: string; // 测试集id
apiScenarioId: string; // 场景id
}
// 执行历史
@ -355,7 +352,7 @@ export interface PlanDetailExecuteHistoryItem {
id: string;
num: string;
triggerMode: string; // 执行方式
execStatus: string; // 执行结果
execResult: string; // 执行结果
operationUser: string;
startTime: number;
endTime: number;

View File

@ -52,11 +52,11 @@
import useAppStore from '@/store/modules/app';
import { ReviewUserItem } from '@/models/caseManagement/caseReview';
import type { BatchUpdateApiCaseExecutorParams, BatchUpdateCaseExecutorParams } from '@/models/testPlan/testPlan';
import type { BatchUpdateCaseExecutorParams } from '@/models/testPlan/testPlan';
const props = defineProps<{
count: number;
params?: BatchUpdateCaseExecutorParams | BatchUpdateApiCaseExecutorParams;
params?: BatchUpdateCaseExecutorParams;
batchUpdateExecutor: (...args: any) => Promise<any>; //
}>();

View File

@ -277,6 +277,9 @@
plannedEndTime: form.value.cycle ? form.value.cycle[1] : undefined,
projectId: appStore.currentProjectId,
};
if (!params.isGroup && params.groupId) {
delete params.groupId;
}
if (!props.planId?.length) {
await addTestPlan(params);
Message.success(t('common.createSuccess'));
@ -307,7 +310,8 @@
form.value.cycle = [result.plannedStartTime as number, result.plannedEndTime as number];
form.value.passThreshold = parseFloat(result.passThreshold.toString());
form.value.isGroup = result.groupId !== 'none';
form.value.isGroup = result.groupId !== 'NONE';
form.value.groupId = result.groupId !== 'NONE' ? result.groupId : '';
}
} catch (error) {
// eslint-disable-next-line no-console

View File

@ -79,14 +79,6 @@
:report-detail="getApiCaseReport"
:get-report-step-detail="getApiCaseReportStep"
/>
<!-- 批量修改执行人 -->
<BatchUpdateExecutorModal
v-model:visible="batchUpdateExecutorModalVisible"
:count="batchParams.currentSelectCount || tableSelected.length"
:params="batchUpdateParams"
:batch-update-executor="batchUpdateApiCaseExecutor"
@load-list="resetSelectorAndCaseList"
/>
<!-- 批量移动 -->
<BatchApiMoveModal
v-model:visible="batchMoveModalVisible"
@ -120,13 +112,11 @@
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import CaseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import BatchApiMoveModal from '@/views/test-plan/testPlan/components/batchApiMoveModal.vue';
import BatchUpdateExecutorModal from '@/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue';
import {
batchDisassociateApiCase,
batchMoveApiCase,
batchRunApiCase,
batchUpdateApiCaseExecutor,
disassociateApiCase,
getApiCaseReport,
getApiCaseReportStep,
@ -336,11 +326,6 @@
eventTag: 'execute',
permission: ['PROJECT_TEST_PLAN:READ+EXECUTE'],
},
{
label: 'testPlan.featureCase.changeExecutor',
eventTag: 'changeExecutor',
permission: ['PROJECT_TEST_PLAN:READ+UPDATE'],
},
...(props.treeType === 'COLLECTION'
? [{ label: 'common.move', eventTag: 'move', permission: ['PROJECT_TEST_PLAN:READ+UPDATE'] }]
: []),
@ -564,9 +549,8 @@
});
}
//
//
const batchUpdateParams = ref();
const batchUpdateExecutorModalVisible = ref(false);
const batchMoveModalVisible = ref(false);
//
@ -587,9 +571,6 @@
case 'disassociate':
handleBatchDisassociateCase();
break;
case 'changeExecutor':
batchUpdateExecutorModalVisible.value = true;
break;
case 'move':
batchMoveModalVisible.value = true;
break;

View File

@ -80,14 +80,6 @@
:report-detail="getApiScenarioReport"
:get-report-step-detail="getApiScenarioReportStep"
/>
<!-- 批量修改执行人 -->
<BatchUpdateExecutorModal
v-model:visible="batchUpdateExecutorModalVisible"
:count="batchParams.currentSelectCount || tableSelected.length"
:params="batchUpdateParams"
:batch-update-executor="batchUpdateApiScenarioExecutor"
@load-list="resetSelectorAndCaseList"
/>
<!-- 批量移动 -->
<BatchApiMoveModal
v-model:visible="batchMoveModalVisible"
@ -120,13 +112,11 @@
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import CaseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import BatchApiMoveModal from '@/views/test-plan/testPlan/components/batchApiMoveModal.vue';
import BatchUpdateExecutorModal from '@/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue';
import {
batchDisassociateApiScenario,
batchMoveApiScenario,
batchRunApiScenario,
batchUpdateApiScenarioExecutor,
disassociateApiScenario,
getApiScenarioReport,
getApiScenarioReportStep,
@ -325,11 +315,6 @@
eventTag: 'execute',
permission: ['PROJECT_TEST_PLAN:READ+EXECUTE'],
},
{
label: 'testPlan.featureCase.changeExecutor',
eventTag: 'changeExecutor',
permission: ['PROJECT_TEST_PLAN:READ+UPDATE'],
},
...(props.treeType === 'COLLECTION'
? [{ label: 'common.move', eventTag: 'move', permission: ['PROJECT_TEST_PLAN:READ+UPDATE'] }]
: []),
@ -555,9 +540,8 @@
});
}
//
//
const batchUpdateParams = ref();
const batchUpdateExecutorModalVisible = ref(false);
const batchMoveModalVisible = ref(false);
//
@ -578,9 +562,6 @@
case 'disassociate':
handleBatchDisassociateCase();
break;
case 'changeExecutor':
batchUpdateExecutorModalVisible.value = true;
break;
case 'move':
batchMoveModalVisible.value = true;
break;
@ -592,7 +573,7 @@
//
function toDetail(record: PlanDetailApiScenarioItem) {
openNewPage(ApiTestRouteEnum.API_TEST_SCENARIO, {
id: record.id,
id: record.apiScenarioId,
});
}

View File

@ -8,7 +8,7 @@
<span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
</template>
<template #lastExecResult="{ record }">
<ExecutionStatus v-if="record.execStatus" :status="record.execStatus" :module-type="ReportEnum.API_REPORT" />
<ExecutionStatus v-if="record.execResult" :status="record.execResult" :module-type="ReportEnum.API_REPORT" />
</template>
<template #executionStartAndEndTime="{ record }">
<div>
@ -87,7 +87,7 @@
},
{
title: 'common.executionResult',
dataIndex: 'execStatus',
dataIndex: 'execResult',
slotName: 'lastExecResult',
filterConfig: {
options: statusResultOptions.value,

View File

@ -23,8 +23,8 @@
v-model="treeType"
size="small"
type="line"
checked-value="COLLECTION"
unchecked-value="MODULE"
checked-value="MODULE"
unchecked-value="COLLECTION"
class="mr-[4px]"
@change="loadActiveTabList"
/>
@ -192,7 +192,7 @@
const detail = ref<TestPlanDetail>({
...testPlanDefaultDetail,
});
const treeType = ref<'MODULE' | 'COLLECTION'>('MODULE');
const treeType = ref<'MODULE' | 'COLLECTION'>('COLLECTION');
const countDetail = ref<PassRateCountDetail>({ ...defaultDetailCount });