feat(测试计划): 测试计划详情-功能用例-执行人列表

This commit is contained in:
teukkk 2024-05-17 14:24:01 +08:00 committed by 刘瑞斌
parent 87dc83bf75
commit 586417e1bf
3 changed files with 31 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import {
GetTestPlanListUrl,
GetTestPlanModuleCountUrl,
GetTestPlanModuleUrl,
GetTestPlanUsersUrl,
MoveTestPlanModuleUrl,
planDetailBugPageUrl,
planPassRateUrl,
@ -38,6 +39,7 @@ import {
UpdateTestPlanUrl,
} from '@/api/requrls/test-plan/testPlan';
import { ReviewUserItem } from '@/models/caseManagement/caseReview';
import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase';
import type { CommonList, MoveModules, TableQueryParams } from '@/models/common';
import { ModuleTreeNode } from '@/models/common';
@ -190,6 +192,10 @@ export function batchDisassociateCase(data: BatchFeatureCaseParams) {
export function batchExecuteCase(data: BatchExecuteFeatureCaseParams) {
return MSR.post({ url: BatchRunCaseUrl, data });
}
// 计划详情-功能用例-获取用户列表
export const GetTestPlanUsers = (projectId: string, keyword: string) => {
return MSR.get<ReviewUserItem[]>({ url: `${GetTestPlanUsersUrl}/${projectId}`, params: { keyword } });
};
// 计划详情-功能用例列表-批量更新执行人
export function batchUpdateCaseExecutor(data: BatchUpdateCaseExecutorParams) {
return MSR.post({ url: BatchUpdateCaseExecutorUrl, data });

View File

@ -68,5 +68,7 @@ export const TestPlanAssociateBugUrl = '/test-plan/functional/case/associate/bug
export const TestPlanCancelBugUrl = '/test-plan/functional/case/disassociate/bug';
// 计划详情-功能用例-批量执行
export const BatchRunCaseUrl = '/test-plan/functional/case/batch/run';
// 计划详情-功能用例-获取用户列表
export const GetTestPlanUsersUrl = '/test-plan/functional/case/user-option';
// 计划详情-功能用例-批量更新执行人
export const BatchUpdateCaseExecutorUrl = '/test-plan/functional/case/batch/update/executor';

View File

@ -151,7 +151,7 @@
v-model:modelValue="batchUpdateExecutorForm.userId"
mode="static"
:placeholder="t('common.pleaseSelect')"
:loading="batchLoading"
:loading="executorLoading"
:options="userOptions"
:search-keys="['label']"
allow-search
@ -185,6 +185,7 @@
disassociateCase,
editLastExecResult,
getPlanDetailFeatureCaseList,
GetTestPlanUsers,
sortFeatureCase,
} from '@/api/modules/test-plan/testPlan';
import { defaultExecuteForm } from '@/config/testPlan';
@ -194,6 +195,7 @@
import useAppStore from '@/store/modules/app';
import { hasAnyPermission } from '@/utils/permission';
import { ReviewUserItem } from '@/models/caseManagement/caseReview';
import { DragSortParams, ModuleTreeNode } from '@/models/common';
import type {
ExecuteFeatureCaseFormParams,
@ -407,9 +409,6 @@
pageSize: propsRes.value.msPagination?.pageSize,
});
}
onBeforeMount(() => {
loadCaseList();
});
watch(
() => props.activeModule,
() => {
@ -556,7 +555,21 @@
const batchUpdateExecutorModalVisible = ref(false);
const batchUpdateExecutorForm = ref<{ userId: string }>({ userId: '' });
const batchUpdateExecutorDisabled = computed(() => !batchUpdateExecutorForm.value.userId.length);
const userOptions = ref<SelectOptionData[]>([]); // TODO
const userOptions = ref<SelectOptionData[]>([]);
const executorLoading = ref(false);
async function initUserOptions() {
try {
executorLoading.value = true;
const res = await GetTestPlanUsers(appStore.currentProjectId, '');
userOptions.value = res.map((e: ReviewUserItem) => ({ label: e.name, value: e.id }));
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
executorLoading.value = false;
}
}
async function handleBatchUpdateExecutor() {
batchUpdateExecutorFormRef.value?.validate(async (errors) => {
if (!errors) {
@ -619,6 +632,11 @@
});
}
onBeforeMount(() => {
loadCaseList();
initUserOptions();
});
defineExpose({
resetSelector,
});