|
@@ -15,35 +15,64 @@
|
|
|
clearable
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="examCodeTemp" label="考务文件:">
|
|
|
+ <el-form-item prop="examPlanCodeTemp" label="考试计划表:">
|
|
|
<upload-file-view
|
|
|
- :upload-url="uploadUrl"
|
|
|
+ :upload-url="uploadExamPlanUrl"
|
|
|
:upload-data="uploadData"
|
|
|
+ :disabled="!canEdit"
|
|
|
@upload-error="uplaodError"
|
|
|
- @upload-success="uploadSuccess"
|
|
|
- ref="UploadFileView"
|
|
|
+ @upload-success="uploadExamPlanSuccess"
|
|
|
+ ref="ExamPlanUploadFileView"
|
|
|
></upload-file-view>
|
|
|
- <el-button @click="toPreview" style="margin-left:16px;">预览</el-button>
|
|
|
+ <el-button @click="toPreviewExamPlan" style="margin-left:16px;"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
- icon="icon icon-plus"
|
|
|
+ icon="icon icon-download"
|
|
|
style="margin-left:10px;"
|
|
|
>
|
|
|
- <a :href="downloadUrl" download="考务导入模板.xlsx">考务模板下载</a>
|
|
|
+ <a :href="planDownloadUrl" download="考试计划导入模板.xlsx"
|
|
|
+ >考试计划导入模板下载</a
|
|
|
+ >
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="考试开始时间:">
|
|
|
- <p class="form-item-content" v-if="modalForm.beginTime">
|
|
|
- {{ modalForm.beginTime }}
|
|
|
- </p>
|
|
|
- <p class="color-info" v-else>请上传考务文件</p>
|
|
|
+ <el-form-item label="考务编排文件:">
|
|
|
+ <upload-file-view
|
|
|
+ :upload-url="uploadExamBusinessUrl"
|
|
|
+ :upload-data="uploadData"
|
|
|
+ @upload-error="uplaodError"
|
|
|
+ @upload-success="uploadExamBusinessSuccess"
|
|
|
+ ref="ExamBusinessUploadFileView"
|
|
|
+ ></upload-file-view>
|
|
|
+ <el-button @click="toPreviewExamBusiness" style="margin-left:16px;"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ icon="icon icon-download"
|
|
|
+ style="margin-left:10px;"
|
|
|
+ >
|
|
|
+ <a :href="businessDownloadUrl" download="考务编排导入模板.xlsx"
|
|
|
+ >考务编排导入模板下载</a
|
|
|
+ >
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="beginTime" label="考试开始时间:">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="modalForm.beginTime"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="printTime" label="打印时间:">
|
|
|
<el-date-picker
|
|
|
v-model="modalForm.printTime"
|
|
|
type="datetime"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- placeholder="请选择日期"
|
|
|
+ placeholder="请选择时间"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
@@ -123,7 +152,12 @@
|
|
|
</el-popover>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="teacher" label="指派命题老师:">
|
|
|
- <el-table :data="courses" style="width: 420px;" border stripe>
|
|
|
+ <el-table
|
|
|
+ class="el-table--noback"
|
|
|
+ :data="courses"
|
|
|
+ style="width: 420px;"
|
|
|
+ border
|
|
|
+ >
|
|
|
<el-table-column prop="courseName" label="科目"></el-table-column>
|
|
|
<el-table-column label="命题老师" width="180px">
|
|
|
<template slot-scope="scope">
|
|
@@ -132,6 +166,7 @@
|
|
|
size="small"
|
|
|
style="width: 156px;"
|
|
|
placeholder="请选择"
|
|
|
+ :disabled="!scope.row.canEdit"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="user in scope.row.users"
|
|
@@ -159,6 +194,8 @@
|
|
|
:exam-code="modalForm.examCodeTemp"
|
|
|
ref="BusinessData"
|
|
|
></business-data>
|
|
|
+ <!-- exam-plan -->
|
|
|
+ <exam-plan-data :datas="courses" ref="ExamPlanData"></exam-plan-data>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -170,11 +207,12 @@ import {
|
|
|
} from "@/constants/enumerate";
|
|
|
import { uploadExam, examDetail } from "../api";
|
|
|
import BusinessData from "../components/BusinessData";
|
|
|
+import ExamPlanData from "../components/ExamPlanData";
|
|
|
import UploadFileView from "../components/UploadFileView";
|
|
|
|
|
|
export default {
|
|
|
name: "exam-modify",
|
|
|
- components: { BusinessData, UploadFileView },
|
|
|
+ components: { BusinessData, ExamPlanData, UploadFileView },
|
|
|
data() {
|
|
|
const printTimeValidator = (rule, value, callback) => {
|
|
|
if (!this.checkDateRangeValid(value, this.modalForm.beginTime)) {
|
|
@@ -206,6 +244,7 @@ export default {
|
|
|
return {
|
|
|
examId: this.$route.params.examId,
|
|
|
modalForm: {
|
|
|
+ id: null,
|
|
|
examName: "",
|
|
|
beginTime: "",
|
|
|
printTime: "",
|
|
@@ -213,6 +252,8 @@ export default {
|
|
|
backup: 0,
|
|
|
review: 0,
|
|
|
backupCard: "",
|
|
|
+ examPlanCodeTemp: "",
|
|
|
+ examPlanAttachmentId: "",
|
|
|
examCodeTemp: "",
|
|
|
attachmentId: ""
|
|
|
},
|
|
@@ -224,10 +265,17 @@ export default {
|
|
|
trigger: "change"
|
|
|
}
|
|
|
],
|
|
|
- examCodeTemp: [
|
|
|
+ examPlanCodeTemp: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请上传考务文件",
|
|
|
+ message: "请上传考试计划表",
|
|
|
+ trigger: "change"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ beginTime: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择考试开始时间",
|
|
|
trigger: "change"
|
|
|
}
|
|
|
],
|
|
@@ -279,9 +327,12 @@ export default {
|
|
|
printContentCheckAll: false,
|
|
|
courses: [],
|
|
|
isSubmit: false,
|
|
|
- downloadUrl: this.GLOBAL.domain + "/temps/考务导入模板.xlsx",
|
|
|
+ canEdit: true,
|
|
|
+ planDownloadUrl: this.GLOBAL.domain + "/temps/考试计划导入模板.xlsx",
|
|
|
+ businessDownloadUrl: this.GLOBAL.domain + "/temps/考务编排导入模板.xlsx",
|
|
|
// import
|
|
|
- uploadUrl: "/api/print/exam/exam/impExamData",
|
|
|
+ uploadExamPlanUrl: "/api/print/exam/exam/impExamPlanData",
|
|
|
+ uploadExamBusinessUrl: "/api/print/exam/exam/impExamData",
|
|
|
uploadData: {
|
|
|
examId: ""
|
|
|
}
|
|
@@ -304,15 +355,27 @@ export default {
|
|
|
methods: {
|
|
|
async getExamDetail() {
|
|
|
const data = await examDetail(this.examId);
|
|
|
- this.modalForm = Object.assign({}, this.modalForm, data.tcPExam);
|
|
|
+ this.modalForm = this.$objAssign(this.modalForm, data.tcPExam);
|
|
|
this.modalForm.printContent = this.printContentAll.filter(
|
|
|
key => data.tcPExam[key]
|
|
|
);
|
|
|
- this.courses = data.userCourses;
|
|
|
+ this.courses = data.userCourses.map(item => {
|
|
|
+ item.canEdit = item.status === "未开始";
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.canEdit = !this.courses.some(item => !item.canEdit);
|
|
|
this.handleCheckedChange();
|
|
|
- this.$refs.UploadFileView.setAttachmentName(
|
|
|
- `${data.tcPAttachment.name}${data.tcPAttachment.type}`
|
|
|
+ this.$refs.ExamPlanUploadFileView.setAttachmentName(
|
|
|
+ `${data.tcPPlanAttachment.name}${data.tcPPlanAttachment.type}`
|
|
|
);
|
|
|
+ if (
|
|
|
+ data.tcPAttachment &&
|
|
|
+ data.tcPAttachment["name"] &&
|
|
|
+ data.tcPAttachment["type"]
|
|
|
+ )
|
|
|
+ this.$refs.ExamBusinessUploadFileView.setAttachmentName(
|
|
|
+ `${data.tcPAttachment.name}${data.tcPAttachment.type}`
|
|
|
+ );
|
|
|
},
|
|
|
checkDateRangeValid(startTime, endTime) {
|
|
|
if (startTime && endTime) {
|
|
@@ -334,8 +397,8 @@ export default {
|
|
|
this.modalForm.printContent.length === this.printContentAll.length;
|
|
|
},
|
|
|
async save() {
|
|
|
- // const valid = await this.$refs["ModalForm"].validate().catch(() => {});
|
|
|
- // if (!valid) return;
|
|
|
+ const valid = await this.$refs["ModalForm"].validate().catch(() => {});
|
|
|
+ if (!valid) return;
|
|
|
|
|
|
if (this.isSubmit) return;
|
|
|
this.isSubmit = true;
|
|
@@ -363,9 +426,16 @@ export default {
|
|
|
this.$message.success("保存成功!");
|
|
|
this.goback();
|
|
|
},
|
|
|
- toPreview() {
|
|
|
+ toPreviewExamPlan() {
|
|
|
+ if (!this.modalForm.examPlanCodeTemp) {
|
|
|
+ this.$message.error("请先上传考试计划表!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs.ExamPlanData.open();
|
|
|
+ },
|
|
|
+ toPreviewExamBusiness() {
|
|
|
if (!this.modalForm.examCodeTemp) {
|
|
|
- this.$message.error("请先上传考务文件!");
|
|
|
+ this.$message.error("请先上传考试计划表!");
|
|
|
return;
|
|
|
}
|
|
|
this.$refs.BusinessData.open();
|
|
@@ -374,19 +444,26 @@ export default {
|
|
|
uplaodError(errorData) {
|
|
|
this.$notify.error({ title: "错误提示", message: errorData.message });
|
|
|
},
|
|
|
- uploadSuccess(res) {
|
|
|
+ uploadExamPlanSuccess(res) {
|
|
|
this.$message.success("上传成功!");
|
|
|
const data = res.data;
|
|
|
|
|
|
- this.modalForm.beginTime = data.startTime;
|
|
|
- this.modalForm.examCodeTemp = data.examCode;
|
|
|
- this.modalForm.attachmentId = data.attachmentId;
|
|
|
- this.$refs["ModalForm"].validateField("examCodeTemp");
|
|
|
+ this.modalForm.examPlanCodeTemp = data.examPlanCodeTemp;
|
|
|
+ this.modalForm.examPlanAttachmentId = data.attachmentId;
|
|
|
+ this.$refs["ModalForm"].validateField("examPlanCodeTemp");
|
|
|
|
|
|
this.courses = data.userCourses.map(item => {
|
|
|
item.teacherId = item.users.length === 1 ? item.users[0].id + "" : "";
|
|
|
return item;
|
|
|
});
|
|
|
+ },
|
|
|
+ uploadExamBusinessSuccess(res) {
|
|
|
+ this.$message.success("上传成功!");
|
|
|
+ const data = res.data;
|
|
|
+
|
|
|
+ this.modalForm.examCodeTemp = data.examCode;
|
|
|
+ this.modalForm.attachmentId = data.attachmentId;
|
|
|
+ this.$refs["ModalForm"].validateField("examCodeTemp");
|
|
|
}
|
|
|
}
|
|
|
};
|