fix(接口自动化): 修改移动问题

This commit is contained in:
fit2-zhao 2021-01-12 17:31:29 +08:00
parent cc1e26fbdc
commit 413241a688
7 changed files with 22 additions and 61 deletions

View File

@ -4,6 +4,7 @@
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
:data="request" :data="request"
:draggable="true"
:color="displayColor.color" :color="displayColor.color"
:background-color="displayColor.backgroundColor" :background-color="displayColor.backgroundColor"
:title="displayTitle"> :title="displayTitle">
@ -12,7 +13,7 @@
<slot name="headerLeft"> <slot name="headerLeft">
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}" <i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
@click="active(request)"/> @click="active(request)"/>
<el-input v-if="isShowInput || !request.name" size="small" v-model="request.name" class="name-input" <el-input draggable v-if="isShowInput || !request.name" size="small" v-model="request.name" class="name-input"
@blur="isShowInput = false" :placeholder="$t('commons.input_name')"/> @blur="isShowInput = false" :placeholder="$t('commons.input_name')"/>
<span v-else> <span v-else>
{{request.name}} {{request.name}}
@ -48,7 +49,7 @@
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/> <ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/>
<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 :currentProtocol="request.protocol" :response="request.requestResult" ref="runResult"/> <ms-request-result-tail draggable :currentProtocol="request.protocol" :response="request.requestResult" ref="runResult"/>
<!-- 保存操作 --> <!-- 保存操作 -->
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced"> <el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">

View File

@ -3,6 +3,7 @@
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
:data="timer" :data="timer"
:draggable="true"
:show-collapse="false" :show-collapse="false"
color="#67C23A" color="#67C23A"
background-color="#F2F9EE" background-color="#F2F9EE"

View File

@ -4,20 +4,21 @@
@remove="remove" @remove="remove"
:data="controller" :data="controller"
:show-collapse="false" :show-collapse="false"
:draggable="true"
color="#E6A23C" color="#E6A23C"
background-color="#FCF6EE" background-color="#FCF6EE"
:title="$t('api_test.automation.if_controller')"> :title="$t('api_test.automation.if_controller')">
<template v-slot:headerLeft> <template v-slot:headerLeft>
<el-input size="small" v-model="controller.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/> <el-input draggable size="small" v-model="controller.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/>
<el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small" <el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small"
@change="change" style="width: 10%;margin-left: 10px"> @change="change" style="width: 10%;margin-left: 10px">
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/> <el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
</el-select> </el-select>
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator" style="width: 20%;margin-left: 20px"/> <el-input draggable size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator" style="width: 20%;margin-left: 20px"/>
</template> </template>
</api-base-component> </api-base-component>

View File

@ -3,6 +3,7 @@
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
:data="jsr223ProcessorData" :data="jsr223ProcessorData"
:draggable="true"
color="#B8741A" color="#B8741A"
background-color="#F9F1EA" background-color="#F9F1EA"
:title="title"> :title="title">

View File

@ -4,6 +4,7 @@
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
:data="controller" :data="controller"
:draggable="true"
color="#015478" color="#015478"
background-color="#E6EEF2" background-color="#E6EEF2"
:title="$t('api_test.automation.loop_controller')"> :title="$t('api_test.automation.loop_controller')">
@ -15,7 +16,7 @@
</template> </template>
<div v-if="controller.loopType==='LOOP_COUNT'"> <div v-if="controller.loopType==='LOOP_COUNT'" draggable>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<span class="ms-span ms-radio">{{$t('loop.loops')}}</span> <span class="ms-span ms-radio">{{$t('loop.loops')}}</span>
@ -34,7 +35,7 @@
</el-row> </el-row>
</div> </div>
<div v-else-if="controller.loopType==='FOREACH'"> <div v-else-if="controller.loopType==='FOREACH'" draggable>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-input :placeholder="$t('api_test.request.condition_variable')" v-model="controller.forEachController.inputVal" size="small"/> <el-input :placeholder="$t('api_test.request.condition_variable')" v-model="controller.forEachController.inputVal" size="small"/>
@ -52,7 +53,7 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div v-else> <div v-else draggable>
<el-input size="small" v-model="controller.whileController.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/> <el-input size="small" v-model="controller.whileController.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/>
<el-select v-model="controller.whileController.operator" :placeholder="$t('commons.please_select')" size="small" <el-select v-model="controller.whileController.operator" :placeholder="$t('commons.please_select')" size="small"

View File

