From 586417e1bf21c5b7e456fc62e5a51f91696fa4cc Mon Sep 17 00:00:00 2001 From: teukkk Date: Fri, 17 May 2024 14:24:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=AF=A6=E6=83=85-?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B-=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=BA=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/test-plan/testPlan.ts | 6 ++++ .../src/api/requrls/test-plan/testPlan.ts | 2 ++ .../featureCase/components/caseTable.vue | 28 +++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) 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, });