diff --git a/backend/src/main/java/io/metersphere/track/dto/TestReviewCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestReviewCaseDTO.java index 8440dd3c8b..4820a4a128 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestReviewCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestReviewCaseDTO.java @@ -4,6 +4,8 @@ import io.metersphere.base.domain.TestCaseWithBLOBs; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class TestReviewCaseDTO extends TestCaseWithBLOBs { @@ -16,4 +18,5 @@ public class TestReviewCaseDTO extends TestCaseWithBLOBs { private String issues; private String model; private String projectName; + private List list; } 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 141b314e7f..0e1d859290 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -244,7 +244,7 @@ return { type: API_SCENARIO_LIST, headerItems: Api_Scenario_List, - tableLabel: [], + tableLabel: Api_Scenario_List, loading: false, screenHeight: document.documentElement.clientHeight - 280,//屏幕高度, condition: { @@ -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 4754744b4d..07576e28e7 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -186,7 +186,7 @@ export default { return { type: API_CASE_LIST, headerItems: Api_Case_List, - tableLabel: [], + tableLabel: Api_Case_List, condition: { components: API_CASE_CONFIGS }, @@ -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 6069e06e71..4878c7275e 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -272,7 +272,7 @@ return { type: API_LIST, headerItems: Api_List, - tableLabel: [], + tableLabel: Api_List, condition: { components: API_DEFINITION_CONFIGS }, @@ -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/common/head/HeaderCustom.vue b/frontend/src/business/components/common/head/HeaderCustom.vue index 3becf9b217..d13351763c 100644 --- a/frontend/src/business/components/common/head/HeaderCustom.vue +++ b/frontend/src/business/components/common/head/HeaderCustom.vue @@ -47,18 +47,14 @@ export default { }, open(items) { this.defaultCheckedKeys = [] - this.dialogTableVisible = true - this.fieldSelected = items - if (items.size <= 0) { - this.optionalField = this.optionalFields - } else { - items.forEach(i => { - this.defaultCheckedKeys.push(i.id) - } - ) - } + items.forEach(i => { + this.defaultCheckedKeys.push(i.id) + } + ) console.log(this.defaultCheckedKeys) + console.log(this.optionalFields) + console.log(this.fieldSelected) }, saveHeader() { @@ -83,7 +79,6 @@ export default { }, - // 切换模式 现有树形穿梭框模式transfer 和通讯录模式addressList // changeMode() { // if (this.mode == "transfer") { diff --git a/frontend/src/business/components/track/case/components/TestCaseCreate.vue b/frontend/src/business/components/track/case/components/TestCaseCreate.vue index e132bdfc4e..9f39733f06 100644 --- a/frontend/src/business/components/track/case/components/TestCaseCreate.vue +++ b/frontend/src/business/components/track/case/components/TestCaseCreate.vue @@ -105,13 +105,12 @@ export default { this.testCaseForm.projectId = getCurrentProjectID(); this.testCaseForm.type = ""; this.testCaseForm.priority = "P0"; - this.testCaseForm.method = "manual"; - if(this.currentModule!==undefined){ + if (this.currentModule !== undefined || this.currentModule !== null || this.currentModule !== 0 || this.currentModule !== "") { this.testCaseForm.nodePath = this.currentModule.path; this.testCaseForm.nodeId = this.currentModule.id; - }else{ - this.testCaseForm.nodePath="/全部用例" - this.testCaseForm.nodeId="root" + } else { + this.testCaseForm.nodePath = "/全部用例" + this.testCaseForm.nodeId = "root" } this.result = this.$post(path, this.testCaseForm, response => { this.testCaseForm.id=response.data.id 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 3f40e08997..3c767df70e 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -259,7 +259,7 @@ export default { return { type: TEST_CASE_LIST, headerItems: Track_Test_Case, - tableLabel: [], + tableLabel: Track_Test_Case, result: {}, deletePath: "/test/case/delete", condition: { @@ -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/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index 90aa51084e..cd19db1a97 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -248,7 +248,7 @@ export default { return { type: TEST_PLAN_LIST, headerItems: Test_Plan_List, - tableLabel: [], + tableLabel: Test_Plan_List, result: {}, enableDeleteTip: false, queryPath: "/test/plan/list", diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue index c72d1eab50..370799ede6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -192,7 +192,7 @@ export default { return { type: TEST_PLAN_API_CASE, headerItems: Test_Plan_Api_Case, - tableLabel: [], + tableLabel: Test_Plan_Api_Case, condition: {}, selectCase: {}, result: {}, diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index 556f0ba211..3a7f032486 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -148,7 +148,7 @@ export default { return { type: TEST_PLAN_SCENARIO_CASE, headerItems: Test_Plan_Scenario_Case, - tableLabel: [], + tableLabel: Test_Plan_Scenario_Case, loading: false, condition: {}, currentScenario: {}, 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 d48ea81215..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();*/