From 6313a666625d92d507fd898370bf4b7eeece5c91 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 30 Mar 2021 18:44:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89):=20=E9=BB=98=E8=AE=A4=E6=A8=A1=E5=9D=97=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=E6=8F=90=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiDefinitionService.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 0e70693f40..7884538fcc 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -264,15 +264,7 @@ public class ApiDefinitionService { test.setEnvironmentId(request.getEnvironmentId()); test.setUserId(request.getUserId()); test.setTags(request.getTags()); - if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) { - ApiModuleExample example = new ApiModuleExample(); - example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("默认模块"); - List modules = apiModuleMapper.selectByExample(example); - if (CollectionUtils.isNotEmpty(modules)) { - test.setModuleId(modules.get(0).getId()); - test.setModulePath(modules.get(0).getName()); - } - } + this.setModule(test); apiDefinitionMapper.updateByPrimaryKeySelective(test); return test; } @@ -591,6 +583,17 @@ public class ApiDefinitionService { return apiTestCaseMapper.selectByPrimaryKey(apiCaseId); } + private void setModule(ApiDefinitionWithBLOBs item) { + if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) { + ApiModuleExample example = new ApiModuleExample(); + example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块"); + List modules = apiModuleMapper.selectByExample(example); + if (CollectionUtils.isNotEmpty(modules)) { + item.setModuleId(modules.get(0).getId()); + item.setModulePath(modules.get(0).getName()); + } + } + } public ApiDefinitionImport apiTestImport(MultipartFile file, ApiTestImportRequest request) { ApiImportParser apiImportParser = ApiDefinitionImportParserFactory.getApiImportParser(request.getPlatform()); @@ -616,15 +619,7 @@ public class ApiDefinitionService { } for (int i = 0; i < data.size(); i++) { ApiDefinitionWithBLOBs item = data.get(i); - if (StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) { - ApiModuleExample example = new ApiModuleExample(); - example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块"); - List modules = apiModuleMapper.selectByExample(example); - if (CollectionUtils.isNotEmpty(modules)) { - item.setModuleId(modules.get(0).getId()); - item.setModulePath(modules.get(0).getName()); - } - } + this.setModule(item); if (item.getName().length() > 255) { item.setName(item.getName().substring(0, 255)); } From 10a24e60a5f149847b58a7eb36aa779f7d652e32 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 30 Mar 2021 19:13:44 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=9B=BA=E5=AE=9A=E5=88=97=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E9=94=99=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/scenario/ApiScenarioList.vue | 12 +++++------- .../components/list/ApiCaseSimpleList.vue | 12 ++++++------ .../api/definition/components/list/ApiList.vue | 16 ++++++---------- .../track/case/components/TestCaseList.vue | 11 +++++------ .../functional/FunctionalTestCaseList.vue | 11 +++++------ 5 files changed, 27 insertions(+), 35 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 5fc080fa6e..efbc66655d 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -441,18 +441,12 @@ export default { } }); - if (this.$refs.scenarioTable) { - setTimeout(() => { - this.$refs.scenarioTable.doLayout(); - this.result.loading = false; - }, 500) - } - if (!this.condition.selectAll) { this.condition.unSelectIds = response.data.listObject.map(s => s.id); } this.$nextTick(function () { + this.$refs.scenarioTable.doLayout(); this.checkTableRowIsSelect(); }) }); @@ -838,4 +832,8 @@ export default { /deep/ .el-card__header { padding: 10px; } + +/deep/ .el-table__fixed-body-wrapper { + top: 60px !important; +} 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 444e701fde..f71771bd1a 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -351,13 +351,9 @@ export default { item.tags = JSON.parse(item.tags); } }) - if (this.$refs.caseTable) { - setTimeout(() => { - this.$refs.caseTable.doLayout(); - this.result.loading = false; - }, 500) - } + this.$nextTick(function(){ + this.$refs.caseTable.doLayout(); this.checkTableRowIsSelect(); }) }); @@ -694,4 +690,8 @@ export default { /deep/ .el-table__fixed { height: 100% !important; } + +/deep/ .el-table__fixed-body-wrapper { + top: 60px !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 970b67ac12..3a03be7ba8 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -454,18 +454,10 @@ item.tags = JSON.parse(item.tags); } }) - if (this.$refs.apiDefinitionTable) { - setTimeout(() => { - this.$refs.apiDefinitionTable.doLayout(); - this.result.loading = false; - }, 500) - } + // nexttick:表格加载完成之后触发。判断是否需要勾选行 this.$nextTick(function(){ - // if (this.$refs.apiDefinitionTable) { - // this.$refs.apiDefinitionTable.doLayout(); - // this.result.loading = false; - // } + this.$refs.apiDefinitionTable.doLayout(); this.checkTableRowIsSelect(); }) }); @@ -838,4 +830,8 @@ top: -2px; } + /deep/ .el-table__fixed-body-wrapper { + top: 60px !important; + } + diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 6d6a77b7e8..141bd7a9b7 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -392,14 +392,9 @@ export default { this.tableData.forEach((item) => { item.tags = JSON.parse(item.tags); }) - if (this.$refs.table) { - setTimeout(() => { - this.$refs.table.doLayout(); - this.result.loading = false; - }, 500) - } this.$nextTick(function(){ + this.$refs.table.doLayout(); this.checkTableRowIsSelect(); }) }); @@ -662,4 +657,8 @@ export default { .el-tag { margin-left: 10px; } + +/deep/ .el-table__fixed-body-wrapper { + top: 60px !important; +} 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 0404e4db21..7a5b16c6aa 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 @@ -472,12 +472,7 @@ export default { } } this.selectRows.clear(); - if (this.$refs.table) { - setTimeout(() => { - this.$refs.table.doLayout(); - this.result.loading = false; - }, 500) - } + this.$refs.table.doLayout(); }); } getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE); @@ -718,4 +713,8 @@ export default { .ms-table-header >>> .table-title { height: 0px; } + +/deep/ .el-table__fixed-body-wrapper { + top: 60px !important; +} From 9257eb55ccb22a23df54e4f6833694d72f9e8d31 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 30 Mar 2021 19:14:50 +0800 Subject: [PATCH 3/7] chore: sync --- frontend/src/business/components/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 07951ba17a..afb50f2246 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd +Subproject commit afb50f22464b832e4f458f3f7947e6d8f982707e From 1a858c619d269b080284e7b47e218df931818dd4 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 30 Mar 2021 19:20:39 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=9B=BA=E5=AE=9A=E5=88=97=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E9=94=99=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/ApiScenarioList.vue | 8 +- .../components/list/ApiCaseSimpleList.vue | 22 +- .../definition/components/list/ApiList.vue | 1162 +++++++++-------- .../track/case/components/TestCaseList.vue | 256 ++-- .../functional/FunctionalTestCaseList.vue | 4 +- 5 files changed, 734 insertions(+), 718 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index efbc66655d..f30bf7315c 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -446,7 +446,9 @@ export default { } this.$nextTick(function () { - this.$refs.scenarioTable.doLayout(); + if (this.$refs.scenarioTable) { + this.$refs.scenarioTable.doLayout(); + } this.checkTableRowIsSelect(); }) }); @@ -726,8 +728,8 @@ export default { // let ids = [row.id]; let param = {}; this.buildBatchParam(param); - if(param.ids && param.ids.length <=0){ - param.ids =[row.id]; + if (param.ids && param.ids.length <= 0) { + param.ids = [row.id]; } this.$post('/api/automation/removeToGcByBatch/', param, () => { // this.$post('/api/automation/removeToGc/', ids, () => { 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 f71771bd1a..7b4c2e1894 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -313,7 +313,7 @@ export default { this.condition.status = "Trash"; this.condition.moduleIds = []; } - if(!this.selectAll){ + if (!this.selectAll) { this.selectAll = false; this.unSelection = []; this.selectDataCounts = 0; @@ -342,7 +342,7 @@ export default { this.total = response.data.itemCount; this.tableData = response.data.listObject; - if(!this.selectAll){ + if (!this.selectAll) { this.unSelection = response.data.listObject.map(s => s.id); } @@ -352,8 +352,10 @@ export default { } }) - this.$nextTick(function(){ - this.$refs.caseTable.doLayout(); + this.$nextTick(function () { + if (this.$refs.caseTable) { + this.$refs.caseTable.doLayout(); + } this.checkTableRowIsSelect(); }) }); @@ -361,20 +363,20 @@ export default { getLabel(this, API_CASE_LIST); }, - checkTableRowIsSelect(){ + checkTableRowIsSelect() { //如果默认全选的话,则选中应该选中的行 - if(this.selectAll){ + if (this.selectAll) { let unSelectIds = this.unSelection; - this.tableData.forEach(row=>{ - if(unSelectIds.indexOf(row.id)<0){ - this.$refs.caseTable.toggleRowSelection(row,true); + this.tableData.forEach(row => { + if (unSelectIds.indexOf(row.id) < 0) { + this.$refs.caseTable.toggleRowSelection(row, true); //默认全选,需要把选中对行添加到selectRows中。不然会影响到勾选函数统计 if (!this.selectRows.has(row)) { this.$set(row, "showMore", true); this.selectRows.add(row); } - }else{ + } else { //不勾选的行,也要判断是否被加入了selectRow中。加入了的话就去除。 if (this.selectRows.has(row)) { this.$set(row, "showMore", false); 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 3a03be7ba8..71c3e4b7b2 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -116,7 +116,8 @@ min-width="120px" :key="index"> @@ -211,101 +212,315 @@ diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 141bd7a9b7..eca9805b0d 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -2,128 +2,128 @@
- - + + + + + + + + + + From bdc01272077c9916fb7e4790d0cfa262d70b75a4 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 30 Mar 2021 22:07:53 +0800 Subject: [PATCH 6/7] chore: sync --- frontend/src/business/components/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index afb50f2246..a37e6bb56f 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit afb50f22464b832e4f458f3f7947e6d8f982707e +Subproject commit a37e6bb56ffaa7ecc4ee128640e9415304ad41b6 From c1f00d825733553a213d2d146a7a4defc0c88d0c Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 31 Mar 2021 08:17:00 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=9B=BA=E5=AE=9A=E5=88=97=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E9=94=99=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/automation/scenario/ApiScenarioList.vue | 2 +- .../api/definition/components/list/ApiCaseSimpleList.vue | 2 +- .../components/api/definition/components/list/ApiList.vue | 2 +- .../business/components/track/case/components/TestCaseList.vue | 2 +- .../plan/view/comonents/functional/FunctionalTestCaseList.vue | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index f30bf7315c..c6c9e7a3f0 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -447,7 +447,7 @@ export default { this.$nextTick(function () { if (this.$refs.scenarioTable) { - this.$refs.scenarioTable.doLayout(); + setTimeout(this.$refs.scenarioTable.doLayout, 200) } this.checkTableRowIsSelect(); }) 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 7b4c2e1894..da43f454f7 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -354,7 +354,7 @@ export default { this.$nextTick(function () { if (this.$refs.caseTable) { - this.$refs.caseTable.doLayout(); + setTimeout(this.$refs.caseTable.doLayout, 200) } this.checkTableRowIsSelect(); }) 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 71c3e4b7b2..c13957ac04 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -463,7 +463,7 @@ export default { // nexttick:表格加载完成之后触发。判断是否需要勾选行 this.$nextTick(function () { if (this.$refs.apiDefinitionTable) { - this.$refs.apiDefinitionTable.doLayout(); + setTimeout(this.$refs.apiDefinitionTable.doLayout, 200) } this.checkTableRowIsSelect(); }) diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index eca9805b0d..0ed5bf3334 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -397,7 +397,7 @@ export default { this.$nextTick(() => { if (this.$refs.table) { - this.$refs.table.doLayout(); + setTimeout(this.$refs.table.doLayout, 200) } this.checkTableRowIsSelect(); }) 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 793b120a56..848e9e12ab 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 @@ -473,7 +473,7 @@ export default { } this.selectRows.clear(); if (this.$refs.table) { - this.$refs.table.doLayout(); + setTimeout(this.$refs.table.doLayout, 200) } }); }