feat接口定义_请求体为form-data_的json参数的可以增加参数的优化

This commit is contained in:
wxg0103 2021-09-28 10:26:45 +08:00 committed by fit2-zhao
parent a1abd2fd76
commit 0a47d283a2
1 changed files with 213 additions and 212 deletions

View File

@ -100,18 +100,18 @@
</template> </template>
<script> <script>
import {KeyValue, Scenario} from "../model/ApiTestModel"; import {KeyValue, Scenario} from "../model/ApiTestModel";
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants"; import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
import MsApiVariableAdvance from "./ApiVariableAdvance"; import MsApiVariableAdvance from "./ApiVariableAdvance";
import MsApiVariableJson from "./ApiVariableJson"; import MsApiVariableJson from "./ApiVariableJson";
import MsApiBodyFileUpload from "./body/ApiBodyFileUpload"; import MsApiBodyFileUpload from "./body/ApiBodyFileUpload";
import {REQUIRED} from "../model/JsonData"; import {REQUIRED} from "../model/JsonData";
import Vue from 'vue'; import Vue from 'vue';
import ApiVariableSetting from "@/business/components/api/definition/components/ApiVariableSetting"; import ApiVariableSetting from "@/business/components/api/definition/components/ApiVariableSetting";
export default { export default {
name: "MsApiVariable", name: "MsApiVariable",
components: {ApiVariableSetting, MsApiBodyFileUpload, MsApiVariableAdvance , MsApiVariableJson}, components: {ApiVariableSetting, MsApiBodyFileUpload, MsApiVariableAdvance, MsApiVariableJson},
props: { props: {
keyPlaceholder: String, keyPlaceholder: String,
valuePlaceholder: String, valuePlaceholder: String,
@ -147,10 +147,10 @@
} }
}, },
watch: { watch: {
isSelectAll: function(to, from) { isSelectAll: function (to, from) {
if(from == false && to == true) { if (from == false && to == true) {
this.selectAll(); this.selectAll();
} else if(from == true && to == false) { } else if (from == true && to == false) {
this.invertSelect(); this.invertSelect();
} }
}, },
@ -240,10 +240,10 @@
return (((1 + Math.random()) * 0x100000) | 0).toString(16).substring(1); return (((1 + Math.random()) * 0x100000) | 0).toString(16).substring(1);
}, },
advanced(item) { advanced(item) {
if (item.type === 'json'){ if (item.type === 'json') {
this.$refs.variableJson.open(item); this.$refs.variableJson.open(item);
this.currentItem = item; this.currentItem = item;
}else { } else {
this.$refs.variableAdvance.open(); this.$refs.variableAdvance.open();
this.currentItem = item; this.currentItem = item;
} }
@ -252,7 +252,7 @@
typeChange(item) { typeChange(item) {
if (item.type === 'file') { if (item.type === 'file') {
item.contentType = 'application/octet-stream'; item.contentType = 'application/octet-stream';
} else if (item.type === 'text'){ } else if (item.type === 'text') {
item.contentType = 'text/plain'; item.contentType = 'text/plain';
} else { } else {
item.contentType = 'application/json' item.contentType = 'application/json'
@ -278,8 +278,9 @@
openApiVariableSetting(item) { openApiVariableSetting(item) {
this.$refs.apiVariableSetting.open(item); this.$refs.apiVariableSetting.open(item);
}, },
callback(item){ callback(item) {
this.currentItem.value=item; this.currentItem.value = item;
this.currentItem = null;
} }
}, },
created() { created() {
@ -293,54 +294,54 @@
})); }));
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.kv-description { .kv-description {
font-size: 13px; font-size: 13px;
} }
.kv-row { .kv-row {
margin-top: 10px; margin-top: 10px;
} }
.kv-delete { .kv-delete {
width: 60px; width: 60px;
} }
.kv-select { .kv-select {
width: 50%; width: 50%;
} }
.el-autocomplete { .el-autocomplete {
width: 100%; width: 100%;
} }
.kv-checkbox { .kv-checkbox {
width: 20px; width: 20px;
margin-right: 10px; margin-right: 10px;
} }
.advanced-item-value >>> .el-dialog__body { .advanced-item-value >>> .el-dialog__body {
padding: 15px 25px; padding: 15px 25px;
} }
.el-row { .el-row {
margin-bottom: 5px; margin-bottom: 5px;
} }
.kv-type { .kv-type {
width: 70px; width: 70px;
} }
.pointer { .pointer {
cursor: pointer; cursor: pointer;
color: #1E90FF; color: #1E90FF;
} }
.kv-setting { .kv-setting {
width: 40px; width: 40px;
padding: 0px !important; padding: 0px !important;
} }
</style> </style>