diff --git a/frontend/src/api/modules/test-plan/testPlan.ts b/frontend/src/api/modules/test-plan/testPlan.ts index 4d39ee1a97..59114cf63f 100644 --- a/frontend/src/api/modules/test-plan/testPlan.ts +++ b/frontend/src/api/modules/test-plan/testPlan.ts @@ -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({ url: `${GetTestPlanUsersUrl}/${projectId}`, params: { keyword } }); +}; // 计划详情-功能用例列表-批量更新执行人 export function batchUpdateCaseExecutor(data: BatchUpdateCaseExecutorParams) { return MSR.post({ url: BatchUpdateCaseExecutorUrl, data }); diff --git a/frontend/src/api/requrls/test-plan/testPlan.ts b/frontend/src/api/requrls/test-plan/testPlan.ts index 32868d8f6f..4d24e40d63 100644 --- a/frontend/src/api/requrls/test-plan/testPlan.ts +++ b/frontend/src/api/requrls/test-plan/testPlan.ts @@ -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'; diff --git a/frontend/src/views/test-plan/testPlan/detail/featureCase/components/caseTable.vue b/frontend/src/views/test-plan/testPlan/detail/featureCase/components/caseTable.vue index 16e2ef5078..59cb360339 100644 --- a/frontend/src/views/test-plan/testPlan/detail/featureCase/components/caseTable.vue +++ b/frontend/src/views/test-plan/testPlan/detail/featureCase/components/caseTable.vue @@ -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([]); // TODO 接口联调 + const userOptions = ref([]); + 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, });