fix(接口定义): 修复导入的接口定义无法添加文件的缺陷

--bug=1017203 --user=王孝刚 【接口测试】导入的接口,上传文件/关联系统文件没有反应
https://www.tapd.cn/55049933/s/1254069
This commit is contained in:
wxg0103 2022-09-29 10:26:02 +08:00 committed by wxg0103
parent 02f394db33
commit 93a6f8b073
2 changed files with 11 additions and 7 deletions

View File

@ -141,7 +141,6 @@ import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
import MsApiCaseList from "./case/ApiCaseList"; import MsApiCaseList from "./case/ApiCaseList";
import {getUUID} from "@/common/js/utils"; import {getUUID} from "@/common/js/utils";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting"; import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import _ from 'lodash';
import MsContainer from "@/business/components/common/components/MsContainer"; import MsContainer from "@/business/components/common/components/MsContainer";
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer"; import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer";
@ -272,11 +271,6 @@ export default {
if (this.currentApi.request != null && this.currentApi.request != 'null' && this.currentApi.request != undefined) { if (this.currentApi.request != null && this.currentApi.request != 'null' && this.currentApi.request != undefined) {
if (Object.prototype.toString.call(this.currentApi.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') { if (Object.prototype.toString.call(this.currentApi.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
this.currentApi.request = JSON.parse(this.currentApi.request); this.currentApi.request = JSON.parse(this.currentApi.request);
if (this.currentApi.request.body && !this.currentApi.request.body.type) {
let tempRequest = _.cloneDeep(this.currentApi.request);
tempRequest.body = {type: null};
this.currentApi.request = tempRequest;
}
} }
} }
if (this.currentApi && this.currentApi.request && !this.currentApi.request.hashTree) { if (this.currentApi && this.currentApi.request && !this.currentApi.request.hashTree) {

View File

@ -194,7 +194,6 @@
prop="description" prop="description"
:field="item" :field="item"
min-width="120px" min-width="120px"
sortable
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
:label="$t('commons.description')"/> :label="$t('commons.description')"/>
</span> </span>
@ -704,9 +703,20 @@ export default {
if (!item.request.body) { if (!item.request.body) {
item.request.body = new Body(); item.request.body = new Body();
} }
if (!item.request.body.type) {
this.$set(item.request.body, "type", null);
}
if (!item.request.headers) { if (!item.request.headers) {
item.request.headers = []; item.request.headers = [];
} }
if (!item.request.body.kvs) {
item.request.body.kvs = [];
}
item.request.body.kvs.forEach(i => {
if (!i.files) {
i.files = []
}
})
if (!item.request.rest) { if (!item.request.rest) {
item.request.rest = []; item.request.rest = [];
} }