From 5842bde643940ee84c3dbc1ba15e4382e829e350 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 1 Dec 2021 19:26:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E6=AC=A1=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 功能用例增加最后一次执行结果的字段 --- .../base/mapper/ext/ExtTestCaseMapper.java | 2 + .../base/mapper/ext/ExtTestCaseMapper.xml | 4 + .../io/metersphere/track/dto/TestCaseDTO.java | 1 + .../track/service/TestCaseService.java | 6 ++ .../track/case/components/TestCaseList.vue | 99 +++++++++++-------- 5 files changed, 71 insertions(+), 41 deletions(-) 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 482547f17e..749db029bb 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 @@ -125,4 +125,6 @@ public interface ExtTestCaseMapper { List getTestCaseForGraph(@Param("ids") Set ids); int countByIds(@Param("ids") List ids); + + String getLastExecStatusById(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 70d6bbee88..cebcf428b6 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 @@ -621,4 +621,8 @@ + + diff --git a/backend/src/main/java/io/metersphere/track/dto/TestCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestCaseDTO.java index d79e9f75a5..6bb4ed8a8a 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestCaseDTO.java @@ -18,6 +18,7 @@ public class TestCaseDTO extends TestCaseWithBLOBs { private String lastResultId; private String projectName; private String createName; + private String lastExecuteResult; private List caseTags = new ArrayList<>(); private List issueList = new ArrayList<>(); 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 d862908bf1..155ed5905d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -397,6 +397,12 @@ public class TestCaseService { private List parseStatus(List returnList) { TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal(); for (TestCaseDTO data : returnList) { + String lastStatus = extTestCaseMapper.getLastExecStatusById(data.getId()); + if(StringUtils.isNotEmpty(lastStatus)){ + data.setLastExecuteResult(lastStatus); + }else { + data.setLastExecuteResult(null); + } String dataStatus = excelData.parseStatus(data.getStatus()); if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Trash")) { diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index b4929286ce..168bb033dc 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -46,15 +46,28 @@ :label="$t('commons.delete_user')" min-width="120"/> + + + + + v-if="!customNum" + :field="item" + :fields-width="fieldsWidth" + prop="num" + sortable + :label="$t('commons.id')" + min-width="80"/> @@ -86,7 +99,7 @@ :label="$t('commons.create_user')" min-width="120"> @@ -117,20 +130,22 @@ + prop="nodePath" + :field="item" + :fields-width="fieldsWidth" + :label="$t('test_track.case.module')" + min-width="150px"> + + + prop="updateTime" + sortable + :field="item" + :fields-width="fieldsWidth" + :label="$t('commons.update_time')" + min-width="150px"> @@ -144,7 +159,7 @@ - + @@ -230,6 +246,7 @@ import {SYSTEM_FIELD_NAME_MAP} from "@/common/js/table-constants"; import TestCasePreview from "@/business/components/track/case/components/TestCasePreview"; import {editTestCaseOrder} from "@/network/testCase"; import {getGraphByCondition} from "@/network/graph"; + const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {}; @@ -259,7 +276,7 @@ export default { StatusTableItem, TestCaseDetail, ReviewStatus, - MsTag,ApiStatus, + MsTag, ApiStatus, "relationshipGraphDrawer": relationshipGraphDrawer.default, }, data() { @@ -301,7 +318,7 @@ export default { {text: '进行中', value: 'Underway'}, {text: '已完成', value: 'Completed'}, ], - batchButtons:[], + batchButtons: [], simpleButtons: [ { name: this.$t('test_track.case.batch_edit_case'), @@ -413,14 +430,14 @@ export default { this.initTableData(); let redirectParam = this.$route.query.dataSelectRange; this.checkRedirectEditPage(redirectParam); - if(this.trashEnable){ + if (this.trashEnable) { this.operators = this.trashOperators; this.batchButtons = this.trashButtons; - }else { + } else { this.operators = this.simpleOperators; this.batchButtons = this.simpleButtons; } - if(!this.projectName || this.projectName === ""){ + if (!this.projectName || this.projectName === "") { this.getProjectName(); } @@ -445,7 +462,7 @@ export default { watch: { selectNodeIds() { this.page.currentPage = 1; - if(!this.trashEnable){ + if (!this.trashEnable) { this.condition.filters.status = []; } initCondition(this.condition, false); @@ -516,7 +533,7 @@ export default { } else if (field.name === '用例状态') { return this.statusFilters; } - return null; + return null; }, checkRedirectEditPage(redirectParam) { if (redirectParam != null) { @@ -527,10 +544,10 @@ export default { }); } }, - getProjectName (){ + getProjectName() { this.$get('project/get/' + this.projectId, response => { let project = response.data; - if(project){ + if (project) { this.projectName = project.name; } }); @@ -557,7 +574,7 @@ export default { // param.planId = this.planId; this.condition.planId = this.planId; } - if(!this.trashEnable){ + if (!this.trashEnable) { if (this.selectNodeIds && this.selectNodeIds.length > 0) { // param.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds; @@ -596,7 +613,7 @@ export default { } this.condition.filters.priority = this.condition.filters['用例等级']; this.condition.filters.status = this.condition.filters['用例状态']; - if(this.trashEnable){ + if (this.trashEnable) { this.condition.filters = {status: ["Trash"]}; } if (this.projectId) { @@ -686,7 +703,7 @@ export default { } }); }, - reduction(testCase){ + reduction(testCase) { let param = {}; param.ids = [testCase.id]; param.projectId = getCurrentProjectID(); @@ -706,7 +723,7 @@ export default { } }); }, - batchReduction(){ + batchReduction() { let param = buildBatchParam(this, this.$refs.table.selectIds); this.$post('/test/case/reduction', param, () => { this.$emit('refreshTable'); @@ -730,7 +747,7 @@ export default { }); }, generateGraph() { - getGraphByCondition('TEST_CASE', buildBatchParam(this, this.$refs.table.selectIds),(data) => { + getGraphByCondition('TEST_CASE', buildBatchParam(this, this.$refs.table.selectIds), (data) => { this.graphData = data; this.$refs.relationshipGraph.open(); }); @@ -792,7 +809,7 @@ export default { let config = {}; let fileNameSuffix = ""; - if(exportType === 'xmind'){ + if (exportType === 'xmind') { config = { url: '/test/case/export/testcase/xmind', method: 'post', @@ -800,7 +817,7 @@ export default { data: buildBatchParam(this, this.$refs.table.selectIds) }; fileNameSuffix = ".xmind"; - }else { + } else { config = { url: '/test/case/export/testcase', method: 'post', @@ -816,7 +833,7 @@ export default { } this.page.result = this.$request(config).then(response => { - const filename = "Metersphere_case_" + this.projectName+ fileNameSuffix; + const filename = "Metersphere_case_" + this.projectName + fileNameSuffix; const blob = new Blob([response.data]); if ("download" in document.createElement("a")) { let aTag = document.createElement('a');