@ -11,7 +11,7 @@
<slot name="headerLeft"> <slot name="headerLeft">
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}" <i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
@click="active(data)"/> @click="active(data)"/>
<el-input v-if="!data.name || isShowInput" size="small" v-model="data.name" class="name-input" <el-input :draggable="draggable" v-if="!data.name || isShowInput" size="small" v-model="data.name" class="name-input"
@blur="isShowInput = false" :placeholder="$t('commons.input_name')"/> @blur="isShowInput = false" :placeholder="$t('commons.input_name')"/>
<span v-else> <span v-else>
{{data.name}} {{data.name}}
@ -29,7 +29,7 @@
</div> </div>
<el-collapse-transition> <el-collapse-transition>
<div v-if="data.active && showCollapse"> <div v-if="data.active && showCollapse" draggable>
<el-divider></el-divider> <el-divider></el-divider>
<slot></slot> <slot></slot>
</div> </div>
@ -46,6 +46,7 @@
} }
}, },
props: { props: {
draggable: Boolean,
data: { data: {
type: Object, type: Object,
default() { default() {

View File

@ -5,52 +5,12 @@
@remove="remove" @remove="remove"
@active="active" @active="active"
:data="assertions" :data="assertions"
:draggable="draggable"
color="#A30014" color="#A30014"
background-color="#F7E6E9" background-color="#F7E6E9"
:title="$t('api_test.definition.request.assertions_rule')"> :title="$t('api_test.definition.request.assertions_rule')">
<el-input :draggable="draggable" size="small" v-model="assertions.name" style="width: 40%;margin-left: 20px" :placeholder="$t('commons.input_name')"/> <div class="assertion-add" :draggable="draggable">
<div style="margin-right: 20px; float: right">
<i class="icon el-icon-arrow-right" :class="{'is-active': assertions.active}" @click="active(assertions)" style="margin-left: 20px"/>
<el-switch v-model="assertions.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
</div>
</div>
<!-- 请求参数-->
<el-collapse-transition>
<div v-if="assertions.active" :draggable="draggable">
<div class="assertion-add">
<el-row :gutter="10">
<el-col :span="4">
<el-select :disabled="isReadOnly" class="assertion-item" v-model="type"
:placeholder="$t('api_test.request.assertions.select_type')"
size="small">
<el-option :label="$t('api_test.request.assertions.regex')" :value="options.REGEX"/>
<el-option :label="'JSONPath'" :value="options.JSON_PATH"/>
<el-option :label="'XPath'" :value="options.XPATH2"/>
<el-option :label="$t('api_test.request.assertions.response_time')" :value="options.DURATION"/>
<el-option :label="$t('api_test.request.assertions.jsr223')" :value="options.JSR223"/>
</el-select>
</el-col>
<el-col :span="20">
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX"
:callback="after"/>
<ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath"
v-if="type === options.JSON_PATH" :callback="after"/>
<ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xpath2" v-if="type === options.XPATH2"
:callback="after"/>
<ms-api-assertion-duration :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration"
v-if="type === options.DURATION" :callback="after"/>
<ms-api-assertion-jsr223 :is-read-only="isReadOnly" :list="assertions.jsr223" v-if="type === options.JSR223"
:callback="after"/>
<el-button v-if="!type" :disabled="true" type="primary" size="small">
{{ $t('api_test.request.assertions.add') }}
</el-button>
</el-col>
</el-row>
</div>
<div class="assertion-add">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="4"> <el-col :span="4">
<el-select :disabled="isReadOnly" class="assertion-item" v-model="type" <el-select :disabled="isReadOnly" class="assertion-item" v-model="type"
@ -108,7 +68,6 @@
export default { export default {
name: "MsApiAssertions", name: "MsApiAssertions",
components: { components: {
ApiBaseComponent, ApiBaseComponent,
MsApiJsonpathSuggest, MsApiJsonpathSuggest,
@ -119,8 +78,11 @@
MsApiAssertionJsonPath, MsApiAssertionJsonPath,
MsApiAssertionsEdit, MsApiAssertionDuration, MsApiAssertionRegex, MsApiAssertionText MsApiAssertionsEdit, MsApiAssertionDuration, MsApiAssertionRegex, MsApiAssertionText
}, },
props: { props: {
draggable: {
type: Boolean,
default: false,
},
assertions: {}, assertions: {},
node: {}, node: {},
request: {}, request: {},
@ -129,16 +91,12 @@
type: String, type: String,
default: "margin-top: 10px" default: "margin-top: 10px"
}, },
scenario: Scenario,
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
},
draggable: {
type: Boolean,
default: false,
} }
}, },
data() { data() {
return { return {
options: ASSERTION_TYPE, options: ASSERTION_TYPE,
@ -148,7 +106,6 @@
reloadData: "", reloadData: "",
} }
}, },
methods: { methods: {
after() { after() {
this.type = ""; this.type = "";
@ -192,7 +149,6 @@
this.assertions.jsonPath = []; this.assertions.jsonPath = [];
} }
} }
} }
</script> </script>
@ -215,5 +171,4 @@
/deep/ .el-card__body { /deep/ .el-card__body {
padding: 15px; padding: 15px;
} }
</style> </style>