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)); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 5fc080fa6e..c6c9e7a3f0 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -441,18 +441,14 @@ 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 () { + if (this.$refs.scenarioTable) { + setTimeout(this.$refs.scenarioTable.doLayout, 200) + } this.checkTableRowIsSelect(); }) }); @@ -732,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, () => { @@ -838,4 +834,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/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 09d3cdf8ce..48fc69aa8d 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -767,7 +767,7 @@ }, runDebug() { /*触发执行操作*/ - let sign = this.$refs.envPopover.checkEnv(); + let sign = this.$refs.envPopover.checkEnv(this.scenarioDefinition); if (!sign) { return; } diff --git a/frontend/src/business/components/api/automation/scenario/EnvPopover.vue b/frontend/src/business/components/api/automation/scenario/EnvPopover.vue index bc7296c026..32580f3be9 100644 --- a/frontend/src/business/components/api/automation/scenario/EnvPopover.vue +++ b/frontend/src/business/components/api/automation/scenario/EnvPopover.vue @@ -44,8 +44,8 @@ export default { setProjectEnvMap(map) { this.$emit("setProjectEnvMap", map); }, - checkEnv() { - return this.$refs.envSelect.checkEnv(); + checkEnv(data) { + return this.$refs.envSelect.checkEnv(data); } } diff --git a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue index 87c62495f0..eb202c6082 100644 --- a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue +++ b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue @@ -29,133 +29,257 @@ 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..da43f454f7 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); } @@ -351,13 +351,11 @@ 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.$nextTick(function () { + if (this.$refs.caseTable) { + setTimeout(this.$refs.caseTable.doLayout, 200) + } this.checkTableRowIsSelect(); }) }); @@ -365,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); @@ -694,4 +692,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..c13957ac04 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 6d6a77b7e8..0ed5bf3334 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 @@
- - + + + + + + + + + +