|
@@ -122,7 +122,18 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="box-justify">
|
|
|
- <div></div>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('button', 'CreateWholePdf')"
|
|
|
+ icon="el-icon-document"
|
|
|
+ :disabled="!searchfilter.paperNumber"
|
|
|
+ :loading="pdfLoading"
|
|
|
+ :type="wholePdfInfo.status === 'RUNNING' ? 'default' : 'success'"
|
|
|
+ @click="toViewWholePdf"
|
|
|
+ >
|
|
|
+ {{ wholePdfBtnName }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
<div>
|
|
|
<el-button
|
|
|
v-if="checkPrivilege('button', 'BatchEnd')"
|
|
@@ -475,6 +486,8 @@ import {
|
|
|
downloadPrintTaskPdf,
|
|
|
rebuildPrintTaskPdf,
|
|
|
printTaskNormal,
|
|
|
+ getPrintTaskWholePdf,
|
|
|
+ createPrintTaskWholePdf,
|
|
|
} from "../api";
|
|
|
import { PRINT_TASK_STATUS } from "@/constants/enumerate";
|
|
|
import pickerOptions from "@/constants/datePickerOptions";
|
|
@@ -529,12 +542,29 @@ export default {
|
|
|
actionType: "view",
|
|
|
// view-template
|
|
|
curTask: {},
|
|
|
+ // whole pdf
|
|
|
+ wholePdfInfo: {
|
|
|
+ status: "INIT",
|
|
|
+ url: "",
|
|
|
+ },
|
|
|
+ pdfLoading: false,
|
|
|
// date-picker
|
|
|
createTime: [],
|
|
|
printTime: [],
|
|
|
pickerOptions,
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ wholePdfBtnName() {
|
|
|
+ if (this.wholePdfInfo.status === "RUNNING") {
|
|
|
+ return "生成pdf中...";
|
|
|
+ }
|
|
|
+ if (this.wholePdfInfo.status === "FINISH" && this.wholePdfInfo.url) {
|
|
|
+ return "查看合并PDF";
|
|
|
+ }
|
|
|
+ return "生成合并PDF";
|
|
|
+ },
|
|
|
+ },
|
|
|
mounted() {
|
|
|
// this.search();
|
|
|
},
|
|
@@ -576,7 +606,9 @@ export default {
|
|
|
search() {
|
|
|
this.toPage(1);
|
|
|
this.getTotalInfo();
|
|
|
+ this.fetchWholePdf();
|
|
|
},
|
|
|
+
|
|
|
printPlanChange() {
|
|
|
this.filter.paperNumber = "";
|
|
|
this.filter.courseId = "";
|
|
@@ -599,6 +631,40 @@ export default {
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val.map((item) => item.examDetailId);
|
|
|
},
|
|
|
+ async fetchWholePdf() {
|
|
|
+ if (!this.filter.paperNumber) {
|
|
|
+ this.wholePdfInfo = { status: "INIT", url: "" };
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.wholePdfInfo = await getPrintTaskWholePdf({
|
|
|
+ examId: this.filter.examId,
|
|
|
+ courseId: this.filter.courseId,
|
|
|
+ paperNumber: this.filter.paperNumber,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async toViewWholePdf() {
|
|
|
+ if (this.wholePdfInfo.status === "RUNNING") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.wholePdfInfo.url && this.wholePdfInfo.status === "FINISH") {
|
|
|
+ window.open(this.wholePdfInfo.url);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.pdfLoading) return;
|
|
|
+ this.pdfLoading = true;
|
|
|
+
|
|
|
+ const res = await createPrintTaskWholePdf({
|
|
|
+ examId: this.filter.examId,
|
|
|
+ courseId: this.filter.courseId,
|
|
|
+ paperNumber: this.filter.paperNumber,
|
|
|
+ }).catch(() => {});
|
|
|
+ this.pdfLoading = false;
|
|
|
+
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success("生成任务已经提交");
|
|
|
+ this.wholePdfInfo.status = "RUNNING";
|
|
|
+ },
|
|
|
toPreview(row) {
|
|
|
this.curTask = row;
|
|
|
this.$refs.PreviewPrintTaskTemplate.open();
|