From 56b58ce9cdccdc1cf589ca374881d9ce7622d920 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Tue, 23 Mar 2021 10:23:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A1=A8=E6=A0=BC=E9=94=99=E4=BD=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=80=90=E6=9D=A1?= =?UTF-8?q?=E8=AF=84=E5=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TestReviewTestCaseService.java | 54 ++++++++++++++++--- .../automation/scenario/ApiScenarioList.vue | 3 ++ .../components/list/ApiCaseSimpleList.vue | 41 ++++++++------ .../definition/components/list/ApiList.vue | 4 ++ .../track/case/components/TestCaseEdit.vue | 32 +++++------ .../track/case/components/TestCaseFile.vue | 1 + .../track/case/components/TestCaseList.vue | 4 ++ .../functional/FunctionalTestCaseList.vue | 4 ++ .../components/TestReviewTestCaseEdit.vue | 40 ++++++++++++-- 9 files changed, 143 insertions(+), 40 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java index e77d06373d..ca4cdc75cd 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java @@ -1,16 +1,16 @@ package io.metersphere.track.service; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.TestCaseMapper; -import io.metersphere.base.mapper.TestCaseReviewMapper; -import io.metersphere.base.mapper.TestCaseReviewTestCaseMapper; -import io.metersphere.base.mapper.TestCaseReviewUsersMapper; +import io.metersphere.base.mapper.*; +import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.service.UserService; +import io.metersphere.track.dto.TestCaseTestDTO; +import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest; import io.metersphere.track.request.testreview.DeleteRelevanceRequest; @@ -29,7 +29,14 @@ import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) public class TestReviewTestCaseService { - + @Resource + private TestCaseTestMapper testCaseTestMapper; + @Resource + private LoadTestMapper loadTestMapper; + @Resource + private ApiTestCaseMapper apiTestCaseMapper; + @Resource + private ApiScenarioMapper apiScenarioMapper; @Resource ExtTestReviewCaseMapper extTestReviewCaseMapper; @Resource @@ -44,6 +51,8 @@ public class TestReviewTestCaseService { TestCaseReviewService testCaseReviewService; @Resource TestCaseMapper testCaseMapper; + @Resource + ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; public List list(QueryCaseReviewRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); @@ -128,7 +137,40 @@ public class TestReviewTestCaseService { } public TestReviewCaseDTO get(String reviewId) { - return extTestReviewCaseMapper.get(reviewId); + TestReviewCaseDTO testReviewCaseDTO=extTestReviewCaseMapper.get(reviewId); + List testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testReviewCaseDTO.getCaseId()); + testCaseTestDTOS.forEach(dto -> { + setTestName(dto); + }); + testReviewCaseDTO.setList(testCaseTestDTOS); + return testReviewCaseDTO; + } + + private void setTestName(TestCaseTestDTO dto) { + String type = dto.getTestType(); + String id = dto.getTestId(); + switch (type) { + case "performance": + LoadTest loadTest = loadTestMapper.selectByPrimaryKey(id); + if (loadTest != null) { + dto.setTestName(loadTest.getName()); + } + break; + case "testcase": + ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(id); + if (apiTestCaseWithBLOBs != null) { + dto.setTestName(apiTestCaseWithBLOBs.getName()); + } + break; + case "automation": + ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id); + if (apiScenarioWithBLOBs != null) { + dto.setTestName(apiScenarioWithBLOBs.getName()); + } + break; + default: + break; + } } public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) { diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index e05f4fa481..0e1d859290 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -419,6 +419,9 @@ }); this.loading = false; this.unSelection = data.listObject.map(s => s.id); + if (this.$refs.scenarioTable) { + this.$refs.scenarioTable.doLayout() + } }); } getLabel(this, API_SCENARIO_LIST); diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 9493dc16be..07576e28e7 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -260,6 +260,10 @@ export default { }, created: function () { this.initTable(); + + this.$nextTick(() => { + this.$refs.caseTable.bodyWrapper.scrollTop = 5 + }) }, watch: { selectNodeIds() { @@ -277,24 +281,24 @@ export default { this.initTable(); } }, - computed: { + computed: { - // 接口定义用例列表 - isApiModel() { - return this.model === 'api' - }, + // 接口定义用例列表 + isApiModel() { + return this.model === 'api' }, - methods: { - customHeader() { - getLabel(this, API_CASE_LIST); - this.$refs.headerCustom.open(this.tableLabel) - }, - initTable() { + }, + methods: { + customHeader() { + getLabel(this, API_CASE_LIST); + this.$refs.headerCustom.open(this.tableLabel) + }, + initTable() { - this.selectRows = new Set(); - this.condition.status = ""; - this.condition.moduleIds = this.selectNodeIds; - if (this.trashEnable) { + this.selectRows = new Set(); + this.condition.status = ""; + this.condition.moduleIds = this.selectNodeIds; + if (this.trashEnable) { this.condition.status = "Trash"; this.condition.moduleIds = []; } @@ -331,9 +335,13 @@ export default { item.tags = JSON.parse(item.tags); } }) + if (this.$refs.caseTable) { + this.$refs.caseTable.doLayout() + } }); } getLabel(this, API_CASE_LIST); + }, open() { this.$refs.searchBar.open(); @@ -636,4 +644,7 @@ export default { top: -2px; } + /deep/ .el-table__fixed { + height: 100% !important; + } diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 11efdfd8ee..4878c7275e 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -442,6 +442,10 @@ item.tags = JSON.parse(item.tags); } }) + if (this.$refs.apiDefinitionTable) { + this.$refs.apiDefinitionTable.doLayout() + } + }); } getLabel(this, API_LIST); diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index f038217d89..0abba4cb81 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -97,17 +97,12 @@ - - - - - - - + @@ -125,8 +120,9 @@ - - + + @@ -340,7 +336,6 @@ export default { } if (this.projectId && this.form.type != '' && this.form.type != 'undefined') { this.$get(url, response => { - response.data.unshift({id: 'other', name: this.$t('test_track.case.other')}) const nodes = response.data .map(item => ({ value: item.id, @@ -581,8 +576,10 @@ export default { } Object.assign(this.form, tmp); this.form.module = testCase.nodeId; - this.form.testId=testCase.selected - console.log(this.form.testId) + /* + this.form.testId=testCase.selected + */ + console.log(this.form.selected) this.getFileMetaData(testCase); }, setTestCaseExtInfo(testCase) { @@ -778,7 +775,6 @@ export default { }); }, getTestOptions(val) { - console.log(val) this.projectId = getCurrentProjectID() this.testOptions = []; let url = ''; @@ -998,6 +994,10 @@ export default { width: 100%; } +.ms-case { + width: 100%; +} + /deep/ .el-button-group > .el-button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; diff --git a/frontend/src/business/components/track/case/components/TestCaseFile.vue b/frontend/src/business/components/track/case/components/TestCaseFile.vue index 9992518869..51fcab9bc8 100644 --- a/frontend/src/business/components/track/case/components/TestCaseFile.vue +++ b/frontend/src/business/components/track/case/components/TestCaseFile.vue @@ -29,6 +29,7 @@ export default { }, methods: { open(file) { + console.log(file) this.file = file; this.dialogVisible = true; }, diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 71af994e97..3c767df70e 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -443,6 +443,10 @@ export default { item.tags = JSON.parse(item.tags); } }) + if (this.$refs.table) { + this.$refs.table.doLayout() + } + }); } }, diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue index 4c2d7416e2..8b86c9210f 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -33,6 +33,7 @@ :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/> - {{ $t('test_track.plan_view.relevance_test_case') }}: - {{ testCase.prerequisite }} + 关联测试: + + {{ + item.testName + }} + @@ -241,7 +245,7 @@ import PerformanceTestDetail from "../../../plan/view/comonents/test/Performance import ApiTestResult from "../../../plan/view/comonents/test/ApiTestResult"; import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail"; import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton"; -import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; +import {getCurrentProjectID, getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import ReviewComment from "../../commom/ReviewComment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem"; @@ -295,6 +299,35 @@ export default { } }, methods: { + openTest(item) { + const type = item.testType; + const id = item.testId; + switch (type) { + case "performance": { + let performanceData = this.$router.resolve({ + path: '/performance/test/edit/' + id, + }) + window.open(performanceData.href, '_blank'); + break; + } + case "testcase": { + let caseData = this.$router.resolve({ + name: 'ApiDefinition', + params: {redirectID: getUUID(), dataType: "apiTestCase", dataSelectRange: 'single:' + id} + }); + window.open(caseData.href, '_blank'); + break; + } + case "automation": { + let automationData = this.$router.resolve({ + name: 'ApiAutomation', + params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + id} + }); + window.open(automationData.href, '_blank'); + break; + } + } + }, handleClose() { removeGoBackListener(this.handleClose); this.showDialog = false; @@ -354,6 +387,7 @@ export default { item.steptResults.push(item.steps[i]); } this.testCase = item; + console.log(this.testCase) this.getRelatedTest(); this.getComments(item); /* this.initTest();*/