From dee6bc7b32f05da5e7f2264f6d79633e92e8c66c Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 27 Mar 2024 18:14:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=AF=BC=E5=85=A5=E5=9C=BA=E6=99=AF&?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/api-test/scenario.ts | 7 + frontend/src/api/requrls/api-test/scenario.ts | 1 + frontend/src/models/apiTest/scenario.ts | 16 +++ .../components/fastExtraction/index.vue | 2 +- .../management/api/preview/detail.vue | 2 + .../components/common/customApiDrawer.vue | 2 +- .../components/common/customCaseDrawer.vue | 99 +++++-------- .../common/importApiDrawer/index.vue | 130 ++++++++++++++---- .../common/importApiDrawer/table.vue | 68 ++++++++- .../step/createAction/useCreateActions.ts | 2 + .../scenario/components/step/index.vue | 28 ++-- .../scenario/components/step/stepTree.vue | 28 +++- .../src/views/api-test/scenario/index.vue | 15 +- 13 files changed, 291 insertions(+), 109 deletions(-) diff --git a/frontend/src/api/modules/api-test/scenario.ts b/frontend/src/api/modules/api-test/scenario.ts index 97aced669b..6178561558 100644 --- a/frontend/src/api/modules/api-test/scenario.ts +++ b/frontend/src/api/modules/api-test/scenario.ts @@ -18,6 +18,7 @@ import { GetModuleTreeUrl, GetScenarioStepUrl, GetScenarioUrl, + GetSystemRequestUrl, GetTrashModuleCountUrl, GetTrashModuleTreeUrl, MoveModuleUrl, @@ -45,6 +46,7 @@ import { ApiScenarioUpdateDTO, ExecuteHistoryItem, ExecutePageParams, + GetSystemRequestParams, Scenario, ScenarioDetail, ScenarioHistoryItem, @@ -231,3 +233,8 @@ export function debugScenario(data: ApiScenarioDebugRequest) { export function executeScenario(data: ApiScenarioDebugRequest) { return MSR.post({ url: ExecuteScenarioUrl, data }); } + +// 获取导入的系统请求数据 +export function getSystemRequest(data: GetSystemRequestParams) { + return MSR.post({ url: GetSystemRequestUrl, data }); +} diff --git a/frontend/src/api/requrls/api-test/scenario.ts b/frontend/src/api/requrls/api-test/scenario.ts index 820a284b17..3e7fb80930 100644 --- a/frontend/src/api/requrls/api-test/scenario.ts +++ b/frontend/src/api/requrls/api-test/scenario.ts @@ -15,6 +15,7 @@ export const ScenarioTransferFileUrl = '/api/scenario/transfer'; // 接口场景 export const ScenarioTransferModuleOptionsUrl = '/api/scenario/transfer/options'; // 接口场景临时文件转存目录 export const DebugScenarioUrl = '/api/scenario/debug'; // 接口场景调试(不保存报告) export const ExecuteScenarioUrl = '/api/scenario/run'; // 接口场景执行(保存报告) +export const GetSystemRequestUrl = '/api/scenario/get/system-request'; // 获取导入的系统请求数据 export const BatchRecycleScenarioUrl = '/api/scenario/batch-operation/delete-gc'; // 批量删除接口场景 export const BatchMoveScenarioUrl = '/api/scenario/batch-operation/move'; // 批量移动接口场景 export const BatchCopyScenarioUrl = '/api/scenario/batch-operation/copy'; // 批量复制接口场景 diff --git a/frontend/src/models/apiTest/scenario.ts b/frontend/src/models/apiTest/scenario.ts index f863016ea7..7b55f00cb7 100644 --- a/frontend/src/models/apiTest/scenario.ts +++ b/frontend/src/models/apiTest/scenario.ts @@ -407,3 +407,19 @@ export interface ApiScenarioUpdateDTO extends Partial { deleteFileIds?: string[]; unLinkFileIds?: string[]; } + +export interface GetSystemRequestTypeParams { + moduleIds?: (string | number)[]; + selectedIds: (string | number)[]; + unselectedIds: (string | number)[]; + projectId: string; + protocol?: string; + versionId?: string; +} + +export interface GetSystemRequestParams { + apiRequest?: GetSystemRequestTypeParams; + caseRequest?: GetSystemRequestTypeParams; + scenarioRequest?: GetSystemRequestTypeParams; + refType: ScenarioStepRefType.COPY | ScenarioStepRefType.REF; +} diff --git a/frontend/src/views/api-test/components/fastExtraction/index.vue b/frontend/src/views/api-test/components/fastExtraction/index.vue index 6e44c7578d..9d2bd1f81e 100644 --- a/frontend/src/views/api-test/components/fastExtraction/index.vue +++ b/frontend/src/views/api-test/components/fastExtraction/index.vue @@ -235,7 +235,7 @@ if (matchesIterator) { const matches = Array.from(matchesIterator); try { - if (expressionForm.value.expressionMatchingRule === 'EXPRESSION') { + if (expressionForm.value.expressionMatchingRule === RequestExtractExpressionRuleType.EXPRESSION) { // 匹配表达式,取第一个匹配结果,是完整匹配结果 matchResult.value = matches.map((e) => e[0]) || []; } else { diff --git a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue index 84a4db2028..73d056c48d 100644 --- a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue +++ b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue @@ -380,6 +380,8 @@ title: 'apiTestManagement.paramName', dataIndex: 'key', inputType: 'text', + width: 250, + showTooltip: true, }, { title: 'apiTestManagement.paramVal', diff --git a/frontend/src/views/api-test/scenario/components/common/customApiDrawer.vue b/frontend/src/views/api-test/scenario/components/common/customApiDrawer.vue index 0113b8e397..6a8a0f4395 100644 --- a/frontend/src/views/api-test/scenario/components/common/customApiDrawer.vue +++ b/frontend/src/views/api-test/scenario/components/common/customApiDrawer.vue @@ -362,7 +362,7 @@ export type RequestParam = ExecuteApiRequestFullParams & { response?: RequestTaskResult; - customizeRequestEnvEnable: boolean; + customizeRequestEnvEnable?: boolean; } & RequestCustomAttr; const props = defineProps<{ diff --git a/frontend/src/views/api-test/scenario/components/common/customCaseDrawer.vue b/frontend/src/views/api-test/scenario/components/common/customCaseDrawer.vue index 43c9c81530..71b8705fc4 100644 --- a/frontend/src/views/api-test/scenario/components/common/customCaseDrawer.vue +++ b/frontend/src/views/api-test/scenario/components/common/customCaseDrawer.vue @@ -1,8 +1,6 @@