fix(接口自动化): 域名根据环境切换问题
This commit is contained in:
parent
10b3c79125
commit
681a02b952
|
@ -205,12 +205,14 @@
|
|||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:env-group-id="envGroupId"
|
||||
:environment-type="environmentType"
|
||||
@remove="remove"
|
||||
@copyRow="copyRow"
|
||||
@suggestClick="suggestClick"
|
||||
@refReload="refReload"
|
||||
@runScenario="runDebug"
|
||||
@stopScenario="stop"
|
||||
@setDomain="setDomain"
|
||||
@openScenario="openScenario"/>
|
||||
</span>
|
||||
</el-tree>
|
||||
|
@ -528,7 +530,7 @@ export default {
|
|||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
setDomain(flag) {
|
||||
setDomain() {
|
||||
if (this.projectEnvMap && this.projectEnvMap.size > 0) {
|
||||
let scenario = {
|
||||
id: this.currentScenario.id,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-model="request.url"
|
||||
style="width: 50%" size="small" @blur="urlChange" :disabled="request.disabled">
|
||||
</el-input>
|
||||
<el-checkbox v-if="isCustomizeReq" class="is-ref-environment" v-model="request.isRefEnvironment">
|
||||
<el-checkbox v-if="isCustomizeReq" class="is-ref-environment" v-model="request.isRefEnvironment" @change="setDomain" :disabled="request.disabled">
|
||||
{{ $t('api_test.request.refer_to_environment') }}
|
||||
</el-checkbox>
|
||||
</div>
|
||||
|
@ -123,6 +123,9 @@ export default {
|
|||
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||
}
|
||||
},
|
||||
setDomain() {
|
||||
this.$emit("setDomain");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<!--请求内容-->
|
||||
<template v-slot:request>
|
||||
<legend style="width: 100%">
|
||||
<customize-req-info :is-customize-req="isCustomizeReq" :request="request"/>
|
||||
<customize-req-info :is-customize-req="isCustomizeReq" :request="request" @setDomain="setDomain"/>
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
<ms-api-request-form
|
||||
v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"
|
||||
|
@ -617,6 +617,9 @@ export default {
|
|||
this.loading = false;
|
||||
this.$emit('refReload', this.request, this.node);
|
||||
},
|
||||
setDomain() {
|
||||
this.$emit("setDomain");
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</template>
|
||||
<template v-slot:scenarioEnable>
|
||||
<el-tooltip content="启用场景环境:当前步骤使用场景原始环境配置运行" placement="top">
|
||||
<el-checkbox v-model="scenario.environmentEnable" @change="checkEnv">启用场景环境</el-checkbox>
|
||||
<el-checkbox v-model="scenario.environmentEnable" @change="checkEnv" :disabled="scenario.disabled">启用场景环境</el-checkbox>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<template v-slot:button>
|
||||
|
@ -66,8 +66,7 @@ import MsTcpBasisParameters from "../../../definition/components/request/tcp/Tcp
|
|||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {getUrl} from "@/business/components/api/automation/scenario/component/urlhelper";
|
||||
import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiScenarioComponent",
|
||||
|
@ -88,7 +87,10 @@ export default {
|
|||
default: false,
|
||||
},
|
||||
currentEnvironmentId: String,
|
||||
projectList: Array
|
||||
projectList: Array,
|
||||
environmentType: String,
|
||||
environmentGroupId: String,
|
||||
envMap: Map
|
||||
},
|
||||
watch: {
|
||||
message() {
|
||||
|
@ -174,30 +176,31 @@ export default {
|
|||
this.$emit('stopScenario');
|
||||
this.reload();
|
||||
},
|
||||
checkEnv() {
|
||||
checkEnv(val) {
|
||||
this.$post("/api/automation/checkScenarioEnv", {scenarioDefinition: JSON.stringify(this.scenario), projectId: this.projectId}, res => {
|
||||
if (this.scenario.environmentEnable && !res.data) {
|
||||
this.scenario.environmentEnable = false;
|
||||
this.$warning("当前场景没有环境,需要先设置自身环境");
|
||||
return;
|
||||
}
|
||||
this.setDomain();
|
||||
this.setDomain(val);
|
||||
});
|
||||
},
|
||||
setDomain() {
|
||||
if (this.scenario.environmentEnable) {
|
||||
let param = {
|
||||
environmentEnable: true,
|
||||
id: this.scenario.id,
|
||||
definition: JSON.stringify(this.scenario)
|
||||
}
|
||||
this.$post("/api/automation/setDomain", param, res => {
|
||||
if (res.data) {
|
||||
let data = JSON.parse(res.data);
|
||||
this.scenario.hashTree = data.hashTree;
|
||||
}
|
||||
})
|
||||
setDomain(val) {
|
||||
let param = {
|
||||
environmentEnable: val,
|
||||
id: this.scenario.id,
|
||||
environmentType: this.environmentType,
|
||||
environmentGroupId: this.environmentGroupId,
|
||||
environmentMap: strMapToObj(this.envMap),
|
||||
definition: JSON.stringify(this.scenario)
|
||||
}
|
||||
this.$post("/api/automation/setDomain", param, res => {
|
||||
if (res.data) {
|
||||
let data = JSON.parse(res.data);
|
||||
this.scenario.hashTree = data.hashTree;
|
||||
}
|
||||
})
|
||||
},
|
||||
getCode() {
|
||||
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
:title="title"
|
||||
:color="titleColor"
|
||||
:response="response"
|
||||
:environmet-type="environmentType"
|
||||
:environment-type="environmentType"
|
||||
:environment-group-id="envGroupId"
|
||||
:background-color="backgroundColor"
|
||||
:project-list="projectList"
|
||||
|
@ -34,7 +34,7 @@
|
|||
@copyRow="copyRow"
|
||||
@refReload="refReload"
|
||||
@openScenario="openScenario"
|
||||
|
||||
@setDomain="setDomain"
|
||||
/>
|
||||
</keep-alive>
|
||||
</div>
|
||||
|
@ -231,6 +231,9 @@ export default {
|
|||
},
|
||||
stopScenario() {
|
||||
this.$emit('stopScenario');
|
||||
},
|
||||
setDomain() {
|
||||
this.$emit("setDomain");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue