|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Report from "./report/Report.vue";
|
|
|
-import { downloadByApi } from "@/plugins/download";
|
|
|
+import { downloadByUrl } from "@/plugins/download";
|
|
|
import { scoreReportExport } from "../api";
|
|
|
|
|
|
export default {
|
|
@@ -73,22 +73,24 @@ export default {
|
|
|
this.downloading = true;
|
|
|
|
|
|
const filename = `${this.title}.pdf`;
|
|
|
- const res = await downloadByApi(() => {
|
|
|
- const formData = new FormData();
|
|
|
- const htmlFile = new File(
|
|
|
- [this.$refs.reportRef.getTemp()],
|
|
|
- `${Date.now()}.html`,
|
|
|
- { type: "text/html" }
|
|
|
- );
|
|
|
- formData.append("file", htmlFile);
|
|
|
- return scoreReportExport(formData);
|
|
|
- }, filename).catch((e) => {
|
|
|
+ const formData = new FormData();
|
|
|
+ const htmlFile = new File(
|
|
|
+ [this.$refs.reportRef.getTemp()],
|
|
|
+ `${Date.now()}.html`,
|
|
|
+ { type: "text/html" }
|
|
|
+ );
|
|
|
+ formData.append("file", htmlFile);
|
|
|
+ formData.append("examId", this.instance.examId);
|
|
|
+ formData.append("paperNumber", this.instance.paperNumber);
|
|
|
+ const res = await scoreReportExport(formData).catch((e) => {
|
|
|
this.$message.error(e || "下载失败,请重新尝试!");
|
|
|
});
|
|
|
this.downloading = false;
|
|
|
|
|
|
if (!res) return;
|
|
|
- this.$message.success("下载成功!");
|
|
|
+
|
|
|
+ downloadByUrl(res, filename);
|
|
|
+ this.$message.success("开始下载");
|
|
|
},
|
|
|
},
|
|
|
};
|