fix(接口自动化): 修复部分缺陷

This commit is contained in:
fit2-zhao 2021-01-22 18:12:05 +08:00
parent 8f45254225
commit 4e38c73ac5
8 changed files with 203 additions and 135 deletions

View File

@ -169,7 +169,7 @@
</include> </include>
</if> </if>
<if test="${condition}.creator != null"> <if test="${condition}.creator != null">
and t1.user_id and t1.create_user_id
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.creator"/> <property name="object" value="${condition}.creator"/>
</include> </include>

View File

@ -42,7 +42,7 @@
"vue-papa-parse": "^2.0.0", "vue-papa-parse": "^2.0.0",
"vue-pdf": "^4.2.0", "vue-pdf": "^4.2.0",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.24.3",
"vuex": "^3.1.2", "vuex": "^3.1.2",
"xml-js": "^1.6.11", "xml-js": "^1.6.11",
"yan-progress": "^1.0.3" "yan-progress": "^1.0.3"

View File

@ -1028,4 +1028,16 @@
right: 50px; right: 50px;
z-index: 1; z-index: 1;
} }
/deep/ .el-tree-node__expand-icon.expanded {
color: #7C3985;
}
/deep/ .el-icon-caret-right {
color: #7C3985;
}
/deep/ .is-leaf {
color: transparent;
}
</style> </style>

View File

@ -4,7 +4,9 @@
:class="[size ? 'el-input-tag--' + size : '']" :class="[size ? 'el-input-tag--' + size : '']"
style="height: auto" style="height: auto"
@click="foucusTagInput"> @click="foucusTagInput">
<el-tag <el-tag
class="ms-top"
v-for="(tag, idx) in innerTags" v-for="(tag, idx) in innerTags"
v-bind="$attrs" v-bind="$attrs"
type="info" type="info"
@ -13,7 +15,7 @@
:closable="!readOnly" :closable="!readOnly"
:disable-transitions="false" :disable-transitions="false"
@close="remove(idx)"> @close="remove(idx)">
{{tag}} {{tag && tag.length>10? tag.substring(0,10)+"...":tag}}
</el-tag> </el-tag>
<input <input
v-if="!readOnly" v-if="!readOnly"
@ -167,4 +169,5 @@
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.scenario_ref')" :visible.sync="visible" <el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.scenario_ref')" :visible.sync="visible"
width="45%" :destroy-on-close="true"> width="45%" :destroy-on-close="true" append-to-body>
<span>{{ $t('api_test.automation.scenario_ref') }}</span> <span>{{ $t('api_test.automation.scenario_ref') }}</span>
<div class="refs" v-loading="scenarioLoading"> <div class="refs" v-loading="scenarioLoading">
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">{{ item.name }}</div> <div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">{{ item.name }}</div>
@ -23,7 +23,7 @@
<script> <script>
export default { export default {
name: "MsReferenceView", name: "MsReferenceView",
components: {}, components: {},
data() { data() {
@ -49,15 +49,15 @@ export default {
this.visible = true this.visible = true
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.refs { .refs {
min-height: 50px; min-height: 50px;
max-height: 200px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
font-size: 12px; font-size: 12px;
padding-bottom: 10px; padding-bottom: 10px;
} }
</style> </style>

View File

@ -1,4 +1,5 @@
<template> <template>
<div>
<el-dropdown @command="handleCommand" class="scenario-ext-btn"> <el-dropdown @command="handleCommand" class="scenario-ext-btn">
<el-link type="primary" :underline="false"> <el-link type="primary" :underline="false">
<el-icon class="el-icon-more"></el-icon> <el-icon class="el-icon-more"></el-icon>
@ -8,9 +9,11 @@
<el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item> <el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item>
<el-dropdown-item command="create_performance" v-tester>{{ $t('api_test.create_performance_test') }}</el-dropdown-item> <el-dropdown-item command="create_performance" v-tester>{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
<ms-reference-view ref="viewRef"/>
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable" />
</el-dropdown> </el-dropdown>
<ms-reference-view ref="viewRef"/>
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
</div>
</template> </template>
<script> <script>
@ -20,7 +23,7 @@
export default { export default {
name: "MsScenarioExtendButtons", name: "MsScenarioExtendButtons",
components: { MsReferenceView,MsScheduleMaintain}, components: {MsReferenceView, MsScheduleMaintain},
props: { props: {
row: Object row: Object
}, },
@ -61,7 +64,7 @@
}) })
}); });
}, },
refreshTable(){ refreshTable() {
} }
} }

