|
@@ -12,7 +12,9 @@
|
|
<div class="box-justify" slot="title">
|
|
<div class="box-justify" slot="title">
|
|
<h2 class="el-dialog__title">成绩报告</h2>
|
|
<h2 class="el-dialog__title">成绩报告</h2>
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary" @click="toExportScore">下载报告</el-button>
|
|
|
|
|
|
+ <el-button type="primary" :loading="downloading" @click="toExportScore"
|
|
|
|
+ >下载报告</el-button
|
|
|
|
+ >
|
|
<el-button type="primary" @click="cancel">取消</el-button>
|
|
<el-button type="primary" @click="cancel">取消</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -25,6 +27,8 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import Report from "./report/Report.vue";
|
|
import Report from "./report/Report.vue";
|
|
|
|
+import { downloadByApi } from "@/plugins/download";
|
|
|
|
+import { scoreReportExport } from "../api";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "score-report-preview",
|
|
name: "score-report-preview",
|
|
@@ -40,6 +44,7 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
|
|
+ downloading: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -49,8 +54,23 @@ export default {
|
|
open() {
|
|
open() {
|
|
this.modalIsShow = true;
|
|
this.modalIsShow = true;
|
|
},
|
|
},
|
|
- toExportScore() {
|
|
|
|
- // TODO:
|
|
|
|
|
|
+ async toExportScore() {
|
|
|
|
+ if (this.downloading) return;
|
|
|
|
+ this.downloading = true;
|
|
|
|
+
|
|
|
|
+ const res = await downloadByApi(() => {
|
|
|
|
+ return scoreReportExport({
|
|
|
|
+ examId: this.instance.examId,
|
|
|
|
+ paperNumber: this.instance.paperNumber,
|
|
|
|
+ htmlContent: this.$refs.reportRef.getTemp(),
|
|
|
|
+ });
|
|
|
|
+ }).catch((e) => {
|
|
|
|
+ this.$message.error(e || "下载失败,请重新尝试!");
|
|
|
|
+ });
|
|
|
|
+ this.downloading = false;
|
|
|
|
+
|
|
|
|
+ if (!res) return;
|
|
|
|
+ this.$message.success("下载成功!");
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|