diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java index 80b82d9f5f..e448c101fb 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java @@ -34,4 +34,7 @@ public class ApiScenarioRequest extends BaseQueryRequest { * 是否需要查询环境字段 */ private boolean selectEnvironment = false; + + //测试计划关联场景过滤掉步骤为0的场景 + private String stepTotal; } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 38db298859..9b84621e66 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -320,6 +320,9 @@ where pc.test_plan_id = #{request.planId} ) + + and api_scenario.step_total is not null and api_scenario.step_total > 0 + diff --git a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue index f9d3465353..7a11a7db83 100644 --- a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue +++ b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue @@ -93,12 +93,21 @@ export default { getURL(urlStr) { try { let url = new URL(urlStr); - url.searchParams.forEach((value, key) => { - if (key && value) { - this.isUrl = true; - this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value})); - } - }); + if (url.search && url.search.length > 1) { + let params = url.search.substr(1).split("&"); + params.forEach(param => { + if (param) { + let keyValues = param.split("="); + if (keyValues) { + this.request.arguments.splice(0, 0, new KeyValue({ + name: keyValues[0], + required: false, + value: keyValues[1] + })); + } + } + }); + } return url; } catch (e) { this.$error(this.$t('api_test.request.url_invalid'), 2000); diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 87aa6b7ceb..d13761e300 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -498,11 +498,21 @@ export default { getURL(urlStr) { try { let url = new URL(urlStr); - url.searchParams.forEach((value, key) => { - if (key) { - this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value})); - } - }); + if (url.search && url.search.length > 1) { + let params = url.search.substr(1).split("&"); + params.forEach(param => { + if (param) { + let keyValues = param.split("="); + if (keyValues) { + this.request.arguments.splice(0, 0, new KeyValue({ + name: keyValues[0], + required: false, + value: keyValues[1] + })); + } + } + }); + } return url; } catch (e) { this.$error(this.$t('api_test.request.url_invalid'), 2000); diff --git a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue index f0d885a702..c058abdb03 100644 --- a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue +++ b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue @@ -272,11 +272,21 @@ export default { getURL(urlStr) { try { let url = new URL(urlStr); - url.searchParams.forEach((value, key) => { - if (key && value) { - this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value})); - } - }); + if (url.search && url.search.length > 1) { + let params = url.search.substr(1).split("&"); + params.forEach(param => { + if (param) { + let keyValues = param.split("="); + if (keyValues) { + this.request.arguments.splice(0, 0, new KeyValue({ + name: keyValues[0], + required: false, + value: keyValues[1] + })); + } + } + }); + } return url; } catch (e) { return urlStr; diff --git a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue index dbdb2fd685..4e24c18050 100644 --- a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue +++ b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue @@ -156,11 +156,21 @@ export default { getURL(urlStr) { try { let url = new URL(urlStr); - url.searchParams.forEach((value, key) => { - if (key && value) { - this.request.parameters.splice(0, 0, new KeyValue({name: key, value: value})); - } - }); + if (url.search && url.search.length > 1) { + let params = url.search.substr(1).split("&"); + params.forEach(param => { + if (param) { + let keyValues = param.split("="); + if (keyValues) { + this.request.arguments.splice(0, 0, new KeyValue({ + name: keyValues[0], + required: false, + value: keyValues[1] + })); + } + } + }); + } return url; } catch (e) { this.$error(this.$t('api_test.request.url_invalid'), 2000); diff --git a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue index c58112c5e0..4b8fdee0e3 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue @@ -209,6 +209,7 @@ export default { if (this.planId != null) { this.condition.planId = this.planId; } + this.condition.stepTotal = "testPlan"; let url = "/test/plan/scenario/case/relevance/list/" + this.currentPage + "/" + this.pageSize; this.result = this.$post(url, this.condition, response => {