View File

@ -3,14 +3,18 @@
<span class="kv-description" v-if="description"> <span class="kv-description" v-if="description">
{{ description }} {{ description }}
</span> </span>
<div class="kv-row" v-for="(item, index) in items" :key="index"> <ms-draggable element="ul" @update="endChange"
v-model="keyValues" v-bind="{draggable:'.item'}">
<div class="kv-row item" v-for="(item, index) in keyValues" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle"> <el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-button icon="el-icon-sort" circle size="mini"/>
<el-col class="kv-checkbox" v-if="isShowEnable"> <el-col class="kv-checkbox" v-if="isShowEnable">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable" <input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/> :disabled="isReadOnly"/>
</el-col> </el-col>
<el-col> <el-col class="item">
<el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200" <el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200"
@change="change" @change="change"
:placeholder="keyText" show-word-limit/> :placeholder="keyText" show-word-limit/>
@ -20,24 +24,29 @@
</el-col> </el-col>
<el-col> <el-col class="item">
<el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change" <el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change"
:placeholder="valueText" show-word-limit/> :placeholder="valueText" show-word-limit/>
</el-col> </el-col>
<el-col class="kv-delete"> <el-col class="item kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)" <el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index) || isReadOnly"/> :disabled="isDisable(index) || isReadOnly"/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</ms-draggable>
</div> </div>
</template> </template>
<script> <script>
import {KeyValue} from "../model/ApiTestModel"; import {KeyValue} from "../model/ApiTestModel";
import MsDraggable from 'vuedraggable'
export default { export default {
name: "MsApiKeyValue", name: "MsApiKeyValue",
components: {
MsDraggable
},
props: { props: {
keyPlaceholder: String, keyPlaceholder: String,
@ -55,7 +64,9 @@
suggestions: Array, suggestions: Array,
}, },
data() { data() {
return {} return {
keyValues: [],
}
}, },
computed: { computed: {
keyText() { keyText() {
@ -104,11 +115,27 @@
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
}; };
}, },
endChange(env) {
if (env.newIndex == env.oldIndex) {
return;
}
let newItem = this.keyValues[env.newIndex];
let oldItem = this.keyValues[env.oldIndex];
this.$set(this.keyValues, env.oldIndex, oldItem);
this.$set(this.keyValues, env.newIndex, newItem)
this.items.forEach(item => {
this.items.splice(0);
})
this.keyValues.forEach(item => {
this.items.push(item);
})
}
}, },
created() { created() {
if (this.items.length === 0 || this.items[this.items.length - 1].name) { if (this.items.length === 0 || this.items[this.items.length - 1].name) {
this.items.push(new KeyValue({enable: true})); this.items.push(new KeyValue({enable: true}));
} }
this.keyValues = this.items;
} }
} }
</script> </script>

View File

