fix(接口自动化): 修复引用步骤执行结果内容运行复制

This commit is contained in:
fit2-zhao 2021-03-24 19:27:11 +08:00
parent c3937b1c44
commit 4c3e69cdf1
2 changed files with 59 additions and 44 deletions

View File

@ -37,14 +37,19 @@
</div> </div>
<!--最大化不显示具体内容--> <!--最大化不显示具体内容-->
<div class="header" v-if="!isMax"> <div class="header" v-if="!isMax">
<fieldset :disabled="data.disabled" class="ms-fieldset"> <el-collapse-transition>
<el-collapse-transition> <div v-if="data.active && showCollapse" :draggable="draggable">
<div v-if="data.active && showCollapse" :draggable="draggable"> <el-divider></el-divider>
<el-divider></el-divider> <fieldset :disabled="data.disabled" class="ms-fieldset">
<!--四种协议请求内容-->
<slot name="request"></slot>
<!--其他模版内容比如断言提取等-->
<slot></slot> <slot></slot>
</div> </fieldset>
</el-collapse-transition> <!--四种协议执行结果内容-->
</fieldset> <slot name="result"></slot>
</div>
</el-collapse-transition>
</div> </div>
</el-card> </el-card>

View File

@ -27,48 +27,58 @@
</el-tooltip> </el-tooltip>
</template> </template>
<customize-req-info :is-customize-req="isCustomizeReq" :request="request"/> <!--请求内容-->
<template v-slot:request>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p> <customize-req-info :is-customize-req="isCustomizeReq" :request="request"/>
<ms-api-request-form :isShowEnable="true" :referenced="true" :headers="request.headers " :request="request" <p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"/> <ms-api-request-form v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"
<esb-definition v-xpack :request="request" :showScript="false" v-if="this.showXpackCompnent&&request.esbDataStruct!=null" ref="esbDefinition"/> :isShowEnable="true"
<ms-tcp-basis-parameters :request="request" v-if="(request.protocol==='TCP'|| request.type==='TCPSampler')&&request.esbDataStruct==null " :showScript="false"/> :referenced="true"
:headers="request.headers "
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'" :request="request"/>
:showScript="false"/> <esb-definition v-if="showXpackCompnent&&request.esbDataStruct!=null"
<ms-dubbo-basis-parameters :request="request" v-xpack
v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :request="request"
:showScript="false"
ref="esbDefinition"/>
<ms-tcp-basis-parameters v-if="(request.protocol==='TCP'|| request.type==='TCPSampler')&&request.esbDataStruct==null "
:request="request"
:showScript="false"/> :showScript="false"/>
<ms-sql-basis-parameters v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p> :request="request"
<div v-if="request.result"> :showScript="false"/>
<el-tabs v-model="request.activeName" closable class="ms-tabs"> <ms-dubbo-basis-parameters v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in request.result.scenarios" :key="index"> :request="request"
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px"> :showScript="false"/>
<api-response-component v-if="result.name===request.name" :result="result"/> </template>
</div> <!-- 执行结果内容 -->
</el-tab-pane> <template v-slot:result>
</el-tabs> <p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
</div> <div v-if="request.result">
<div v-else-if="showXpackCompnent&&request.backEsbDataStruct != null"> <el-tabs v-model="request.activeName" closable class="ms-tabs">
<esb-definition-response :currentProtocol="request.protocol" :request="request" :is-api-component="false" <el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in request.result.scenarios" :key="index">
:show-options-button="false" :show-header="true" :result="request.requestResult"/> <div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
</div> <api-response-component v-if="result.name===request.name" :result="result"/>
<div v-else> </div>
<api-response-component :currentProtocol="request.protocol" :result="request.requestResult"/> </el-tab-pane>
</div> </el-tabs>
</div>
<!-- 保存操作 --> <div v-else-if="showXpackCompnent&&request.backEsbDataStruct != null">
<el-button type="primary" size="small" class="ms-btn-flot" @click="saveTestCase(item)" <esb-definition-response :currentProtocol="request.protocol" :request="request" :is-api-component="false"
v-if="!request.referenced"> :show-options-button="false" :show-header="true" :result="request.requestResult"/>
{{ $t('commons.save') }} </div>
</el-button> <div v-else>
<api-response-component :currentProtocol="request.protocol" :result="request.requestResult"/>
</div>
<!-- 保存操作 -->
<el-button type="primary" size="small" class="ms-btn-flot" @click="saveTestCase(item)" v-if="!request.referenced">
{{ $t('commons.save') }}
</el-button>
</template>
</api-base-component> </api-base-component>
<ms-run :debug="true" :reportId="reportId" :run-data="runData" :env-map="envMap" <ms-run :debug="true" :reportId="reportId" :run-data="runData" :env-map="envMap"
@runRefresh="runRefresh" ref="runTest"/> @runRefresh="runRefresh" ref="runTest"/>
</div> </div>
</template> </template>