From e8cb0e6fe280b81fd8b40a940b38b31739fa491f Mon Sep 17 00:00:00 2001 From: teukkk Date: Tue, 12 Mar 2024 20:21:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B-=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/api-test/management.ts | 47 ++ .../src/api/requrls/api-test/management.ts | 9 + frontend/src/enums/tableEnum.ts | 1 + frontend/src/models/apiTest/management.ts | 55 ++ .../management/components/management/case.vue | 0 .../components/management/case/caseTable.vue | 754 ++++++++++++++++++ .../components/management/case/index.vue | 50 ++ .../components/management/index.vue | 5 +- .../views/api-test/management/locale/en-US.ts | 15 + .../views/api-test/management/locale/zh-CN.ts | 14 + 10 files changed, 949 insertions(+), 1 deletion(-) delete mode 100644 frontend/src/views/api-test/management/components/management/case.vue create mode 100644 frontend/src/views/api-test/management/components/management/case/caseTable.vue create mode 100644 frontend/src/views/api-test/management/components/management/case/index.vue diff --git a/frontend/src/api/modules/api-test/management.ts b/frontend/src/api/modules/api-test/management.ts index dbcfd9b3c7..2830cbe44e 100644 --- a/frontend/src/api/modules/api-test/management.ts +++ b/frontend/src/api/modules/api-test/management.ts @@ -4,15 +4,19 @@ import { AddDefinitionUrl, AddModuleUrl, BatchCleanOutApiUrl, + BatchDeleteCaseUrl, BatchDeleteDefinitionUrl, + BatchEditCaseUrl, BatchMoveDefinitionUrl, BatchRecoverApiUrl, BatchUpdateDefinitionUrl, + CasePageUrl, CheckDefinitionScheduleUrl, DebugDefinitionUrl, DefinitionMockPageUrl, DefinitionPageUrl, DefinitionReferenceUrl, + DeleteCaseUrl, DeleteDefinitionScheduleUrl, DeleteDefinitionUrl, DeleteMockUrl, @@ -32,11 +36,14 @@ import { RecoverDefinitionUrl, RecoverOperationHistoryUrl, SaveOperationHistoryUrl, + SortCaseUrl, SortDefinitionUrl, SwitchDefinitionScheduleUrl, ToggleFollowDefinitionUrl, TransferFileModuleOptionUrl, TransferFileUrl, + UpdateCasePriorityUrl, + UpdateCaseStatusUrl, UpdateDefinitionScheduleUrl, UpdateDefinitionUrl, UpdateMockStatusUrl, @@ -46,6 +53,10 @@ import { import { ExecuteRequestParams } from '@/models/apiTest/common'; import { + ApiCaseBatchEditParams, + ApiCaseBatchParams, + ApiCaseDetail, + ApiCasePageParams, ApiDefinitionBatchDeleteParams, ApiDefinitionBatchMoveParams, ApiDefinitionBatchUpdateParams, @@ -295,3 +306,39 @@ export function getTrashModuleTree(data: ApiDefinitionGetModuleParams) { export function getTrashModuleCount(data: ApiDefinitionGetModuleParams) { return MSR.post({ url: GetTrashModuleCountUrl, data }); } + +// --------------------用例 +// 获取接口用例列表 +export function getCasePage(data: ApiCasePageParams) { + return MSR.post>({ url: CasePageUrl, data }); +} + +// 接口用例更新状态 +export function updateCaseStatus(id: string, status: string) { + return MSR.get({ url: `${UpdateCaseStatusUrl}/${id}/${status}` }); +} + +// 接口用例更新等级 +export function updateCasePriority(id: string, priority: string) { + return MSR.get({ url: `${UpdateCasePriorityUrl}/${id}/${priority}` }); +} + +// 删除接口用例 +export function deleteCase(id: string) { + return MSR.get({ url: DeleteCaseUrl, params: id }); +} + +// 批量删除接口用例 +export function batchDeleteCase(data: ApiCaseBatchParams) { + return MSR.post({ url: BatchDeleteCaseUrl, data }); +} + +// 批量编辑接口用例 +export function batchEditCase(data: ApiCaseBatchEditParams) { + return MSR.post({ url: BatchEditCaseUrl, data }); +} + +// 拖拽排序 +export function dragSort(data: DragSortParams) { + return MSR.post({ url: SortCaseUrl, data }); +} diff --git a/frontend/src/api/requrls/api-test/management.ts b/frontend/src/api/requrls/api-test/management.ts index 797f514022..8829515582 100644 --- a/frontend/src/api/requrls/api-test/management.ts +++ b/frontend/src/api/requrls/api-test/management.ts @@ -56,3 +56,12 @@ 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'; // 获取回收站模块统计数量 + +// --------------------用例 +export const CasePageUrl = '/api/case/page'; // 接口用例列表 +export const UpdateCaseStatusUrl = '/api/case/update-status'; // 接口用例更新状态 +export const UpdateCasePriorityUrl = '/api/case/update-priority'; // 接口用例更新等级 +export const DeleteCaseUrl = '/api/case/delete'; // 删除接口用例 +export const BatchDeleteCaseUrl = '/api/case/batch/delete'; // 批量删除接口用例 +export const BatchEditCaseUrl = '/api/case/batch/edit'; // 批量编辑接口用例 +export const SortCaseUrl = '/api/case/edit/pos'; // 接口用例拖拽 diff --git a/frontend/src/enums/tableEnum.ts b/frontend/src/enums/tableEnum.ts index a581d62caf..dd60ebd1e5 100644 --- a/frontend/src/enums/tableEnum.ts +++ b/frontend/src/enums/tableEnum.ts @@ -8,6 +8,7 @@ export enum TableModuleEnum { export enum TableKeyEnum { API_TEST = 'apiTest', + API_TEST_MANAGEMENT_CASE = 'apiTestMenagementCase', API_TEST_DEBUG_FORM_DATA = 'apiTestDebugFormData', API_TEST_DEBUG_FORM_URL_ENCODE = 'apiTestDebugFormUrlEncoded', API_TEST_REPORT = 'apiTestReport', diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts index 5ea088293a..ccc054bb2f 100644 --- a/frontend/src/models/apiTest/management.ts +++ b/frontend/src/models/apiTest/management.ts @@ -276,3 +276,58 @@ export interface BatchRecoverApiParams extends ApiDefinitionBatchParams { projectId: string; moduleIds?: string[]; } + +// --------------------用例 +// 用例列表查询参数 +export interface ApiCasePageParams extends TableQueryParams { + protocol: string; + projectId: string; + versionId?: string; + refId?: string; + moduleIds?: string[]; + apiDefinitionId?: string; +} +// 用例列表 +export interface ApiCaseDetail { + id: string; + name: string; + priority: string; + num: number; + status: string; + lastReportStatus: string; + lastReportId: string; + projectId: string; + apiDefinitionId: string; + environmentId: string; + environmentName: string; + follow: boolean; + method: string; + path: string; + tags: string[]; + passRate: string; + modulePath: string; + moduleId: string; + createTime: number; + createUser: string; + createName: string; + updateTime: number; + updateUser: string; + updateName: string; + deleteTime: number; + deleteUser: string; + deleteName: string; +} +// 批量操作参数 +export interface ApiCaseBatchParams extends BatchApiParams { + protocol: string; + apiDefinitionId?: string[]; + versionId?: string; +} +// 用例批量编辑参数 +export interface ApiCaseBatchEditParams extends ApiCaseBatchParams { + priority?: string; + tags?: string[]; + status?: string; + environmentId?: string; + type: string; +} diff --git a/frontend/src/views/api-test/management/components/management/case.vue b/frontend/src/views/api-test/management/components/management/case.vue deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/views/api-test/management/components/management/case/caseTable.vue b/frontend/src/views/api-test/management/components/management/case/caseTable.vue new file mode 100644 index 0000000000..2cee13a540 --- /dev/null +++ b/frontend/src/views/api-test/management/components/management/case/caseTable.vue @@ -0,0 +1,754 @@ + + + + + diff --git a/frontend/src/views/api-test/management/components/management/case/index.vue b/frontend/src/views/api-test/management/components/management/case/index.vue new file mode 100644 index 0000000000..5629fecaa0 --- /dev/null +++ b/frontend/src/views/api-test/management/components/management/case/index.vue @@ -0,0 +1,50 @@ + + + diff --git a/frontend/src/views/api-test/management/components/management/index.vue b/frontend/src/views/api-test/management/components/management/index.vue index 5307834adc..74e4368d1a 100644 --- a/frontend/src/views/api-test/management/components/management/index.vue +++ b/frontend/src/views/api-test/management/components/management/index.vue @@ -9,7 +9,9 @@ :protocol="protocol" /> - + + +