123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721 |
- <template>
- <div class="print-task-manage">
- <div class="part-box part-box-filter">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="学期:">
- <semester-select
- v-model.trim="filter.semesterId"
- placeholder="学期"
- default-select
- ></semester-select>
- </el-form-item>
- <el-form-item label="考试:">
- <exam-select
- v-model="filter.examId"
- :semester-id="filter.semesterId"
- default-select
- @default-selected="search"
- ></exam-select>
- </el-form-item>
- <el-form-item label="印刷计划:">
- <print-plan-select
- v-model.trim="filter.printPlanId"
- placeholder="印刷计划"
- clearable
- :semester-id="filter.semesterId"
- :exam-id="filter.examId"
- @change="printPlanChange"
- ></print-plan-select>
- </el-form-item>
- <el-form-item label="课程(代码):" label-width="110px">
- <course-select
- v-model.trim="filter.courseCode"
- :semester-id="filter.semesterId"
- :exam-id="filter.examId"
- :print-plan-id="filter.printPlanId"
- placeholder="课程(代码)"
- clearable
- ></course-select>
- </el-form-item>
- <el-form-item label="试卷编号:">
- <paper-number-select
- ref="PaperNumberSelect"
- v-model="filter.paperNumber"
- :semester-id="filter.semesterId"
- :exam-id="filter.examId"
- :print-plan-id="filter.printPlanId"
- :course-code="filter.courseCode"
- placeholder="试卷编号"
- clearable
- ></paper-number-select>
- </el-form-item>
- <el-form-item label="印刷室:">
- <print-room-select
- v-model.trim="filter.printHouseId"
- placeholder="印刷室"
- clearable
- ></print-room-select>
- </el-form-item>
- <el-form-item label="印刷状态:">
- <status-select
- v-model="filter.status"
- type="EXAM_DETAIL_STATUS_ENUM"
- placeholder="印刷状态"
- style="width: 120px"
- clearable
- >
- </status-select>
- </el-form-item>
- <el-form-item label="考点:" label-width="55px">
- <place-select
- v-model.trim="filter.examPlace"
- :print-plan-id="filter.printPlanId"
- placeholder="考点"
- clearable
- ></place-select>
- </el-form-item>
- <el-form-item label="考场:" label-width="55px">
- <room-select
- v-model.trim="filter.examRoom"
- :print-plan-id="filter.printPlanId"
- placeholder="考场"
- clearable
- ></room-select>
- </el-form-item>
- <el-form-item label="考试日期:">
- <el-date-picker
- v-model="createTime"
- type="daterange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="考试开始日期"
- end-placeholder="考试结束日期"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="打印时间:">
- <el-date-picker
- v-model="printTime"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="打印开始时间"
- end-placeholder="打印结束时间"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- @click="search"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="box-justify">
- <div></div>
- <div>
- <el-button
- v-if="checkPrivilege('button', 'BatchEnd')"
- icon="el-icon-download"
- type="danger"
- @click="toBatchCancel"
- >
- 批量撤回
- </el-button>
- <el-button
- v-if="checkPrivilege('button', 'BatchDownload')"
- icon="el-icon-download"
- type="primary"
- :disabled="loading"
- @click="toExport"
- >
- 批量下载PDF
- </el-button>
- <el-button
- v-if="checkPrivilege('button', 'BatchDownload')"
- type="primary"
- icon="el-icon-s-order"
- @click="toDataTask"
- >下载结果查询</el-button
- >
- </div>
- </div>
- </div>
- <div class="part-box part-box-pad box-justify">
- <p>
- <span class="mr-4"
- >科次总计:<i class="color-primary">{{ totalInfo.totalSubjects }}</i>
- 科次</span
- >
- <span class="mr-4"
- >试卷总计:<i class="color-primary">{{ totalInfo.paperCount }}</i>
- 套</span
- >
- <span class="mr-4"
- >卷袋总计:<i class="color-primary">{{ totalInfo.packageCount }}</i>
- 个</span
- >
- <span
- >总印量:<i class="color-primary">{{
- totalInfo.paperPages + totalInfo.cardPages
- }}</i>
- 张</span
- >
- <span
- >(试卷:<i class="color-primary">{{ totalInfo.paperPages }}</i>
- 张,</span
- >
- <span
- >题卡:<i class="color-primary">{{ totalInfo.cardPages }}</i>
- 张)</span
- >
- </p>
- <p>
- <span
- >剩余印量:<i class="color-danger">{{
- totalInfo.paperPagesLeft + totalInfo.cardPagesLeft
- }}</i>
- 张</span
- >
- <span
- >(试卷:<i class="color-danger">{{ totalInfo.paperPagesLeft }}</i>
- 张,</span
- >
- <span
- >题卡:<i class="color-danger">{{ totalInfo.cardPagesLeft }}</i>
- 张)</span
- >
- </p>
- </div>
- <div class="part-box part-box-pad">
- <el-table
- ref="TableList"
- :data="dataList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- type="selection"
- width="55"
- align="center"
- ></el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="60"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column
- prop="semesterName"
- label="学期"
- min-width="200"
- ></el-table-column>
- <el-table-column
- prop="examName"
- label="考试"
- min-width="160"
- ></el-table-column>
- <el-table-column
- prop="packageCode"
- label="卷袋编号"
- min-width="160"
- ></el-table-column>
- <el-table-column
- prop="printPlanName"
- label="印刷计划"
- min-width="200"
- ></el-table-column>
- <el-table-column
- prop="printHouseName"
- label="印刷室"
- min-width="160"
- ></el-table-column>
- <el-table-column
- prop="examDate"
- label="考试日期"
- width="100"
- ></el-table-column>
- <el-table-column
- prop="examTime"
- label="考试时间"
- width="100"
- ></el-table-column>
- <el-table-column
- prop="courseNameCode"
- label="课程(代码)"
- min-width="200"
- >
- </el-table-column>
- <el-table-column
- prop="paperNumber"
- label="试卷编号"
- min-width="160"
- ></el-table-column>
- <el-table-column
- prop="examPlace"
- label="考点"
- min-width="160"
- ></el-table-column>
- <el-table-column
- prop="examRoom"
- label="考场"
- min-width="160"
- ></el-table-column>
- <!-- <el-table-column
- prop="singlePagesA3"
- label="单科次准印量A3(页)"
- width="80"
- ></el-table-column> -->
- <el-table-column
- prop="totalSubjects"
- label="科次"
- width="80"
- ></el-table-column>
- <!-- <el-table-column
- prop="pagesA3"
- label="A3准印量小计(页)"
- width="80"
- ></el-table-column>
- <el-table-column
- prop="pagesA4"
- label="A4准印量小计(页)"
- width="80"
- ></el-table-column> -->
- <el-table-column prop="statusDisplay" label="印刷状态" width="80">
- </el-table-column>
- <el-table-column prop="validate" label="是否校验" width="80">
- <span slot-scope="scope">{{ scope.row.validate ? "是" : "否" }}</span>
- </el-table-column>
- <el-table-column prop="printStartTime" label="打印开始时间" width="170">
- <span slot-scope="scope">{{
- scope.row.printStartTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="printEndTime" label="打印完成时间" width="170">
- <span slot-scope="scope">{{
- scope.row.printEndTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="normal" label="任务状态" width="80">
- <span slot-scope="scope">{{
- scope.row.normal ? "正常" : "作废"
- }}</span>
- </el-table-column>
- <el-table-column
- class-name="action-column"
- label="操作"
- width="160"
- fixed="right"
- >
- <template slot-scope="scope">
- <el-button
- v-if="
- checkPrivilege('link', 'download') &&
- (scope.row.status === 'READY' ||
- scope.row.status === 'WAITING' ||
- scope.row.status === 'PRINTING' ||
- scope.row.status === 'FINISH' ||
- scope.row.status === 'CANCEL')
- "
- class="btn-primary"
- type="text"
- @click="toActionPdf(scope.row, 'view')"
- >查看pdf</el-button
- >
- <el-button
- v-if="
- scope.row.taskId &&
- checkPrivilege('link', 'createpdf') &&
- (scope.row.status === 'READY' ||
- scope.row.status === 'CANCEL' ||
- !scope.row.normal)
- "
- class="btn-primary"
- type="text"
- @click="toActionPdf(scope.row, 'build')"
- >重新生成pdf</el-button
- >
- <el-button
- v-if="
- scope.row.status === 'READY' && checkPrivilege('link', 'submit')
- "
- class="btn-primary"
- type="text"
- @click="toSubmit(scope.row)"
- >提交印刷</el-button
- >
- <!-- <el-button
- v-if="scope.row.status === 'PRINTING'"
- class="btn-primary"
- type="text"
- @click="toResubmit(scope.row)"
- >重新提交</el-button> -->
- <el-button
- v-if="
- scope.row.status === 'WAITING' && checkPrivilege('link', 'end')
- "
- class="btn-danger"
- type="text"
- @click="toCancel(scope.row)"
- >撤回提交</el-button
- >
- <el-button
- v-if="
- (scope.row.status === 'END' || scope.row.status === 'FINISH') &&
- checkPrivilege('link', 'normal')
- "
- :class="scope.row.normal ? 'btn-danger' : 'btn-primary'"
- type="text"
- @click="toNormal(scope.row)"
- >{{ scope.row.normal ? "作废" : "恢复" }}</el-button
- >
- <!-- <el-button
- class="btn-primary"
- type="text"
- @click="toPreview(scope.row)"
- >查看印品模板</el-button> -->
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total, sizes, prev, pager, next, jumper"
- :pager-count="5"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- @size-change="pageSizeChange"
- >
- </el-pagination>
- </div>
- </div>
- <!-- PreviewPrintTaskTemplate-->
- <preview-print-task-template
- :instance="curTask"
- ref="PreviewPrintTaskTemplate"
- ></preview-print-task-template>
- <!-- pdf-view -->
- <el-dialog
- class="pdf-view-dialog"
- :visible.sync="padViewDialogVisible"
- title="请选择PDF类型"
- top="10vh"
- width="600px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- >
- <div class="text-center">
- <el-button
- v-if="actionType === 'build'"
- size="large"
- @click="actionPdf({ type: undefined })"
- >全部</el-button
- >
- <el-button
- v-for="item in pdfList"
- :key="item.name"
- type="primary"
- size="large"
- @click="actionPdf(item)"
- >{{ item.type | printPdfTypeFilter }}</el-button
- >
- </div>
- <div slot="footer"></div>
- </el-dialog>
- <!-- data-task-dialog -->
- <data-task-dialog
- v-if="checkPrivilege('button', 'BatchDownload')"
- ref="DataTaskDialog"
- task-type="PRINT_PDF_DOWNLOAD"
- ></data-task-dialog>
- </div>
- </template>
- <script>
- import {
- printTaskListPage,
- submitPrintTask,
- resubmitPrintTask,
- cancelPrintTask,
- batchCancelPrintTask,
- printTaskTotalInfo,
- getPrintTaskPdf,
- downloadPrintTaskPdf,
- rebuildPrintTaskPdf,
- printTaskNormal,
- } from "../api";
- import { PRINT_TASK_STATUS } from "@/constants/enumerate";
- import pickerOptions from "@/constants/datePickerOptions";
- import { parseTimeRangeDateAndTime } from "@/plugins/utils";
- import PreviewPrintTaskTemplate from "../components/PreviewPrintTaskTemplate";
- export default {
- name: "print-task-manage",
- components: { PreviewPrintTaskTemplate },
- data() {
- return {
- filter: {
- semesterId: "",
- examId: "",
- printPlanId: "",
- printHouseId: "",
- status: "",
- courseCode: "",
- paperNumber: "",
- examPlace: "",
- examRoom: "",
- examStartTime: "",
- examEndTime: "",
- printStartTime: "",
- printEndTime: "",
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- totalInfo: {},
- dataList: [],
- curRow: {},
- multipleSelection: [],
- PRINT_TASK_STATUS,
- loading: false,
- // view-pdf
- padViewDialogVisible: false,
- pdfList: [],
- actionType: "view",
- // view-template
- curTask: {},
- // date-picker
- createTime: [],
- printTime: [],
- pickerOptions,
- };
- },
- mounted() {
- // this.search();
- },
- methods: {
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size,
- };
- if (this.createTime) {
- datas.examStartTime = this.createTime[0];
- datas.examEndTime = this.createTime[1];
- }
- if (this.printTime) {
- datas.printStartTime = this.printTime[0];
- datas.printEndTime = this.printTime[1];
- }
- const data = await printTaskListPage(datas);
- this.dataList = data.records.map((item) => {
- const { date, time } = parseTimeRangeDateAndTime(
- item.examStartTime,
- item.examEndTime
- );
- item.examDate = date || "--";
- item.examTime = time || "--";
- return item;
- });
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- this.multipleSelection = [];
- },
- search() {
- this.toPage(1);
- this.getTotalInfo();
- },
- printPlanChange() {
- this.filter.paperNumber = "";
- this.filter.courseCode = "";
- this.filter.examRoom = "";
- this.filter.examPlace = "";
- },
- async getTotalInfo() {
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size,
- };
- if (this.createTime) {
- datas.examStartTime = this.createTime[0];
- datas.examEndTime = this.createTime[1];
- }
- const data = await printTaskTotalInfo(datas);
- this.totalInfo = data || {};
- },
- handleSelectionChange(val) {
- this.multipleSelection = val.map((item) => item.examDetailId);
- },
- toPreview(row) {
- this.curTask = row;
- this.$refs.PreviewPrintTaskTemplate.open();
- },
- toSubmit(row) {
- this.$confirm("确定提交该印刷任务吗?", "提示", {
- type: "warning",
- })
- .then(async () => {
- const data = await submitPrintTask(row.examDetailId);
- if (!data) return;
- this.$message.success("提交成功!");
- this.getList();
- })
- .catch(() => {});
- },
- toResubmit(row) {
- this.$confirm("确定重新提交该印刷任务吗?", "提示", {
- type: "warning",
- })
- .then(async () => {
- const data = await resubmitPrintTask({
- id: row.examDetailId,
- printPlanId: row.printPlanId,
- });
- if (!data) return;
- this.$message.success("提交成功!");
- this.getList();
- })
- .catch(() => {});
- },
- toCancel(row) {
- this.$confirm("确定撤回该印刷任务的提交吗?", "提示", {
- type: "warning",
- })
- .then(async () => {
- const data = await cancelPrintTask(row.examDetailId);
- if (!data) return;
- this.$message.success("撤回成功!");
- this.getList();
- })
- .catch(() => {});
- },
- toBatchCancel() {
- if (!this.multipleSelection.length) {
- this.$message.error("请选择要撤回的记录!");
- return;
- }
- this.$confirm("确定撤回选中的印刷任务的提交吗?", "提示", {
- type: "warning",
- })
- .then(async () => {
- const data = await batchCancelPrintTask(
- this.multipleSelection.join()
- );
- if (!data) return;
- this.$message.success("撤回成功!");
- this.getList();
- })
- .catch(() => {});
- },
- async toActionPdf(row, actionType) {
- this.curTask = row;
- this.actionType = actionType;
- this.pdfList = [];
- let result = true;
- const data = await getPrintTaskPdf(row.examDetailId).catch(() => {
- result = false;
- });
- if (!result) return;
- if (!data || !data.length) {
- this.$message.error("当前任务pdf还未生成好,请稍后再试!");
- return;
- }
- if (data.length === 1) {
- this.actionPdf(data[0]);
- } else {
- this.pdfList = data;
- this.padViewDialogVisible = true;
- }
- },
- actionPdf(item) {
- if (this.actionType === "view") {
- this.viewPdf(item);
- } else {
- this.rebuildPdf(item);
- }
- },
- async rebuildPdf(item) {
- const action = await this.$confirm(
- `确定要重新生成该印刷任务PDF吗?`,
- "提示",
- {
- type: "warning",
- }
- ).catch(() => {});
- if (action !== "confirm") return;
- const res = await rebuildPrintTaskPdf(this.curTask.taskId, item.type);
- if (!res) return;
- this.$message.success("操作成功!");
- },
- viewPdf(item) {
- window.open(item.url);
- // this.padViewDialogVisible = false;
- },
- async toExport() {
- if (this.loading) return;
- if (!this.multipleSelection.length) {
- this.$message.error("请选择要下载的记录!");
- return;
- }
- this.loading = true;
- const data = await downloadPrintTaskPdf(this.multipleSelection).catch(
- () => {}
- );
- this.loading = false;
- if (!data) return;
- this.$message.success("文件下载任务提交成功!");
- },
- toDataTask() {
- this.$refs.DataTaskDialog.open();
- },
- async toNormal(row) {
- const typeName = row.normal ? "作废" : "恢复";
- const action = await this.$confirm(
- `确定${typeName}该印刷任务吗?`,
- "提示",
- {
- type: "warning",
- }
- ).catch(() => {});
- if (action !== "confirm") return;
- const data = await printTaskNormal({
- id: row.examDetailId,
- normal: !row.normal,
- });
- if (!data) return;
- row.normal = !row.normal;
- this.$message.success("撤回成功!");
- },
- },
- };
- </script>
|