@ -3,15 +3,19 @@
<span class="kv-description" v-if="description"> <span class="kv-description" v-if="description">
{{ description }} {{ description }}
</span> </span>
<ms-draggable element="ul" @update="endChange"
v-model="keyValues" v-bind="{draggable:'.item'}">
<div class="kv-row" v-for="(item, index) in parameters" :key="index"> <div class="item kv-row" v-for="(item, index) in keyValues" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle"> <el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-button icon="el-icon-sort" circle size="mini"/>
<el-col class="kv-checkbox" v-if="isShowEnable"> <el-col class="kv-checkbox" v-if="isShowEnable">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable" <input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/> :disabled="isReadOnly"/>
</el-col> </el-col>
<el-col> <el-col class="item">
<el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200" <el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200"
@change="change" :placeholder="keyText" show-word-limit> @change="change" :placeholder="keyText" show-word-limit>
<template v-slot:prepend> <template v-slot:prepend>
@ -28,13 +32,13 @@
</el-col> </el-col>
<el-col class="kv-select"> <el-col class="item kv-select">
<el-select v-model="item.required" size="small"> <el-select v-model="item.required" size="small">
<el-option v-for="req in requireds" :key="req.id" :label="req.name" :value="req.id"/> <el-option v-for="req in requireds" :key="req.id" :label="req.name" :value="req.id"/>
</el-select> </el-select>
</el-col> </el-col>
<el-col v-if="item.type !== 'file'"> <el-col class="item" v-if="item.type !== 'file'">
<el-autocomplete <el-autocomplete
:disabled="isReadOnly" :disabled="isReadOnly"
size="small" size="small"
@ -49,7 +53,7 @@
</el-autocomplete> </el-autocomplete>
</el-col> </el-col>
<el-col> <el-col class="item">
<el-input v-model="item.description" size="small" maxlength="200" <el-input v-model="item.description" size="small" maxlength="200"
:placeholder="$t('commons.description')" show-word-limit> :placeholder="$t('commons.description')" show-word-limit>
</el-input> </el-input>
@ -59,17 +63,17 @@
</el-col> </el-col>
<el-col v-if="item.type === 'file'"> <el-col v-if="item.type === 'file'" class="item">
<ms-api-body-file-upload :parameter="item"/> <ms-api-body-file-upload :parameter="item"/>
</el-col> </el-col>
<el-col v-if="type === 'body'" class="kv-select"> <el-col v-if="type === 'body'" class="item kv-select">
<el-input :disabled="isReadOnly" v-model="item.contentType" size="small" <el-input :disabled="isReadOnly" v-model="item.contentType" size="small"
@change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit> @change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit>
</el-input> </el-input>
</el-col> </el-col>
<el-col class="kv-delete"> <el-col class="item kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)" <el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index) || isReadOnly"/> :disabled="isDisable(index) || isReadOnly"/>
</el-col> </el-col>
@ -77,6 +81,7 @@
</el-row> </el-row>
</div> </div>
</ms-draggable>
<ms-api-variable-advance ref="variableAdvance" :environment="environment" :scenario="scenario" <ms-api-variable-advance ref="variableAdvance" :environment="environment" :scenario="scenario"
:parameters="parameters" :parameters="parameters"
:current-item="currentItem"/> :current-item="currentItem"/>
@ -89,10 +94,11 @@
import MsApiVariableAdvance from "./ApiVariableAdvance"; import MsApiVariableAdvance from "./ApiVariableAdvance";
import MsApiBodyFileUpload from "./body/ApiBodyFileUpload"; import MsApiBodyFileUpload from "./body/ApiBodyFileUpload";
import {REQUIRED} from "../model/JsonData"; import {REQUIRED} from "../model/JsonData";
import MsDraggable from 'vuedraggable'
export default { export default {
name: "MsApiVariable", name: "MsApiVariable",
components: {MsApiBodyFileUpload, MsApiVariableAdvance}, components: {MsApiBodyFileUpload, MsApiVariableAdvance, MsDraggable},
props: { props: {
keyPlaceholder: String, keyPlaceholder: String,
valuePlaceholder: String, valuePlaceholder: String,
@ -118,7 +124,8 @@
data() { data() {
return { return {
currentItem: null, currentItem: null,
requireds: REQUIRED requireds: REQUIRED,
keyValues: [],
} }
}, },
computed: { computed: {
@ -196,6 +203,21 @@
} else { } else {
item.contentType = 'text/plain'; item.contentType = 'text/plain';
} }
},
endChange(env) {
if (env.newIndex == env.oldIndex) {
return;
}
let newItem = this.keyValues[env.newIndex];
let oldItem = this.keyValues[env.oldIndex];
this.$set(this.keyValues, env.oldIndex, oldItem);
this.$set(this.keyValues, env.newIndex, newItem)
this.parameters.forEach(item => {
this.parameters.splice(0);
})
this.keyValues.forEach(item => {
this.parameters.push(item);
})
} }
}, },
created() { created() {
@ -208,6 +230,7 @@
contentType: 'text/plain' contentType: 'text/plain'
})); }));
} }
this.keyValues = this.parameters;
} }
} }
</script> </script>