fix: 前端报错

This commit is contained in:
chenjianxing 2020-12-08 12:02:12 +08:00
parent 91d37ccafe
commit d24c9c43b2
3 changed files with 47 additions and 36 deletions

View File

@ -263,13 +263,20 @@
<artifactId>spring-boot-starter-data-ldap</artifactId> <artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency> </dependency>
<!-- swagger 解析 --> <!-- swagger2 解析 -->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId> <artifactId>swagger-parser</artifactId>
<version>1.0.51</version> <version>1.0.51</version>
</dependency> </dependency>
<!-- swagger3 解析 -->
<!--<dependency>-->
<!--<groupId>io.swagger.parser.v3</groupId>-->
<!--<artifactId>swagger-parser</artifactId>-->
<!--<version>2.0.24</version>-->
<!--</dependency>-->
<!-- 执行 js 代码依赖 --> <!-- 执行 js 代码依赖 -->
<dependency> <dependency>
<groupId>org.graalvm.sdk</groupId> <groupId>org.graalvm.sdk</groupId>

View File

@ -336,7 +336,7 @@
let bodyUploadFiles = []; let bodyUploadFiles = [];
row.bodyUploadIds = []; row.bodyUploadIds = [];
let request = row.request; let request = row.request;
if (request.body) { if (request.body && request.body.kvs) {
request.body.kvs.forEach(param => { request.body.kvs.forEach(param => {
if (param.files) { if (param.files) {
param.files.forEach(item => { param.files.forEach(item => {
@ -350,19 +350,21 @@
}); });
} }
}); });
request.body.binary.forEach(param => { if (request.body.binary) {
if (param.files) { request.body.binary.forEach(param => {
param.files.forEach(item => { if (param.files) {
if (item.file) { param.files.forEach(item => {
let fileId = getUUID().substring(0, 8); if (item.file) {
item.name = item.file.name; let fileId = getUUID().substring(0, 8);
item.id = fileId; item.name = item.file.name;
row.bodyUploadIds.push(fileId); item.id = fileId;
bodyUploadFiles.push(item.file); row.bodyUploadIds.push(fileId);
} bodyUploadFiles.push(item.file);
}); }
} });
}); }
});
}
} }
return bodyUploadFiles; return bodyUploadFiles;
}, },

View File

@ -58,25 +58,10 @@
getBodyUploadFiles(obj) { getBodyUploadFiles(obj) {
let bodyUploadFiles = []; let bodyUploadFiles = [];
obj.bodyUploadIds = []; obj.bodyUploadIds = [];
this.runData.forEach(request => { if (this.runData) {
if (request.body) { this.runData.forEach(request => {
request.body.kvs.forEach(param => { if (request.body) {
if (param.files) { request.body.kvs.forEach(param => {
param.files.forEach(item => {
if (item.file) {
if (!item.id) {
let fileId = getUUID().substring(0, 12);
item.name = item.file.name;
item.id = fileId;
}
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
}
});
}
});
if (request.body.binary) {
request.body.binary.forEach(param => {
if (param.files) { if (param.files) {
param.files.forEach(item => { param.files.forEach(item => {
if (item.file) { if (item.file) {
@ -91,9 +76,26 @@
}); });
} }
}); });
if (request.body.binary) {
request.body.binary.forEach(param => {
if (param.files) {
param.files.forEach(item => {
if (item.file) {
if (!item.id) {
let fileId = getUUID().substring(0, 12);
item.name = item.file.name;
item.id = fileId;
}
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
}
});
}
});
}
} }
} });
}); }
return bodyUploadFiles; return bodyUploadFiles;
}, },
run() { run() {