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, GetTestPlanListUrl,
GetTestPlanModuleCountUrl, GetTestPlanModuleCountUrl,
GetTestPlanModuleUrl, GetTestPlanModuleUrl,
GetTestPlanUsersUrl,
MoveTestPlanModuleUrl, MoveTestPlanModuleUrl,
planDetailBugPageUrl, planDetailBugPageUrl,
planPassRateUrl, planPassRateUrl,
@ -38,6 +39,7 @@ import {
UpdateTestPlanUrl, UpdateTestPlanUrl,
} from '@/api/requrls/test-plan/testPlan'; } from '@/api/requrls/test-plan/testPlan';
import { ReviewUserItem } from '@/models/caseManagement/caseReview';
import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase'; import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase';
import type { CommonList, MoveModules, TableQueryParams } from '@/models/common'; import type { CommonList, MoveModules, TableQueryParams } from '@/models/common';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
@ -190,6 +192,10 @@ export function batchDisassociateCase(data: BatchFeatureCaseParams) {
export function batchExecuteCase(data: BatchExecuteFeatureCaseParams) { export function batchExecuteCase(data: BatchExecuteFeatureCaseParams) {
return MSR.post({ url: BatchRunCaseUrl, data }); 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) { export function batchUpdateCaseExecutor(data: BatchUpdateCaseExecutorParams) {
return MSR.post({ url: BatchUpdateCaseExecutorUrl, data }); 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 TestPlanCancelBugUrl = '/test-plan/functional/case/disassociate/bug';
// 计划详情-功能用例-批量执行 // 计划详情-功能用例-批量执行
export const BatchRunCaseUrl = '/test-plan/functional/case/batch/run'; 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'; export const BatchUpdateCaseExecutorUrl = '/test-plan/functional/case/batch/update/executor';

View File

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