From ca5478bcf3bdfd920fc2abd884f6480ed9da36f1 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Sat, 23 Mar 2024 17:42:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F=E7=BC=96=E8=BE=91=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E8=BF=BD=E5=8A=A0=E6=A0=87=E7=AD=BE=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037501 --user=王孝刚 【接口测试】接口定义-API列表-批量编辑-属性选标签,没有“追加标签”功能 https://www.tapd.cn/55049933/s/1479560 --- .../definition/ApiCaseBatchEditRequest.java | 2 +- .../scenario/ApiScenarioBatchEditRequest.java | 2 +- .../definition/ApiTestCaseService.java | 2 +- .../service/scenario/ApiScenarioService.java | 2 +- .../ApiScenarioControllerTests.java | 4 +- .../ApiTestCaseControllerTests.java | 4 +- frontend/src/models/apiTest/management.ts | 1 + frontend/src/models/apiTest/scenario.ts | 2 +- .../components/management/api/apiTable.vue | 34 ++++++++++++--- .../components/management/case/caseTable.vue | 34 ++++++++++++--- .../scenario/components/scenarioTable.vue | 41 +++++++++++++++---- 11 files changed, 99 insertions(+), 29 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiCaseBatchEditRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiCaseBatchEditRequest.java index 6078f0cbaf..d18598fd8b 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiCaseBatchEditRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiCaseBatchEditRequest.java @@ -26,7 +26,7 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements @NotBlank private String type; @Schema(description = "默认覆盖原标签") - private boolean appendTag = false; + private boolean append = false; @Schema(description = "环境id") @Size(max = 50, message = "{api_test_case.env_id.length_range}") private String environmentId; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioBatchEditRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioBatchEditRequest.java index f24c0e57e7..6debdcb096 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioBatchEditRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioBatchEditRequest.java @@ -26,7 +26,7 @@ public class ApiScenarioBatchEditRequest extends ApiScenarioBatchRequest impleme @NotBlank private String type; @Schema(description = "默认覆盖原标签") - private boolean appendTag = false; + private boolean append = false; @Schema(description = "环境id") @Size(max = 50, message = "{api_test_case.environment_id.length_range}") private String envId; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java index 132cfd946e..889c5eb5a8 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java @@ -473,7 +473,7 @@ public class ApiTestCaseService extends MoveNodeService { if (CollectionUtils.isEmpty(request.getTags())) { throw new MSException(Translator.get("tags_is_null")); } - if (request.isAppendTag()) { + if (request.isAppend()) { Map caseMap = extApiTestCaseMapper.getTagsByIds(ids, false) .stream() .collect(Collectors.toMap(ApiTestCase::getId, Function.identity())); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java index e02a9f8f1b..81c194a007 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java @@ -330,7 +330,7 @@ public class ApiScenarioService extends MoveNodeService { if (CollectionUtils.isEmpty(request.getTags())) { throw new MSException(Translator.get("tags_is_null")); } - if (request.isAppendTag()) { + if (request.isAppend()) { Map scenarioMap = extApiScenarioMapper.getTagsByIds(ids, false) .stream() .collect(Collectors.toMap(ApiScenario::getId, Function.identity())); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java index bf9d5060d7..41cb3ac6ca 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java @@ -1397,7 +1397,7 @@ public class ApiScenarioControllerTests extends BaseTest { ApiScenarioBatchEditRequest request = new ApiScenarioBatchEditRequest(); request.setProjectId(DEFAULT_PROJECT_ID); request.setType("Tags"); - request.setAppendTag(true); + request.setAppend(true); request.setSelectAll(true); request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4"))); requestPostAndReturn(BATCH_EDIT, request); @@ -1411,7 +1411,7 @@ public class ApiScenarioControllerTests extends BaseTest { }); //覆盖标签 request.setTags(new LinkedHashSet<>(List.of("tag1"))); - request.setAppendTag(false); + request.setAppend(false); requestPostAndReturn(BATCH_EDIT, request); apiScenarioMapper.selectByExample(example).forEach(scenario -> { Assertions.assertEquals(scenario.getTags(), List.of("tag1")); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java index ed5758505d..4c4acbbfe9 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java @@ -895,7 +895,7 @@ public class ApiTestCaseControllerTests extends BaseTest { ApiCaseBatchEditRequest request = new ApiCaseBatchEditRequest(); request.setProjectId(DEFAULT_PROJECT_ID); request.setType("Tags"); - request.setAppendTag(true); + request.setAppend(true); request.setSelectAll(true); request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4"))); requestPostWithOkAndReturn(BATCH_EDIT, request); @@ -909,7 +909,7 @@ public class ApiTestCaseControllerTests extends BaseTest { }); //覆盖标签 request.setTags(new LinkedHashSet<>(List.of("tag1"))); - request.setAppendTag(false); + request.setAppend(false); requestPostWithOkAndReturn(BATCH_EDIT, request); apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> { Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1")); diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts index 7dbc9f4e05..6c44d743f9 100644 --- a/frontend/src/models/apiTest/management.ts +++ b/frontend/src/models/apiTest/management.ts @@ -338,6 +338,7 @@ export interface ApiCaseBatchEditParams extends ApiCaseBatchParams { status?: string; environmentId?: string; type: string; + append?: boolean; } // 添加用例参数 export interface AddApiCaseParams extends ExecuteRequestParams { diff --git a/frontend/src/models/apiTest/scenario.ts b/frontend/src/models/apiTest/scenario.ts index 84bed758d5..3e2ab3d688 100644 --- a/frontend/src/models/apiTest/scenario.ts +++ b/frontend/src/models/apiTest/scenario.ts @@ -124,7 +124,7 @@ export interface ApiScenarioBatchEditParams extends ApiScenarioBatchParams { type?: string; // 修改标签相关 - appendTag?: boolean; + append?: boolean; tags?: string[]; // 修改环境相关 diff --git a/frontend/src/views/api-test/management/components/management/api/apiTable.vue b/frontend/src/views/api-test/management/components/management/api/apiTable.vue index 93ac7fa97b..dddd02d309 100644 --- a/frontend/src/views/api-test/management/components/management/api/apiTable.vue +++ b/frontend/src/views/api-test/management/components/management/api/apiTable.vue @@ -199,12 +199,31 @@ @@ -711,6 +730,7 @@ attr: '', value: '', values: [], + append: false, }); const fullAttrs = [ { @@ -722,7 +742,7 @@ value: 'Status', }, { - name: '标签(待定)', + name: '标签', value: 'Tags', }, { @@ -760,6 +780,7 @@ attr: '', value: '', values: [], + append: false, }; } @@ -781,12 +802,16 @@ type: batchForm.value?.attr, priority: '', status: '', + tags: [], + append: batchForm.value.append, }; if (batchForm.value.attr === 'Priority') { batchEditParam.priority = batchForm.value.value; } else if (batchForm.value.attr === 'Status') { batchEditParam.status = batchForm.value.value; + } else if (batchForm.value.attr === 'Tags') { + batchEditParam.tags = batchForm.value.values; } await batchEditScenario(batchEditParam);