fix(接口自动化): json 处理
This commit is contained in:
parent
d29c8bf2a2
commit
9c4e5bfbdb
|
@ -34,12 +34,12 @@
|
||||||
created() {
|
created() {
|
||||||
if (!this.body.jsonSchema && this.body.raw) {
|
if (!this.body.jsonSchema && this.body.raw) {
|
||||||
let obj = {"root": GenerateSchema(JSON.parse(this.body.raw))}
|
let obj = {"root": GenerateSchema(JSON.parse(this.body.raw))}
|
||||||
this.body.jsonSchema = obj;
|
this.schema = obj;
|
||||||
this.schema = this.body.jsonSchema;
|
|
||||||
}
|
}
|
||||||
else if (this.body.jsonSchema) {
|
else if (this.body.jsonSchema) {
|
||||||
this.schema = this.body.jsonSchema;
|
this.schema = {"root": this.body.jsonSchema};
|
||||||
}
|
}
|
||||||
|
this.body.jsonSchema = this.schema.root;
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
methods: {
|
methods: {
|
||||||
handleClick() {
|
handleClick() {
|
||||||
if (this.activeName === 'preview') {
|
if (this.activeName === 'preview') {
|
||||||
this.preview = schemaToJson(Object.values(this.schema)[0]);
|
this.preview = schemaToJson(this.schema.root);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openOneClickOperation() {
|
openOneClickOperation() {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<ms-mock :schema="pickValue"/>
|
<ms-mock :disabled="pickValue.type==='object'" :schema="pickValue"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-input v-model="pickValue.description" class="ant-col-title" :placeholder="local['description']" size="small"/>
|
<el-input v-model="pickValue.description" class="ant-col-title" :placeholder="local['description']" size="small"/>
|
||||||
|
@ -220,6 +220,7 @@
|
||||||
this.$delete(this.pickValue, 'properties')
|
this.$delete(this.pickValue, 'properties')
|
||||||
this.$delete(this.pickValue, 'items')
|
this.$delete(this.pickValue, 'items')
|
||||||
this.$delete(this.pickValue, 'required')
|
this.$delete(this.pickValue, 'required')
|
||||||
|
this.$delete(this.pickValue, 'mock')
|
||||||
if (this.isArray) {
|
if (this.isArray) {
|
||||||
this.$set(this.pickValue, 'items', {type: 'string', mock: {mock: ""}})
|
this.$set(this.pickValue, 'items', {type: 'string', mock: {mock: ""}})
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<div>
|
<div>
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
size="small"
|
size="small"
|
||||||
:disabled="false"
|
|
||||||
class="input-with-autocomplete"
|
class="input-with-autocomplete"
|
||||||
v-model="mock.mock"
|
v-model="mock.mock"
|
||||||
:fetch-suggestions="funcSearch"
|
:fetch-suggestions="funcSearch"
|
||||||
|
:disabled="disabled"
|
||||||
:placeholder="$t('api_test.value')"
|
:placeholder="$t('api_test.value')"
|
||||||
value-key="name"
|
value-key="name"
|
||||||
highlight-first-item
|
highlight-first-item
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
default: () => {
|
default: () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
disabled: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -43,6 +44,9 @@
|
||||||
} else {
|
} else {
|
||||||
this.schema.mock = this.mock;
|
this.schema.mock = this.mock;
|
||||||
}
|
}
|
||||||
|
if (this.schema.type === 'object') {
|
||||||
|
this.$delete(this.schema, 'mock')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue