fix: 导出html报告打开乱码

This commit is contained in:
chenjianxing 2021-08-24 22:34:03 +08:00 committed by jianxing
parent 5e14249e8f
commit 7ca416a20c
7 changed files with 5 additions and 13 deletions

View File

@ -16,7 +16,6 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
private String principalName; private String principalName;
private List<String> tagNames; private List<String> tagNames;
private String deleteUser; private String deleteUser;
private Long deleteTime;
/** /**
* 场景跨项目ID * 场景跨项目ID

View File

@ -12,7 +12,5 @@ public class TestPlanFailureApiDTO extends TestPlanApiCaseDTO {
private String projectName; private String projectName;
private String caseId;
private String response; private String response;
} }

View File

@ -8,10 +8,5 @@ import lombok.Setter;
@Setter @Setter
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class TestPlanFailureScenarioDTO extends ApiScenarioDTO { public class TestPlanFailureScenarioDTO extends ApiScenarioDTO {
private String projectName;
private String caseId;
private APIScenarioReportResult response; private APIScenarioReportResult response;
} }

View File

@ -11,7 +11,6 @@ import java.util.List;
public class TestPlanCaseDTO extends TestCaseWithBLOBs { public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String executor; private String executor;
private String executorName; private String executorName;
private String status;
private String results; private String results;
private String planId; private String planId;
private String planName; private String planName;

View File

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import io.metersphere.api.cache.TestPlanExecuteInfo; import io.metersphere.api.cache.TestPlanExecuteInfo;
import io.metersphere.api.cache.TestPlanReportExecuteCatch; import io.metersphere.api.cache.TestPlanReportExecuteCatch;
import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.APIReportResult;
@ -1693,7 +1694,7 @@ public class TestPlanService {
String line = null; String line = null;
while (null != (line = bufferedReader.readLine())) { while (null != (line = bufferedReader.readLine())) {
if (line.contains("\"#report\"")) { if (line.contains("\"#report\"")) {
line = line.replace("\"#report\"", JSONObject.toJSONString(report)); line = line.replace("\"#report\"", new Gson().toJson(report));
} }
line += "\n"; line += "\n";
byte[] lineBytes = line.getBytes(StandardCharsets.UTF_8); byte[] lineBytes = line.getBytes(StandardCharsets.UTF_8);

View File

@ -107,6 +107,7 @@ export default {
id: '' id: ''
}; };
}, },
props: ['report', 'export', 'isShare', 'shareId', 'planReportTemplate'],
methods: { methods: {
initTableData() { initTableData() {
this.$get("/performance/report/content/testoverview/" + this.id).then(res => { this.$get("/performance/report/content/testoverview/" + this.id).then(res => {
@ -492,7 +493,6 @@ export default {
deep: true deep: true
} }
}, },
props: ['report', 'export']
}; };
</script> </script>

View File

@ -50,10 +50,10 @@ export default {
let startTime = 'NaN'; let startTime = 'NaN';
let endTime = 'NaN'; let endTime = 'NaN';
if (this.report.startTime) { if (this.report.startTime) {
startTime = timestampFormatDate(this.report.startTime, false).substring(0, 10); startTime = timestampFormatDate(this.report.startTime, false);
} }
if (this.report.endTime) { if (this.report.endTime) {
endTime = timestampFormatDate(this.report.endTime, false).substring(0, 10); endTime = timestampFormatDate(this.report.endTime, false);
} }
return startTime + ' ~ ' + endTime; return startTime + ' ~ ' + endTime;
} }