fix(接口定义): 修复部分缺陷

This commit is contained in:
fit2-zhao 2020-12-17 16:47:18 +08:00
parent 7a43d3d5fd
commit 9482d72783
4 changed files with 80 additions and 76 deletions

@ -1 +1 @@
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6 Subproject commit 61397c16728a63493507679f7e0940d9099f337f

View File

@ -5,7 +5,7 @@
<span v-if="!debug"><el-input size="mini" style="width: 200px" v-model="report.name"/> </span> <span v-if="!debug"><el-input size="mini" style="width: 200px" v-model="report.name"/> </span>
<span class="time"> {{ report.createTime | timestampFormatDate }}</span> <span class="time"> {{ report.createTime | timestampFormatDate }}</span>
<el-button :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px"> <el-button v-if="!debug" :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px">
{{$t('test_track.plan_view.export_report')}} {{$t('test_track.plan_view.export_report')}}
</el-button> </el-button>

View File

@ -27,7 +27,9 @@
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/> <ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
</template> </template>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
<pre>{{response.console}}</pre>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-collapse-transition> </el-collapse-transition>
</div> </div>

View File

@ -1,100 +1,102 @@
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform"> <template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<el-row> <div>
<el-col :span="21"> <el-row>
<!-- HTTP 请求参数 --> <el-col :span="21">
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100%" v-loading="isReloadData"> <!-- HTTP 请求参数 -->
<el-tabs v-model="activeName" class="request-tabs"> <div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100%" v-loading="isReloadData">
<!-- 请求头--> <el-tabs v-model="activeName" class="request-tabs">
<el-tab-pane :label="$t('api_test.request.headers')" name="headers"> <!-- 请求头-->
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start" slot="label"> <el-tab-pane :label="$t('api_test.request.headers')" name="headers">
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start" slot="label">
<span>{{$t('api_test.request.headers')}} <span>{{$t('api_test.request.headers')}}
<div class="el-step__icon is-text ms-api-col ms-header" v-if="headers.length>1"> <div class="el-step__icon is-text ms-api-col ms-header" v-if="headers.length>1">
<div class="el-step__icon-inner">{{headers.length-1}}</div> <div class="el-step__icon-inner">{{headers.length-1}}</div>
</div> </div>
</span> </span>
</el-tooltip> </el-tooltip>
<ms-api-key-value :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :suggestions="headerSuggestions" :items="headers"/> <ms-api-key-value :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :suggestions="headerSuggestions" :items="headers"/>
</el-tab-pane> </el-tab-pane>
<!--query 参数--> <!--query 参数-->
<el-tab-pane :label="$t('api_test.definition.request.query_param')" name="parameters"> <el-tab-pane :label="$t('api_test.definition.request.query_param')" name="parameters">
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.query_info')" placement="top-start" slot="label"> <el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.query_info')" placement="top-start" slot="label">
<span>{{$t('api_test.definition.request.query_param')}} <span>{{$t('api_test.definition.request.query_param')}}
<div class="el-step__icon is-text ms-api-col ms-header" v-if="request.arguments.length>1"> <div class="el-step__icon is-text ms-api-col ms-header" v-if="request.arguments.length>1">
<div class="el-step__icon-inner">{{request.arguments.length-1}}</div> <div class="el-step__icon-inner">{{request.arguments.length-1}}</div>
</div></span> </div></span>
</el-tooltip> </el-tooltip>
<el-row> <el-row>
<el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link> <el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link>
</el-row> </el-row>
<ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.arguments"/> <ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.arguments"/>
</el-tab-pane> </el-tab-pane>
<!--REST 参数--> <!--REST 参数-->
<el-tab-pane :label="$t('api_test.definition.request.rest_param')" name="rest"> <el-tab-pane :label="$t('api_test.definition.request.rest_param')" name="rest">
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.rest_info')" placement="top-start" slot="label"> <el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.rest_info')" placement="top-start" slot="label">
<span> <span>
{{$t('api_test.definition.request.rest_param')}} {{$t('api_test.definition.request.rest_param')}}
<div class="el-step__icon is-text ms-api-col ms-header" v-if="request.rest.length>1"> <div class="el-step__icon is-text ms-api-col ms-header" v-if="request.rest.length>1">
<div class="el-step__icon-inner">{{request.rest.length-1}}</div> <div class="el-step__icon-inner">{{request.rest.length-1}}</div>
</div> </div>
</span> </span>
</el-tooltip> </el-tooltip>
<el-row> <el-row>
<el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link> <el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link>
</el-row> </el-row>
<ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.rest"/> <ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.rest"/>
</el-tab-pane> </el-tab-pane>
<!--请求体--> <!--请求体-->
<el-tab-pane v-if="isBodyShow" :label="$t('api_test.request.body')" name="body"> <el-tab-pane v-if="isBodyShow" :label="$t('api_test.request.body')" name="body">
<ms-api-body @headersChange="reloadBody" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :headers="headers" :body="request.body"/> <ms-api-body @headersChange="reloadBody" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :headers="headers" :body="request.body"/>
</el-tab-pane> </el-tab-pane>
<!-- 认证配置 --> <!-- 认证配置 -->
<el-tab-pane :label="$t('api_test.definition.request.auth_config')" name="authConfig"> <el-tab-pane :label="$t('api_test.definition.request.auth_config')" name="authConfig">
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.auth_config_info')" placement="top-start" slot="label"> <el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.auth_config_info')" placement="top-start" slot="label">
<span>{{$t('api_test.definition.request.auth_config')}}</span> <span>{{$t('api_test.definition.request.auth_config')}}</span>
</el-tooltip> </el-tooltip>
<ms-api-auth-config :is-read-only="isReadOnly" :request="request"/> <ms-api-auth-config :is-read-only="isReadOnly" :request="request"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="其他设置" name="advancedConfig"> <el-tab-pane label="其他设置" name="advancedConfig">
<ms-api-advanced-config :is-read-only="isReadOnly" :request="request"/> <ms-api-advanced-config :is-read-only="isReadOnly" :request="request"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div>
<div v-if="!referenced">
<div v-for="row in request.hashTree" :key="row.id">
<!-- 前置脚本 -->
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
:jsr223-processor="row"/>
<!--后置脚本-->
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
:jsr223-processor="row"/>
<!--断言规则-->
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
<!--提取规则-->
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
</div> </div>
<div v-if="!referenced">
<div v-for="row in request.hashTree" :key="row.id">
<!-- 前置脚本 -->
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
:jsr223-processor="row"/>
<!--后置脚本-->
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
:jsr223-processor="row"/>
<!--断言规则-->
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
<!--提取规则-->
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
</div>
<batch-add-parameter @batchSave="batchSave" ref="batchAddParameter"/>
</div> </div>
</el-col> </el-col>
<!--操作按钮--> <!--操作按钮-->
<el-col :span="3" class="ms-left-cell" v-if="!referenced"> <el-col :span="3" class="ms-left-cell" v-if="!referenced">
<el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button> <el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
<br/> <br/>
<el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button> <el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
<br/> <br/>
<el-button class="ms-left-buttion" size="small" @click="addAssertions">+{{$t('api_test.definition.request.assertions_rule')}}</el-button> <el-button class="ms-left-buttion" size="small" @click="addAssertions">+{{$t('api_test.definition.request.assertions_rule')}}</el-button>
<br/> <br/>
<el-button class="ms-left-buttion" size="small" @click="addExtract">+{{$t('api_test.definition.request.extract_param')}}</el-button> <el-button class="ms-left-buttion" size="small" @click="addExtract">+{{$t('api_test.definition.request.extract_param')}}</el-button>
</el-col> </el-col>
</el-row> </el-row>
<batch-add-parameter @batchSave="batchSave" ref="batchAddParameter"/>
</div>
</template> </template>
<script> <script>
@ -113,7 +115,6 @@
import BatchAddParameter from "../../basis/BatchAddParameter"; import BatchAddParameter from "../../basis/BatchAddParameter";
import MsApiAdvancedConfig from "./ApiAdvancedConfig"; import MsApiAdvancedConfig from "./ApiAdvancedConfig";
export default { export default {
name: "MsApiHttpRequestForm", name: "MsApiHttpRequestForm",
components: { components: {
@ -170,6 +171,7 @@
headerSuggestions: REQUEST_HEADERS, headerSuggestions: REQUEST_HEADERS,
isReloadData: false, isReloadData: false,
isBodyShow: true, isBodyShow: true,
dialogVisible: false,
} }
}, },
@ -204,7 +206,7 @@
this.reload(); this.reload();
}, },
copyRow(row) { copyRow(row) {
let obj =JSON.parse(JSON.stringify(row)); let obj = JSON.parse(JSON.stringify(row));
obj.id = getUUID(); obj.id = getUUID();
this.request.hashTree.push(obj); this.request.hashTree.push(obj);
this.reload(); this.reload();