|
@@ -0,0 +1,275 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ class="publish-print-task"
|
|
|
+ :visible.sync="modalIsShow"
|
|
|
+ title="发布印刷任务"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ fullscreen
|
|
|
+ @opened="visibleChange"
|
|
|
+ >
|
|
|
+ <div class="part-box part-box-pad part-box-border">
|
|
|
+ <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
|
|
|
+ <el-form-item label="印刷计划:">
|
|
|
+ <print-plan-select
|
|
|
+ v-model.trim="filter.printPlanId"
|
|
|
+ placeholder="请选择"
|
|
|
+ clearable
|
|
|
+ @change="printPlanChange"
|
|
|
+ ></print-plan-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="考试时间:">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="createTime"
|
|
|
+ type="datetimerange"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="timeDisabled"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ value-format="timestamp"
|
|
|
+ align="right"
|
|
|
+ unlink-panels
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="part-box">
|
|
|
+ <el-button type="primary" @click="toAdd">增加考试对象</el-button>
|
|
|
+ <el-table ref="TableList" :data="tableData" border stripe>
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ width="70"
|
|
|
+ align="center"
|
|
|
+ label="卷袋序号"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="examRoom" label="考场"> </el-table-column>
|
|
|
+ <el-table-column prop="examPlace" label="考点"> </el-table-column>
|
|
|
+ <el-table-column prop="invigilatorTeacher" label="监考老师">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="clazzName" label="考试对象"> </el-table-column>
|
|
|
+ <el-table-column prop="studentCount" label="人数"> </el-table-column>
|
|
|
+ <el-table-column prop="printHouseName" label="印刷室">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-for="item in extendFields"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.name"
|
|
|
+ >
|
|
|
+ <div slot-scope="scope">
|
|
|
+ {{ scope.row[item.code] }}
|
|
|
+ </div>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ class="btn-table-icon"
|
|
|
+ type="text"
|
|
|
+ icon="icon icon-circle-right"
|
|
|
+ @click="toPreview(scope.row)"
|
|
|
+ title="考生明细"
|
|
|
+ ></el-button>
|
|
|
+ <el-button
|
|
|
+ class="btn-table-icon"
|
|
|
+ type="text"
|
|
|
+ icon="icon icon-circle-right"
|
|
|
+ @click="toEdit(scope.row)"
|
|
|
+ title="编辑"
|
|
|
+ ></el-button>
|
|
|
+ <el-button
|
|
|
+ class="btn-table-icon"
|
|
|
+ type="text"
|
|
|
+ icon="icon icon-circle-right"
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ title="删除"
|
|
|
+ ></el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="part-page">
|
|
|
+ <el-pagination
|
|
|
+ v-if="papers.length"
|
|
|
+ background
|
|
|
+ layout="total,prev, pager, next"
|
|
|
+ :current-page="current"
|
|
|
+ :total="total"
|
|
|
+ :page-size="size"
|
|
|
+ @current-change="toPage"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div slot="footer"></div>
|
|
|
+
|
|
|
+ <!-- CreatePrintTask -->
|
|
|
+ <create-print-task
|
|
|
+ ref="CreatePrintTask"
|
|
|
+ :instance="curRow"
|
|
|
+ :clazz="validClazzes"
|
|
|
+ :extend-fields="extendFields"
|
|
|
+ @modified="getList"
|
|
|
+ ></create-print-task>
|
|
|
+ <!-- PrintTaskStudents -->
|
|
|
+ <print-task-students
|
|
|
+ ref="PrintTaskStudents"
|
|
|
+ :class-id="curClassId"
|
|
|
+ ></print-task-students>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listTaskPrint, removeTaskPrint, listTaskPrintClass } from "../api";
|
|
|
+import { examRuleDetail } from "../../base/api";
|
|
|
+import pickerOptions from "@/constants/datePickerOptions";
|
|
|
+import CreatePrintTask from "./CreatePrintTask";
|
|
|
+import PrintTaskStudents from "./PrintTaskStudents";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "publish-print-task",
|
|
|
+ components: { CreatePrintTask, PrintTaskStudents },
|
|
|
+ props: {
|
|
|
+ instance: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ modalIsShow: false,
|
|
|
+ isSubmit: false,
|
|
|
+ filter: {
|
|
|
+ printPlanId: "",
|
|
|
+ examStartTime: "",
|
|
|
+ examEndTime: "",
|
|
|
+ paperNumber: "",
|
|
|
+ courseName: "",
|
|
|
+ courseCode: ""
|
|
|
+ },
|
|
|
+ timeDisabled: false,
|
|
|
+ tableData: [],
|
|
|
+ curRow: {},
|
|
|
+ printRooms: [],
|
|
|
+ teachers: [],
|
|
|
+ clazzs: [],
|
|
|
+ curClassId: "",
|
|
|
+ validClazzes: [],
|
|
|
+ extendFields: [],
|
|
|
+ // date-picker
|
|
|
+ createTime: [],
|
|
|
+ pickerOptions
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getExtendFields();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ visibleChange() {
|
|
|
+ this.filter = this.$objAssign(this.filter, this.instance);
|
|
|
+ this.getClazzs();
|
|
|
+ },
|
|
|
+ async getExtendFields() {
|
|
|
+ const examRule = await examRuleDetail();
|
|
|
+ this.extendFields = JSON.parse(examRule.extendFields);
|
|
|
+ },
|
|
|
+ async getClazzs() {
|
|
|
+ this.clazzs = await listTaskPrintClass({
|
|
|
+ printPlanId: this.filter.printPlanId,
|
|
|
+ courseCode: this.instance.courseCode,
|
|
|
+ paperNumber: this.instance.paperNumber
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async getList() {
|
|
|
+ const datas = {
|
|
|
+ printPlanId: this.filter.printPlanId,
|
|
|
+ courseCode: this.instance.courseCode,
|
|
|
+ paperNumber: this.instance.paperNumber,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await listTaskPrint(datas);
|
|
|
+ if (data.iPage) {
|
|
|
+ this.tableData = data.iPage.records.map(item => {
|
|
|
+ item.extendFields.forEach(field => {
|
|
|
+ item[field.code] = field.value;
|
|
|
+ });
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.total = data.iPage.total;
|
|
|
+ }
|
|
|
+ if (data.examStartTime && data.examEndTime) {
|
|
|
+ this.createTime = [data.examStartTime, data.examEndTime];
|
|
|
+ this.filter.examStartTime = this.createTime[0];
|
|
|
+ this.filter.examEndTime = this.createTime[1];
|
|
|
+ this.timeDisabled = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ printPlanChange(val) {
|
|
|
+ this.filter.printPlanName = val.name;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.modalIsShow = false;
|
|
|
+ },
|
|
|
+ open() {
|
|
|
+ this.modalIsShow = true;
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ let item = {
|
|
|
+ examPlace: "",
|
|
|
+ examRoom: "",
|
|
|
+ invigilatorTeacher: "",
|
|
|
+ classId: "",
|
|
|
+ className: "",
|
|
|
+ studentCount: 1,
|
|
|
+ printHouseId: null,
|
|
|
+ ...this.filter
|
|
|
+ };
|
|
|
+ this.extendFields.forEach(field => {
|
|
|
+ item[field.code] = "";
|
|
|
+ });
|
|
|
+ this.curRow = item;
|
|
|
+ let unvalidClazzs = [];
|
|
|
+ this.tableData.forEach(item => {
|
|
|
+ unvalidClazzs = [...unvalidClazzs, ...item.classId.split(",")];
|
|
|
+ });
|
|
|
+ this.validClazzes = this.clazzs.filter(
|
|
|
+ item => !unvalidClazzs.includes(item.classId)
|
|
|
+ );
|
|
|
+ this.$refs.CreatePrintTask.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curRow = { ...row };
|
|
|
+ let unvalidClazzs = [];
|
|
|
+ this.tableData
|
|
|
+ .filter(item => item.id !== row.id)
|
|
|
+ .forEach(item => {
|
|
|
+ unvalidClazzs = [...unvalidClazzs, ...item.classId.split(",")];
|
|
|
+ });
|
|
|
+ this.validClazzes = this.clazzs.filter(
|
|
|
+ item => !unvalidClazzs.includes(item.classId)
|
|
|
+ );
|
|
|
+ this.$refs.CreatePrintTask.open();
|
|
|
+ },
|
|
|
+ toPreview(row) {
|
|
|
+ this.curClassId = row.classId;
|
|
|
+ this.$refs.PrintTaskStudents.open();
|
|
|
+ },
|
|
|
+ async toDelete(row) {
|
|
|
+ await removeTaskPrint(row.id);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+
|
|
|
+ const pos = this.tableData.findIndex(item => item.id === row.id);
|
|
|
+ this.tableData.splice(pos, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|