feat(接口定义): 需求4 可以全局设置环境选项 #1001750 --story=1001750 --user=赵勇 4.接口定义增加全局运... https://www.tapd.cn/55049933/s/1031567

This commit is contained in:
fit2-zhao 2021-08-03 09:51:54 +08:00 committed by fit2-zhao
parent a0013580ca
commit 698ab5db12
2 changed files with 200 additions and 194 deletions

View File

@ -141,6 +141,9 @@ export default {
if (this.createCase) {
this.sysAddition();
}
if (!this.environment && this.$store.state.useEnvironment) {
this.environment = this.$store.state.useEnvironment;
}
},
computed: {
isCaseEdit() {

View File

@ -5,7 +5,7 @@
<el-form :model="api" :rules="rules" ref="apiData" :inline="true" label-position="right">
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
<p class="tip">{{ $t('test_track.plan_view.base_info') }} </p>
<!-- 请求方法 -->
<el-form-item :label="$t('api_report.request')" prop="method">
<el-select v-model="api.request.method" style="width: 100px" size="small">
@ -28,27 +28,27 @@
<el-form-item>
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand('add')"
@command="handleCommand" size="small">
{{$t('commons.test')}}
{{ $t('commons.test') }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="load_case">{{$t('api_test.definition.request.load_case')}}
<el-dropdown-item command="load_case">{{ $t('api_test.definition.request.load_case') }}
</el-dropdown-item>
<el-dropdown-item command="save_as_case">{{$t('api_test.definition.request.save_as_case')}}
<el-dropdown-item command="save_as_case">{{ $t('api_test.definition.request.save_as_case') }}
</el-dropdown-item>
<el-dropdown-item command="update_api">{{$t('api_test.definition.request.update_api')}}</el-dropdown-item>
<el-dropdown-item command="save_as_api">{{$t('api_test.definition.request.save_as')}}</el-dropdown-item>
<el-dropdown-item command="update_api">{{ $t('api_test.definition.request.update_api') }}</el-dropdown-item>
<el-dropdown-item command="save_as_api">{{ $t('api_test.definition.request.save_as') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-form-item>
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<!-- HTTP 请求参数 -->
<ms-api-request-form :isShowEnable="true" :headers="api.request.headers" :request="api.request"/>
</el-form>
<!--返回结果-->
<!-- HTTP 请求返回数据 -->
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<ms-request-result-tail :response="responseData" ref="runResult"/>
<ms-jmx-step :request="api.request" :response="responseData"/>
@ -71,17 +71,17 @@
</template>
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
export default {
export default {
name: "RunTestHTTPPage",
components: {
EnvironmentSelect,
@ -114,13 +114,13 @@
}
},
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
computed:{
'api.environmentId'(){
computed: {
'api.environmentId'() {
return this.$store.state.useEnvironment;
}
},
watch:{
'$store.state.useEnvironment':function (){
watch: {
'$store.state.useEnvironment': function () {
this.api.environmentId = this.$store.state.useEnvironment;
}
},
@ -154,7 +154,7 @@
}
})
},
errorRefresh(){
errorRefresh() {
this.loading = false;
},
runRefresh(data) {
@ -259,17 +259,20 @@
this.api = JSON.parse(JSON.stringify(this.apiData));
this.api.protocol = this.currentProtocol;
this.currentRequest = this.api.request;
if (!this.api.environmentId && this.$store.state.useEnvironment) {
this.api.environmentId = this.$store.state.useEnvironment;
}
//this.getResult();
}
}
}
</script>
<style scoped>
.ms-htt-width {
.ms-htt-width {
width: 350px;
}
}
/deep/ .el-drawer {
/deep/ .el-drawer {
overflow: auto;
}
}
</style>