From 6857dd764cf9829854130f022342accb035a9002 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Tue, 12 Mar 2024 17:00:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E7=AE=A1=E7=90=86):=20a?= =?UTF-8?q?pi=E5=9B=9E=E6=94=B6=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/api-test/management.ts | 41 ++ .../src/api/requrls/api-test/management.ts | 10 + frontend/src/enums/routeEnum.ts | 1 + frontend/src/locale/zh-CN/index.ts | 1 + frontend/src/models/apiTest/management.ts | 14 + frontend/src/router/routes/modules/apiTest.ts | 20 + .../management/components/moduleTree.vue | 50 +- .../components/recycle/api/apiTable.vue | 487 ++++++++++++++++++ .../management/components/recycle/index.vue | 55 ++ .../src/views/api-test/management/index.vue | 107 +++- .../views/api-test/management/locale/en-US.ts | 9 + .../views/api-test/management/locale/zh-CN.ts | 8 + .../src/views/api-test/management/recycle.vue | 80 +++ 13 files changed, 860 insertions(+), 23 deletions(-) create mode 100644 frontend/src/views/api-test/management/components/recycle/api/apiTable.vue create mode 100644 frontend/src/views/api-test/management/components/recycle/index.vue create mode 100644 frontend/src/views/api-test/management/recycle.vue diff --git a/frontend/src/api/modules/api-test/management.ts b/frontend/src/api/modules/api-test/management.ts index 8d36aadcef..dbcfd9b3c7 100644 --- a/frontend/src/api/modules/api-test/management.ts +++ b/frontend/src/api/modules/api-test/management.ts @@ -3,8 +3,10 @@ import { AddDefinitionScheduleUrl, AddDefinitionUrl, AddModuleUrl, + BatchCleanOutApiUrl, BatchDeleteDefinitionUrl, BatchMoveDefinitionUrl, + BatchRecoverApiUrl, BatchUpdateDefinitionUrl, CheckDefinitionScheduleUrl, DebugDefinitionUrl, @@ -15,15 +17,19 @@ import { DeleteDefinitionUrl, DeleteMockUrl, DeleteModuleUrl, + DeleteRecycleApiUrl, GetDefinitionDetailUrl, GetDefinitionScheduleUrl, GetEnvModuleUrl, GetModuleCountUrl, GetModuleOnlyTreeUrl, GetModuleTreeUrl, + GetTrashModuleCountUrl, + GetTrashModuleTreeUrl, ImportDefinitionUrl, MoveModuleUrl, OperationHistoryUrl, + RecoverDefinitionUrl, RecoverOperationHistoryUrl, SaveOperationHistoryUrl, SortDefinitionUrl, @@ -44,6 +50,7 @@ import { ApiDefinitionBatchMoveParams, ApiDefinitionBatchUpdateParams, ApiDefinitionCreateParams, + ApiDefinitionDeleteParams, ApiDefinitionDetail, ApiDefinitionGetEnvModuleParams, ApiDefinitionGetModuleParams, @@ -52,6 +59,7 @@ import { ApiDefinitionPageParams, ApiDefinitionUpdateModuleParams, ApiDefinitionUpdateParams, + BatchRecoverApiParams, CheckScheduleParams, CreateImportApiDefinitionScheduleParams, DefinitionHistoryItem, @@ -254,3 +262,36 @@ export function updateMockStatusPage(id: string) { export function deleteDefinitionMockMock(data: mockParams) { return MSR.post({ url: DeleteMockUrl, data }); } + +/** + * 回收站 + */ +// 回收站-恢复接口定义 +export function recoverDefinition(data: ApiDefinitionDeleteParams) { + return MSR.post({ url: RecoverDefinitionUrl, data }); +} + +// 回收站-彻底删除接口定义 +export function deleteRecycleApiList(id: string) { + return MSR.get({ url: DeleteRecycleApiUrl, params: id }); +} + +// 回收站-批量恢复接口定义 +export function batchRecoverDefinition(data: BatchRecoverApiParams) { + return MSR.post({ url: BatchRecoverApiUrl, data }); +} + +// 回收站-批量彻底删除接口定义 +export function batchCleanOutDefinition(data: BatchRecoverApiParams) { + return MSR.post({ url: BatchCleanOutApiUrl, data }); +} + +// 回收站-模块树 +export function getTrashModuleTree(data: ApiDefinitionGetModuleParams) { + return MSR.post({ url: GetTrashModuleTreeUrl, data }); +} + +// 获取回收站模块统计数量 +export function getTrashModuleCount(data: ApiDefinitionGetModuleParams) { + return MSR.post({ url: GetTrashModuleCountUrl, data }); +} diff --git a/frontend/src/api/requrls/api-test/management.ts b/frontend/src/api/requrls/api-test/management.ts index 45baf9786f..797f514022 100644 --- a/frontend/src/api/requrls/api-test/management.ts +++ b/frontend/src/api/requrls/api-test/management.ts @@ -46,3 +46,13 @@ export const DeleteMockUrl = '/api/definition/mock/delete'; // 刪除mock * 接口引用关系 */ export const DefinitionReferenceUrl = '/api/definition/get-reference'; // 获取接口引用关系 + +/** + * api回收站 + */ +export const RecoverDefinitionUrl = '/api/definition/recover'; // 回收站-接口定义-恢复 +export const DeleteRecycleApiUrl = '/api/definition/delete/'; // 回收站-接口定义-彻底删除 +export const BatchRecoverApiUrl = '/api/definition/batch-recover'; // 回收站-接口定义-批量恢复 +export const BatchCleanOutApiUrl = '/api/definition/batch/delete'; // 回收站-接口定义-批量彻底删除 +export const GetTrashModuleTreeUrl = '/api/definition/module/trash/tree'; // 回收站查找模块 +export const GetTrashModuleCountUrl = '/api/definition/module/trash/count'; // 获取回收站模块统计数量 diff --git a/frontend/src/enums/routeEnum.ts b/frontend/src/enums/routeEnum.ts index 957efed480..d180517d43 100644 --- a/frontend/src/enums/routeEnum.ts +++ b/frontend/src/enums/routeEnum.ts @@ -2,6 +2,7 @@ export enum ApiTestRouteEnum { API_TEST = 'apiTest', API_TEST_DEBUG_MANAGEMENT = 'apiTestDebug', API_TEST_MANAGEMENT = 'apiTestManagement', + API_TEST_MANAGEMENT_RECYCLE = 'apiTestManagementRecycle', API_TEST_REPORT = 'apiTestReport', } diff --git a/frontend/src/locale/zh-CN/index.ts b/frontend/src/locale/zh-CN/index.ts index ae42863882..01ec413139 100644 --- a/frontend/src/locale/zh-CN/index.ts +++ b/frontend/src/locale/zh-CN/index.ts @@ -27,6 +27,7 @@ export default { 'menu.apiTest.debug': '接口调试', 'menu.apiTest.debug.debug': '调试', 'menu.apiTest.management': '接口管理', + 'menu.apiTest.api': 'API列表', 'menu.apiTest.report': '接口报告', 'menu.uiTest': 'UI测试', 'menu.workstation': '工作台', diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts index acfa34780f..5ea088293a 100644 --- a/frontend/src/models/apiTest/management.ts +++ b/frontend/src/models/apiTest/management.ts @@ -262,3 +262,17 @@ export interface RecoverDefinitionParams { export interface DefinitionReferencePageParams extends TableQueryParams { resourceId: string; } + +// 回收站-恢复接口定义参数 +export interface ApiDefinitionDeleteParams { + id: string; + projectId: string; + protocol: string; + deleteAll?: boolean; +} + +// 回收站-批量恢复接口定义参数 +export interface BatchRecoverApiParams extends ApiDefinitionBatchParams { + projectId: string; + moduleIds?: string[]; +} diff --git a/frontend/src/router/routes/modules/apiTest.ts b/frontend/src/router/routes/modules/apiTest.ts index c39782444d..99ad58a706 100644 --- a/frontend/src/router/routes/modules/apiTest.ts +++ b/frontend/src/router/routes/modules/apiTest.ts @@ -43,6 +43,26 @@ const ApiTest: AppRouteRecordRaw = { isTopMenu: true, }, }, + // 接口定义回收站 + { + path: 'recycle', + name: ApiTestRouteEnum.API_TEST_MANAGEMENT_RECYCLE, + component: () => import('@/views/api-test/management/recycle.vue'), + meta: { + locale: 'common.recycle', + roles: ['FUNCTIONAL_CASE:READ'], + breadcrumbs: [ + { + name: ApiTestRouteEnum.API_TEST_MANAGEMENT, + locale: 'menu.apiTest.api', + }, + { + name: ApiTestRouteEnum.API_TEST_MANAGEMENT_RECYCLE, + locale: 'common.recycle', + }, + ], + }, + }, { path: 'report', name: ApiTestRouteEnum.API_TEST_REPORT, diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue index 6549bee80e..ec6258d5dc 100644 --- a/frontend/src/views/api-test/management/components/moduleTree.vue +++ b/frontend/src/views/api-test/management/components/moduleTree.vue @@ -10,7 +10,7 @@ />
- + {{ t('apiTestManagement.newApi') }}