refactor: 下载jtl

This commit is contained in:
Captain.B 2020-11-13 16:58:57 +08:00
parent b9e79cec6e
commit abd12d5d77
2 changed files with 6 additions and 3 deletions

View File

@ -279,7 +279,7 @@ public class ReportService {
public byte[] downloadJtl(String reportId) {
LoadTestReportWithBLOBs report = getReport(reportId);
if (StringUtils.isBlank(report.getFileId())) {
MSException.throwException(Translator.get("load_test_report_file_not_exist"));
throw new RuntimeException(Translator.get("load_test_report_file_not_exist"));
}
return fileService.loadFileAsBytes(report.getFileId());
}

View File

@ -26,7 +26,7 @@
{{ $t('test_track.plan_view.export_report') }}
</el-button>
<el-button :disabled="isReadOnly" type="warning" plain size="mini" @click="downloadJtl()">
下载JTL
{{ $t('report.downloadJtl') }}
</el-button>
<!--<el-button :disabled="isReadOnly" type="warning" plain size="mini">-->
@ -307,7 +307,10 @@ export default {
navigator.msSaveBlob(blob, this.filename)
}
}).catch(e => {
Message.error({message: e.message, showClose: true});
let text = e.response.data.text();
text.then((data) => {
Message.error({message: JSON.parse(data).message || e.message, showClose: true});
});
});
}
},