diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index de10539143..e11a7d36d9 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -108,4 +108,6 @@ public interface ExtTestCaseMapper { void checkOriginalStatusByIds(@Param("ids") List ids); List selectIdsByNodeIds(@Param("ids")List nodeIds); + + TestCaseWithBLOBs getTestCaseStep(@Param("id") String id); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index d6fc7e00f2..1bda384ad8 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -527,6 +527,9 @@ + update test_case set original_status=status, diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 837689ca85..7e94e1e408 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -165,6 +165,11 @@ public class TestCaseController { return testCaseService.getTestCase(testCaseId); } + @GetMapping("/get/step/{testCaseId}") + public TestCaseWithBLOBs getTestCaseStep(@PathVariable String testCaseId) { + return testCaseService.getTestCaseStep(testCaseId); + } + @GetMapping("/project/{testCaseId}") public Project getProjectByTestCaseId(@PathVariable String testCaseId) { checkPermissionService.checkTestCaseOwner(testCaseId); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index ed0cb45c04..bdb47dcc84 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1905,4 +1905,8 @@ public class TestCaseService { public List getTestCaseLoadCaseRelateList(LoadCaseRequest request) { return testCaseTestMapper.relevanceLoadList(request); } + + public TestCaseWithBLOBs getTestCaseStep(String testCaseId) { + return extTestCaseMapper.getTestCaseStep(testCaseId); + } } diff --git a/frontend/src/business/components/common/components/table/MsTable.vue b/frontend/src/business/components/common/components/table/MsTable.vue index 8dab90da5f..188a1edfd1 100644 --- a/frontend/src/business/components/common/components/table/MsTable.vue +++ b/frontend/src/business/components/common/components/table/MsTable.vue @@ -337,8 +337,8 @@ export default { handleBatchMove() { this.$refs.testBatchMove.open(this.treeNodes, Array.from(this.selectRows).map(row => row.id), this.moduleOptions); }, - handleRowClick(row) { - this.$emit("handleRowClick", row); + handleRowClick(row, column) { + this.$emit("handleRowClick", row, column); }, handleRefresh() { this.clear(); diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 0745b0dca0..7ed68f8e9c 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -69,6 +69,12 @@ min-width="120" /> + + + + + + @@ -210,10 +218,12 @@ import MsTable from "@/business/components/common/components/table/MsTable"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import BatchMove from "@/business/components/track/case/components/BatchMove"; import {SYSTEM_FIELD_NAME_MAP} from "@/common/js/table-constants"; +import TestCasePreview from "@/business/components/track/case/components/TestCasePreview"; export default { name: "TestCaseList", components: { + TestCasePreview, BatchMove, MsTableColumn, MsTable, @@ -340,7 +350,9 @@ export default { page: getPageInfo(), fields: [], fieldsWidth: getCustomTableWidth('TRACK_TEST_CASE'), - memberMap: new Map() + memberMap: new Map(), + rowCase: {}, + rowCaseResult: {} }; }, props: { @@ -579,10 +591,41 @@ export default { testCaseCreate() { this.$emit('testCaseEdit'); }, - handleEdit(testCase) { - this.$get('test/case/get/' + testCase.id, response => { - let testCase = response.data; - this.$emit('testCaseEdit', testCase); + handleEdit(testCase, column) { + if (column.label !== this.$t('test_track.case.case_desc')) { + this.$get('test/case/get/' + testCase.id, response => { + let testCase = response.data; + this.$emit('testCaseEdit', testCase); + }); + } + + }, + getCase(id) { + this.$refs.testCasePreview.open(); + this.rowCaseResult.loading = true; + if (this.rowCase && this.rowCase.id === id) { + this.$refs.testCasePreview.setData(this.rowCase); + this.rowCaseResult.loading = false; + return; + } else { + this.rowCase = {}; + this.$refs.testCasePreview.setData({}); + } + + this.rowCaseResult = this.$get('test/case/get/step/' + id, response => { + this.rowCase = response.data; + this.rowCase.steps = JSON.parse(this.rowCase.steps); + if (!this.rowCase.steps || this.rowCase.length < 1) { + this.rowCase.steps = [{ + num: 1, + desc: '', + result: '' + }]; + } + if (!this.rowCase.stepModel) { + this.rowCase.stepModel = "STEP"; + } + this.$refs.testCasePreview.setData(this.rowCase); }); }, handleCopy(testCase) { diff --git a/frontend/src/business/components/track/case/components/TestCasePreview.vue b/frontend/src/business/components/track/case/components/TestCasePreview.vue new file mode 100644 index 0000000000..785d6a4434 --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCasePreview.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseStepItem.vue b/frontend/src/business/components/track/case/components/TestCaseStepItem.vue index 92da932aff..fce715a00d 100644 --- a/frontend/src/business/components/track/case/components/TestCaseStepItem.vue +++ b/frontend/src/business/components/track/case/components/TestCaseStepItem.vue @@ -37,7 +37,7 @@ clearable/> - +