From 727e7eb92866c14133be86252e597d08eae6c623 Mon Sep 17 00:00:00 2001 From: teukkk Date: Wed, 12 Jun 2024 17:03:35 +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?=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B&=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=9C=BA=E6=99=AF-=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/test-plan/testPlan.ts | 11 ++ .../src/api/requrls/test-plan/testPlan.ts | 4 + frontend/src/models/testPlan/testPlan.ts | 4 + .../testPlan/components/batchApiMoveModal.vue | 111 ++++++++++++++++++ .../components/batchUpdateExecutorModal.vue | 2 +- .../detail/apiCase/components/caseTable.vue | 79 +++++++------ .../apiScenario/components/scenarioTable.vue | 79 +++++++------ .../views/test-plan/testPlan/locale/zh-CN.ts | 1 + 8 files changed, 224 insertions(+), 67 deletions(-) create mode 100644 frontend/src/views/test-plan/testPlan/components/batchApiMoveModal.vue diff --git a/frontend/src/api/modules/test-plan/testPlan.ts b/frontend/src/api/modules/test-plan/testPlan.ts index 19e96bc254..67851740bb 100644 --- a/frontend/src/api/modules/test-plan/testPlan.ts +++ b/frontend/src/api/modules/test-plan/testPlan.ts @@ -11,6 +11,8 @@ import { BatchDisassociateApiScenarioUrl, BatchDisassociateCaseUrl, BatchEditTestPlanUrl, + BatchMoveApiCaseUrl, + BatchMoveApiScenarioUrl, batchMovePlanUrl, BatchRunApiCaseUrl, BatchRunApiScenarioUrl, @@ -82,6 +84,7 @@ import type { BatchApiCaseParams, BatchExecuteFeatureCaseParams, BatchFeatureCaseParams, + BatchMoveApiCaseParams, BatchUpdateApiCaseExecutorParams, BatchUpdateCaseExecutorParams, CreateTask, @@ -316,6 +319,10 @@ export function batchUpdateApiCaseExecutor(data: BatchUpdateApiCaseExecutorParam export function batchRunApiCase(data: BatchApiCaseParams) { return MSR.post({ url: BatchRunApiCaseUrl, data }); } +// 计划详情-接口用例列表-批量移动 +export function batchMoveApiCase(data: BatchMoveApiCaseParams) { + return MSR.post({ url: BatchMoveApiCaseUrl, data }); +} // 计划详情-接口场景列表 export function getPlanDetailApiScenarioList(data: PlanDetailApiScenarioQueryParams) { return MSR.post>({ url: GetPlanDetailApiScenarioListUrl, data }); @@ -352,6 +359,10 @@ export function batchUpdateApiScenarioExecutor(data: BatchUpdateApiCaseExecutorP export function batchRunApiScenario(data: BatchApiCaseParams) { return MSR.post({ url: BatchRunApiScenarioUrl, data }); } +// 计划详情-接口场景列表-批量移动 +export function batchMoveApiScenario(data: BatchMoveApiCaseParams) { + return MSR.post({ url: BatchMoveApiScenarioUrl, data }); +} // 计划详情-执行历史 TODO 联调 export function getPlanDetailExecuteHistory(data: PlanDetailFeatureCaseListQueryParams) { return MSR.post>({ url: PlanDetailExecuteHistoryUrl, data }); diff --git a/frontend/src/api/requrls/test-plan/testPlan.ts b/frontend/src/api/requrls/test-plan/testPlan.ts index ca38814553..30ec306025 100644 --- a/frontend/src/api/requrls/test-plan/testPlan.ts +++ b/frontend/src/api/requrls/test-plan/testPlan.ts @@ -117,6 +117,8 @@ export const BatchDisassociateApiCaseUrl = '/test-plan/api/case/batch/disassocia export const BatchUpdateApiCaseExecutorUrl = '/test-plan/api/case/batch/update/executor'; // 计划详情-接口用例列表-批量执行 export const BatchRunApiCaseUrl = '/test-plan/api/case/batch/run'; +// 计划详情-接口用例列表-批量移动 +export const BatchMoveApiCaseUrl = '/test-plan/api/case/batch/move'; // 计划详情-接口场景列表 export const GetPlanDetailApiScenarioListUrl = '/test-plan/api/scenario/page'; @@ -136,6 +138,8 @@ export const BatchDisassociateApiScenarioUrl = '/test-plan/api/scenario/batch/di export const BatchUpdateApiScenarioExecutorUrl = '/test-plan/api/scenario/batch/update/executor'; // 计划详情-接口场景列表-批量执行 export const BatchRunApiScenarioUrl = '/test-plan/api/scenario/batch/run'; +// 计划详情-接口场景列表-批量移动 +export const BatchMoveApiScenarioUrl = '/test-plan/api/scenario/batch/move'; // 测试规划脑图 export const GetPlanMinderUrl = '/test-plan/mind/data'; diff --git a/frontend/src/models/testPlan/testPlan.ts b/frontend/src/models/testPlan/testPlan.ts index 40d9c5014c..b3e0617fa5 100644 --- a/frontend/src/models/testPlan/testPlan.ts +++ b/frontend/src/models/testPlan/testPlan.ts @@ -307,6 +307,10 @@ export interface BatchUpdateApiCaseExecutorParams extends BatchApiCaseParams { userId: string; // 执行人id } +export interface BatchMoveApiCaseParams extends BatchApiCaseParams { + targetCollectionId: string; // 测试集id +} + export interface SortApiCaseParams extends DragSortParams { testCollectionId: string; // 测试集id } diff --git a/frontend/src/views/test-plan/testPlan/components/batchApiMoveModal.vue b/frontend/src/views/test-plan/testPlan/components/batchApiMoveModal.vue new file mode 100644 index 0000000000..b84e317f6f --- /dev/null +++ b/frontend/src/views/test-plan/testPlan/components/batchApiMoveModal.vue @@ -0,0 +1,111 @@ + + + diff --git a/frontend/src/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue b/frontend/src/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue index a5826593e1..ba3b3116ea 100644 --- a/frontend/src/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue +++ b/frontend/src/views/test-plan/testPlan/components/batchUpdateExecutorModal.vue @@ -12,7 +12,7 @@ > @@ -104,10 +113,12 @@ import ApiMethodName from '@/views/api-test/components/apiMethodName.vue'; 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, @@ -309,30 +320,30 @@ } ); - const batchActions = { - baseAction: [ - { - label: 'common.execute', - eventTag: 'execute', - permission: ['PROJECT_TEST_PLAN:READ+EXECUTE'], - }, - { - label: 'testPlan.featureCase.changeExecutor', - eventTag: 'changeExecutor', - permission: ['PROJECT_TEST_PLAN:READ+UPDATE'], - }, - { - label: 'common.move', - eventTag: 'move', - permission: ['PROJECT_TEST_PLAN:READ+UPDATE'], - }, - { - label: 'common.cancelLink', - eventTag: 'disassociate', - permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], - }, - ], - }; + const batchActions = computed(() => { + return { + baseAction: [ + { + label: 'common.execute', + 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'] }] + : []), + { + label: 'common.cancelLink', + eventTag: 'disassociate', + permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], + }, + ], + }; + }); async function getModuleIds() { let moduleIds: string[] = []; @@ -543,15 +554,22 @@ }); } - // 批量修改执行人 + // 批量修改执行人 和 批量移动 + const batchUpdateParams = ref(); const batchUpdateExecutorModalVisible = ref(false); - const batchUpdateExecutorParams = ref(); + const batchMoveModalVisible = ref(false); // 处理表格选中后批量操作 async function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { tableSelected.value = params?.selectedIds || []; batchParams.value = { ...params, selectIds: params?.selectedIds }; const tableParams = await getTableParams(true); + batchUpdateParams.value = { + selectIds: tableSelected.value as string[], + selectAll: batchParams.value.selectAll, + excludeIds: batchParams.value?.excludeIds || [], + ...tableParams, + }; switch (event.eventTag) { case 'execute': handleBatchRun(); @@ -560,15 +578,10 @@ handleBatchDisassociateCase(); break; case 'changeExecutor': - batchUpdateExecutorParams.value = { - selectIds: tableSelected.value as string[], - selectAll: batchParams.value.selectAll, - excludeIds: batchParams.value?.excludeIds || [], - ...tableParams, - }; batchUpdateExecutorModalVisible.value = true; break; case 'move': + batchMoveModalVisible.value = true; break; default: break; diff --git a/frontend/src/views/test-plan/testPlan/detail/apiScenario/components/scenarioTable.vue b/frontend/src/views/test-plan/testPlan/detail/apiScenario/components/scenarioTable.vue index d221d05101..ca6fe5642a 100644 --- a/frontend/src/views/test-plan/testPlan/detail/apiScenario/components/scenarioTable.vue +++ b/frontend/src/views/test-plan/testPlan/detail/apiScenario/components/scenarioTable.vue @@ -72,10 +72,19 @@ + + @@ -98,10 +107,12 @@ import ExecuteResult from '@/components/business/ms-case-associate/executeResult.vue'; 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, @@ -292,30 +303,30 @@ } ); - const batchActions = { - baseAction: [ - { - label: 'common.execute', - eventTag: 'execute', - permission: ['PROJECT_TEST_PLAN:READ+EXECUTE'], - }, - { - label: 'testPlan.featureCase.changeExecutor', - eventTag: 'changeExecutor', - permission: ['PROJECT_TEST_PLAN:READ+UPDATE'], - }, - { - label: 'common.move', - eventTag: 'move', - permission: ['PROJECT_TEST_PLAN:READ+UPDATE'], - }, - { - label: 'common.cancelLink', - eventTag: 'disassociate', - permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], - }, - ], - }; + const batchActions = computed(() => { + return { + baseAction: [ + { + label: 'common.execute', + 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'] }] + : []), + { + label: 'common.cancelLink', + eventTag: 'disassociate', + permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], + }, + ], + }; + }); async function getModuleIds() { let moduleIds: string[] = []; @@ -528,15 +539,22 @@ }); } - // 批量修改执行人 + // 批量修改执行人 和 批量移动 + const batchUpdateParams = ref(); const batchUpdateExecutorModalVisible = ref(false); - const batchUpdateExecutorParams = ref(); + const batchMoveModalVisible = ref(false); // 处理表格选中后批量操作 async function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { tableSelected.value = params?.selectedIds || []; batchParams.value = { ...params, selectIds: params?.selectedIds }; const tableParams = await getTableParams(true); + batchUpdateParams.value = { + selectIds: tableSelected.value as string[], + selectAll: batchParams.value.selectAll, + excludeIds: batchParams.value?.excludeIds || [], + ...tableParams, + }; switch (event.eventTag) { case 'execute': handleBatchRun(); @@ -545,15 +563,10 @@ handleBatchDisassociateCase(); break; case 'changeExecutor': - batchUpdateExecutorParams.value = { - selectIds: tableSelected.value as string[], - selectAll: batchParams.value.selectAll, - excludeIds: batchParams.value?.excludeIds || [], - ...tableParams, - }; batchUpdateExecutorModalVisible.value = true; break; case 'move': + batchMoveModalVisible.value = true; break; default: break; diff --git a/frontend/src/views/test-plan/testPlan/locale/zh-CN.ts b/frontend/src/views/test-plan/testPlan/locale/zh-CN.ts index a4442e6e35..68c991a90b 100644 --- a/frontend/src/views/test-plan/testPlan/locale/zh-CN.ts +++ b/frontend/src/views/test-plan/testPlan/locale/zh-CN.ts @@ -106,6 +106,7 @@ export default { 'testPlan.featureCase.richTextDblclickPlaceholder': '双击可快速输入', 'testPlan.featureCase.autoNextTip1': '开启:提交结果后,跳转至下一条用例', 'testPlan.featureCase.autoNextTip2': '关闭:提交结果后,还在当前', + 'testPlan.api.testSetRequired': '测试集不能为空', 'testPlan.executeHistory.executionStartAndEndTime': '执行起止时间', 'testPlan.testPlanGroup.seeArchived': '只看已归档', 'testPlan.testPlanGroup.planNamePlaceholder': '请输入测试计划组名称',