fix(接口定义): 修复导入API 编辑问题

This commit is contained in:
fit2-zhao 2020-12-17 15:02:39 +08:00
parent 9d9f949414
commit 3dda8e849d
3 changed files with 28 additions and 18 deletions

View File

@ -64,9 +64,9 @@
</el-col> </el-col>
<!--<el-col v-if="type === 'body'" class="kv-select">--> <!--<el-col v-if="type === 'body'" class="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="kv-delete">
@ -199,14 +199,16 @@
} }
}, },
created() { created() {
if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { if (this.parameters) {
this.parameters.push(new KeyValue({ if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) {
type: 'text', this.parameters.push(new KeyValue({
enable: true, type: 'text',
required: true, enable: true,
uuid: this.uuid(), required: true,
contentType: 'text/plain' uuid: this.uuid(),
})); contentType: 'text/plain'
}));
}
} }
} }
} }

View File

@ -182,11 +182,13 @@
if (!this.body.type) { if (!this.body.type) {
this.body.type = BODY_TYPE.FORM_DATA; this.body.type = BODY_TYPE.FORM_DATA;
} }
this.body.kvs.forEach(param => { if (this.body.kvs) {
if (!param.type) { this.body.kvs.forEach(param => {
param.type = 'text'; if (!param.type) {
} param.type = 'text';
}); }
});
}
} }
} }
</script> </script>

View File

@ -18,7 +18,7 @@ export const DEFAULT_DATA = [{
"name": "回收站", "name": "回收站",
"level": 1, "level": 1,
"children": [], "children": [],
},{ }, {
"id": "root", "id": "root",
"name": "全部模块", "name": "全部模块",
"level": 0, "level": 0,
@ -27,7 +27,13 @@ export const DEFAULT_DATA = [{
export const REQ_METHOD = [ export const REQ_METHOD = [
{id: 'GET', label: 'GET'}, {id: 'GET', label: 'GET'},
{id: 'POST', label: 'POST'} {id: 'POST', label: 'POST'},
{id: 'PUT', label: 'PUT'},
{id: 'PATCH', label: 'PATCH'},
{id: 'DELETE', label: 'DELETE'},
{id: 'OPTIONS', label: 'OPTIONS'},
{id: 'HEAD', label: 'HEAD'},
{id: 'CONNECT', label: 'CONNECT'}
] ]
export const API_STATUS = [ export const API_STATUS = [