|
@@ -12,8 +12,8 @@
|
|
>
|
|
>
|
|
<div class="part-box part-box-pad part-box-border">
|
|
<div class="part-box part-box-pad part-box-border">
|
|
<el-form
|
|
<el-form
|
|
- ref="modalFormComp"
|
|
|
|
- :model="modalForm"
|
|
|
|
|
|
+ ref="examTaskComp"
|
|
|
|
+ :model="examTask"
|
|
:rules="rules"
|
|
:rules="rules"
|
|
label-width="100px"
|
|
label-width="100px"
|
|
>
|
|
>
|
|
@@ -21,13 +21,17 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item prop="teachingRoomId" label="教研室:">
|
|
<el-form-item prop="teachingRoomId" label="教研室:">
|
|
<teaching-room-select
|
|
<teaching-room-select
|
|
- v-model="modalForm.teachingRoomId"
|
|
|
|
|
|
+ v-model="examTask.teachingRoomId"
|
|
|
|
+ @change="clearCard"
|
|
></teaching-room-select>
|
|
></teaching-room-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item prop="courseCode" label="课程(代码):">
|
|
<el-form-item prop="courseCode" label="课程(代码):">
|
|
- <course-select v-model="modalForm.courseCode"></course-select>
|
|
|
|
|
|
+ <course-select
|
|
|
|
+ v-model="examTask.courseCode"
|
|
|
|
+ @change="clearCard"
|
|
|
|
+ ></course-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -36,9 +40,10 @@
|
|
<el-form-item prop="cardRuleId" label="题卡规则:">
|
|
<el-form-item prop="cardRuleId" label="题卡规则:">
|
|
<card-rule-select
|
|
<card-rule-select
|
|
ref="CardRuleSelect"
|
|
ref="CardRuleSelect"
|
|
- v-model.trim="modalForm.cardRuleId"
|
|
|
|
|
|
+ v-model.trim="examTask.cardRuleId"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
clearable
|
|
clearable
|
|
|
|
+ @change="clearCard"
|
|
></card-rule-select>
|
|
></card-rule-select>
|
|
<p class="tips-info">
|
|
<p class="tips-info">
|
|
说明:若选择全部通卡,则命题老师只能选择通卡,若选择题卡规则,则专卡和通卡均可选择
|
|
说明:若选择全部通卡,则命题老师只能选择通卡,若选择题卡规则,则专卡和通卡均可选择
|
|
@@ -48,7 +53,7 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="试卷编号:">
|
|
<el-form-item label="试卷编号:">
|
|
<el-input
|
|
<el-input
|
|
- v-model.trim="modalForm.paperNumber"
|
|
|
|
|
|
+ v-model.trim="examTask.paperNumber"
|
|
placeholder="请输入试卷编号"
|
|
placeholder="请输入试卷编号"
|
|
clearable
|
|
clearable
|
|
></el-input>
|
|
></el-input>
|
|
@@ -59,7 +64,7 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="拟卷教师:">
|
|
<el-form-item label="拟卷教师:">
|
|
<el-input
|
|
<el-input
|
|
- v-model.trim="modalForm.paperNumber"
|
|
|
|
|
|
+ v-model.trim="examTask.teacherName"
|
|
placeholder="请输入拟卷教师"
|
|
placeholder="请输入拟卷教师"
|
|
clearable
|
|
clearable
|
|
></el-input>
|
|
></el-input>
|
|
@@ -68,7 +73,7 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="主讲教师/电话:">
|
|
<el-form-item label="主讲教师/电话:">
|
|
<el-input
|
|
<el-input
|
|
- v-model.trim="modalForm.paperNumber"
|
|
|
|
|
|
+ v-model.trim="examTask.lecturerName"
|
|
placeholder="请输入主讲教师/电话"
|
|
placeholder="请输入主讲教师/电话"
|
|
clearable
|
|
clearable
|
|
></el-input>
|
|
></el-input>
|
|
@@ -90,32 +95,236 @@
|
|
</el-steps>
|
|
</el-steps>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div class="part-box part-box-pad part-box-border" v-if="modalIsShow">
|
|
|
|
- <apply-content
|
|
|
|
- ref="ApplyContent"
|
|
|
|
- :exam-task="modalForm"
|
|
|
|
- :edit-type="editType"
|
|
|
|
- @cancel="cancel"
|
|
|
|
- @modified="modified"
|
|
|
|
- ></apply-content>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="part-box part-box-pad part-box-border apply-content task-detail"
|
|
|
|
+ v-if="modalIsShow"
|
|
|
|
+ >
|
|
|
|
+ <p class="tips-info tips-dark mb-2">
|
|
|
|
+ 提示:多卷型试卷由于会绑定一个答题卡模板,因此试卷结构必须相同。多卷型试卷之间客观题要求试题内容相同,可允许大题内的小题题序不同。
|
|
|
|
+ </p>
|
|
|
|
+ <div class="task-body">
|
|
|
|
+ <div class="mb-2 text-right">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
|
+ @click="addAtachment"
|
|
|
|
+ >增加卷型</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <table class="table">
|
|
|
|
+ <tr>
|
|
|
|
+ <th>试卷类型</th>
|
|
|
|
+ <th>试卷文件</th>
|
|
|
|
+ <th>答题卡创建方式</th>
|
|
|
|
+ <th>答题卡</th>
|
|
|
|
+ <th>操作</th>
|
|
|
|
+ </tr>
|
|
|
|
+ <tr v-for="(attachment, index) in paperAttachments" :key="index">
|
|
|
|
+ <td>{{ attachment.name }}卷</td>
|
|
|
|
+ <td class="td-link">
|
|
|
|
+ <span @click="toUpload(attachment)" title="点击上传试卷">
|
|
|
|
+ <i
|
|
|
|
+ :class="[
|
|
|
|
+ 'icon',
|
|
|
|
+ attachment.attachmentId ? 'icon-files-act' : 'icon-files'
|
|
|
|
+ ]"
|
|
|
|
+ ></i
|
|
|
|
+ >{{
|
|
|
|
+ attachment.attachmentId
|
|
|
|
+ ? attachment.filename
|
|
|
|
+ : "点击上传试卷文件"
|
|
|
|
+ }}
|
|
|
|
+ </span>
|
|
|
|
+ </td>
|
|
|
|
+ <td>{{ createCardTypeName }}</td>
|
|
|
|
+ <td
|
|
|
|
+ class="td-link"
|
|
|
|
+ :rowspan="paperAttachments.length"
|
|
|
|
+ v-if="index === 0"
|
|
|
|
+ >
|
|
|
|
+ <span @click="toCreateOrViewCard"
|
|
|
|
+ ><i class="icon icon-plus-act"></i>{{ cardTodoName }}</span
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="examTaskDetail.makeMethod"
|
|
|
|
+ size="mini"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="changeCreateCardType"
|
|
|
|
+ >切换题卡创建方式</el-button
|
|
|
|
+ >
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ <el-button
|
|
|
|
+ class="btn-table-icon"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="icon icon-delete"
|
|
|
|
+ title="删除"
|
|
|
|
+ @click="deleteAttachment(index)"
|
|
|
|
+ ></el-button>
|
|
|
|
+ </td>
|
|
|
|
+ </tr>
|
|
|
|
+ </table>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="单次抽卷卷型数量:" label-width="150">
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="examTaskDetail.drawCount"
|
|
|
|
+ :min="1"
|
|
|
|
+ :max="maxFetchCount"
|
|
|
|
+ :step="1"
|
|
|
|
+ step-strictly
|
|
|
|
+ :controls="false"
|
|
|
|
+ ></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <h4 class="mb-2">备注说明:</h4>
|
|
|
|
+ <el-input
|
|
|
|
+ class="mb-2"
|
|
|
|
+ v-model="examTaskDetail.remark"
|
|
|
|
+ type="textarea"
|
|
|
|
+ resize="none"
|
|
|
|
+ :rows="2"
|
|
|
|
+ :maxlength="100"
|
|
|
|
+ clearable
|
|
|
|
+ show-word-limit
|
|
|
|
+ placeholder="建议不超过100个字"
|
|
|
|
+ :disabled="!IS_APPLY"
|
|
|
|
+ ></el-input>
|
|
|
|
+
|
|
|
|
+ <h4 class="mb-2">上传入库审核表(最多4张)</h4>
|
|
|
|
+ <div class="image-list">
|
|
|
|
+ <div
|
|
|
|
+ class="image-item"
|
|
|
|
+ v-for="(img, index) in paperConfirmAttachments"
|
|
|
|
+ :key="index"
|
|
|
|
+ >
|
|
|
|
+ <img
|
|
|
|
+ :src="img.url"
|
|
|
|
+ :alt="img.filename"
|
|
|
|
+ title="点击查看大图"
|
|
|
|
+ @click="toPreview(index)"
|
|
|
|
+ />
|
|
|
|
+ <div class="image-delete">
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-delete-solid"
|
|
|
|
+ @click="deletePaperConfirmAttachment(index)"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div
|
|
|
|
+ v-if="paperConfirmAttachments.length < 4 && IS_APPLY"
|
|
|
|
+ class="image-item image-add"
|
|
|
|
+ title="上传入库审核表"
|
|
|
|
+ @click="toUploadPaperConfirm"
|
|
|
|
+ >
|
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
+ <!-- audit -->
|
|
|
|
+ <h4 v-if="IS_AUDIT" class="mb-2">审核意见:</h4>
|
|
|
|
+ <el-input
|
|
|
|
+ v-if="IS_AUDIT"
|
|
|
|
+ class="mb-2"
|
|
|
|
+ v-model="reason"
|
|
|
|
+ type="textarea"
|
|
|
|
+ resize="none"
|
|
|
|
+ :rows="5"
|
|
|
|
+ :maxlength="1000"
|
|
|
|
+ clearable
|
|
|
|
+ show-word-limit
|
|
|
|
+ placeholder="建议不超过1000个字"
|
|
|
|
+ ref="ReasonInput"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="task-action">
|
|
|
|
+ <el-button type="primary" :disabled="isSubmit" @click="submit"
|
|
|
|
+ >确认提交</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ :disabled="isSubmit"
|
|
|
|
+ style="width:88px;"
|
|
|
|
+ @click="toSave"
|
|
|
|
+ >暂存</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="IS_AUDIT"
|
|
|
|
+ type="primary"
|
|
|
|
+ :disabled="isSubmit"
|
|
|
|
+ @click="toAuditApply('PASS')"
|
|
|
|
+ >通过</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="IS_AUDIT"
|
|
|
|
+ type="danger"
|
|
|
|
+ plain
|
|
|
|
+ @click="toAuditApply('NOT_PASS')"
|
|
|
|
+ >不通过</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="danger" @click="cancel" plain>取消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<div slot="footer"></div>
|
|
<div slot="footer"></div>
|
|
|
|
+
|
|
|
|
+ <!-- upload-paper-dialog -->
|
|
|
|
+ <upload-paper-dialog
|
|
|
|
+ :paper-attachment="curAttachment"
|
|
|
|
+ :upload-type="curUploadType"
|
|
|
|
+ @confirm="uploadConfirm"
|
|
|
|
+ ref="UploadPaperDialog"
|
|
|
|
+ ></upload-paper-dialog>
|
|
|
|
+ <!-- card-option-dialog -->
|
|
|
|
+ <card-option-dialog
|
|
|
|
+ ref="CardOptionDialog"
|
|
|
|
+ :data="task"
|
|
|
|
+ @upload-sample-over="initData"
|
|
|
|
+ @draft-task="silentSave"
|
|
|
|
+ @confirm="cardConfirm"
|
|
|
|
+ ></card-option-dialog>
|
|
|
|
+ <!-- image-preview -->
|
|
|
|
+ <simple-image-preview
|
|
|
|
+ :cur-image="curImage"
|
|
|
|
+ @on-prev="toPrevImage"
|
|
|
|
+ @on-next="toNextImage"
|
|
|
|
+ ref="SimpleImagePreview"
|
|
|
|
+ ></simple-image-preview>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import ApplyContent from "./ApplyContent";
|
|
|
|
import { examRuleDetail } from "../../base/api";
|
|
import { examRuleDetail } from "../../base/api";
|
|
|
|
+import { teacherCreateTaskApply, switchCardCreateMethod } from "../api";
|
|
|
|
+import UploadPaperDialog from "./UploadPaperDialog";
|
|
|
|
+import CardOptionDialog from "./CardOptionDialog";
|
|
|
|
+import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
|
+import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
|
|
|
|
|
|
-const initModalForm = {
|
|
|
|
|
|
+const initExamTask = {
|
|
id: null,
|
|
id: null,
|
|
courseCode: "",
|
|
courseCode: "",
|
|
courseName: "",
|
|
courseName: "",
|
|
paperNumber: "",
|
|
paperNumber: "",
|
|
cardRuleId: "",
|
|
cardRuleId: "",
|
|
- userId: "",
|
|
|
|
- userName: ""
|
|
|
|
|
|
+ teachingRoomId: "",
|
|
|
|
+ teacherName: "",
|
|
|
|
+ lecturerName: ""
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const initExamTaskDetail = {
|
|
|
|
+ operateType: "",
|
|
|
|
+ paperType: "A",
|
|
|
|
+ cardId: "",
|
|
|
|
+ paperAttachmentIds: [],
|
|
|
|
+ paperConfirmAttachmentIds: [],
|
|
|
|
+ drawCount: 2,
|
|
|
|
+ remark: "",
|
|
|
|
+ makeMethod: "",
|
|
|
|
+ // 题卡状态
|
|
|
|
+ status: "",
|
|
|
|
+ // 考务规则
|
|
|
|
+ review: false,
|
|
|
|
+ includePaper: false,
|
|
|
|
+ customCard: false
|
|
};
|
|
};
|
|
|
|
|
|
const STEPS = [
|
|
const STEPS = [
|
|
@@ -174,16 +383,15 @@ const STEPS = [
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "create-task-apply",
|
|
name: "create-task-apply",
|
|
- components: { ApplyContent },
|
|
|
|
|
|
+ components: { UploadPaperDialog, CardOptionDialog, SimpleImagePreview },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
- modalForm: {},
|
|
|
|
|
|
+ examTask: {},
|
|
needReview: false,
|
|
needReview: false,
|
|
examRule: {},
|
|
examRule: {},
|
|
steps: [],
|
|
steps: [],
|
|
actStep: "",
|
|
actStep: "",
|
|
- editType: "APPLY",
|
|
|
|
rules: {
|
|
rules: {
|
|
teachingRoomId: [
|
|
teachingRoomId: [
|
|
{
|
|
{
|
|
@@ -206,9 +414,46 @@ export default {
|
|
trigger: "change"
|
|
trigger: "change"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ // exam-task-detail
|
|
|
|
+ examTaskDetail: {},
|
|
|
|
+ paperConfirmAttachmentId: { attachmentId: "", filename: "", url: "" },
|
|
|
|
+ paperAttachments: [],
|
|
|
|
+ paperConfirmAttachments: [],
|
|
|
|
+ curAttachment: {},
|
|
|
|
+ curUploadType: "paper",
|
|
|
|
+ attachmentLimitCount: 26,
|
|
|
|
+ abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
|
|
|
|
+ // image-preview
|
|
|
|
+ curImage: {},
|
|
|
|
+ curImageIndex: 0
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ cardTodoName() {
|
|
|
|
+ let name = "创建答题卡";
|
|
|
|
+ if (this.curTaskApply.cardId) {
|
|
|
|
+ if (this.curTaskApply.makeMethod === "SELECT") {
|
|
|
|
+ name = "选择题卡";
|
|
|
|
+ } else if (this.curTaskApply.makeMethod === "SELF") {
|
|
|
|
+ name = "编辑题卡";
|
|
|
|
+ } else {
|
|
|
|
+ // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
|
|
|
|
+ name =
|
|
|
|
+ this.curTaskApply.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return name;
|
|
|
|
+ },
|
|
|
|
+ createCardTypeName() {
|
|
|
|
+ return CARD_SOURCE_TYPE[this.curTaskApply.makeMethod] || "";
|
|
|
|
+ },
|
|
|
|
+ maxFetchCount() {
|
|
|
|
+ return this.paperAttachments.length < 1
|
|
|
|
+ ? 1
|
|
|
|
+ : this.paperAttachments.length;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
created() {
|
|
created() {
|
|
this.getExamRule();
|
|
this.getExamRule();
|
|
},
|
|
},
|
|
@@ -219,11 +464,9 @@ export default {
|
|
this.needReview = examRule && examRule.review;
|
|
this.needReview = examRule && examRule.review;
|
|
},
|
|
},
|
|
initData() {
|
|
initData() {
|
|
- this.modalForm = { ...initModalForm };
|
|
|
|
- this.modalForm.includePaper = this.examRule.includePaper;
|
|
|
|
- this.modalForm.review = this.examRule.review;
|
|
|
|
- this.modalForm.customCard = this.examRule.customCard;
|
|
|
|
- this.buildSteps();
|
|
|
|
|
|
+ this.examTask = { ...initExamTask };
|
|
|
|
+ this.examTaskDetail = { ...initExamTaskDetail };
|
|
|
|
+ // this.buildSteps();
|
|
},
|
|
},
|
|
buildSteps() {
|
|
buildSteps() {
|
|
// TODO:
|
|
// TODO:
|
|
@@ -245,15 +488,264 @@ export default {
|
|
visibleChange() {
|
|
visibleChange() {
|
|
this.initData();
|
|
this.initData();
|
|
},
|
|
},
|
|
|
|
+ checkData() {
|
|
|
|
+ return this.$refs.examTaskComp.validate().catch(() => {});
|
|
|
|
+ },
|
|
cancel() {
|
|
cancel() {
|
|
this.modalIsShow = false;
|
|
this.modalIsShow = false;
|
|
},
|
|
},
|
|
open() {
|
|
open() {
|
|
this.modalIsShow = true;
|
|
this.modalIsShow = true;
|
|
},
|
|
},
|
|
- modified() {
|
|
|
|
- this.cancel();
|
|
|
|
- this.$emit("modified");
|
|
|
|
|
|
+ // exam-task-detail edit
|
|
|
|
+ addAtachment() {
|
|
|
|
+ if (this.paperAttachments.length >= this.attachmentLimitCount) return;
|
|
|
|
+
|
|
|
|
+ const newAttachment = {
|
|
|
|
+ name: this.abc[this.paperAttachments.length],
|
|
|
|
+ attachmentId: "",
|
|
|
|
+ filename: "",
|
|
|
|
+ pages: 0
|
|
|
|
+ };
|
|
|
|
+ this.paperAttachments.push(newAttachment);
|
|
|
|
+ },
|
|
|
|
+ deleteAttachment(index) {
|
|
|
|
+ if (this.paperAttachments.length <= 1) {
|
|
|
|
+ this.$message.error("试卷类型数量不得少于1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.paperAttachments.splice(index, 1);
|
|
|
|
+ this.paperAttachments.forEach((item, itemIndex) => {
|
|
|
|
+ item.name = this.abc[itemIndex];
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ toUpload(attachment) {
|
|
|
|
+ this.curUploadType = "paper";
|
|
|
|
+ this.curAttachment = {
|
|
|
|
+ ...attachment
|
|
|
|
+ };
|
|
|
|
+ this.$refs.UploadPaperDialog.open();
|
|
|
|
+ },
|
|
|
|
+ toUploadPaperConfirm() {
|
|
|
|
+ if (this.paperConfirmAttachments.length >= 4) return;
|
|
|
|
+ this.curUploadType = "paperConfirm";
|
|
|
|
+ this.curAttachment = {
|
|
|
|
+ ...this.paperConfirmAttachmentId
|
|
|
|
+ };
|
|
|
|
+ this.$refs.UploadPaperDialog.open();
|
|
|
|
+ },
|
|
|
|
+ uploadConfirm(attachment, uploadType) {
|
|
|
|
+ if (uploadType === "paper") {
|
|
|
|
+ const index = this.paperAttachments.findIndex(
|
|
|
|
+ item => item.name === attachment.name
|
|
|
|
+ );
|
|
|
|
+ this.paperAttachments.splice(index, 1, { ...attachment });
|
|
|
|
+ } else {
|
|
|
|
+ this.paperConfirmAttachments.push(attachment);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ deletePaperConfirmAttachment(index) {
|
|
|
|
+ this.paperConfirmAttachments.splice(index, 1);
|
|
|
|
+ },
|
|
|
|
+ toViewCard() {
|
|
|
|
+ window.open(
|
|
|
|
+ this.getRouterPath({
|
|
|
|
+ name: "CardPreview",
|
|
|
|
+ params: {
|
|
|
|
+ cardId: this.examTaskDetail.cardId,
|
|
|
|
+ viewType: "view"
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ toEditCard() {
|
|
|
|
+ this.cachePrepareTcpCard();
|
|
|
|
+ this.$router.push({
|
|
|
|
+ name: "CardDesign",
|
|
|
|
+ params: {
|
|
|
|
+ cardId: this.examTaskDetail.cardId
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ cachePrepareTcpCard() {
|
|
|
|
+ // TODO:
|
|
|
|
+ this.$ls.set("prepareTcPCard", {
|
|
|
|
+ examTaskId: this.examTask.id,
|
|
|
|
+ courseCode: this.examTask.courseCode,
|
|
|
|
+ courseName: this.examTask.courseName,
|
|
|
|
+ makeMethod: this.examTaskDetail.makeMethod,
|
|
|
|
+ cardRuleId: this.examTask.cardRuleId,
|
|
|
|
+ paperType: this.paperAttachments.map(item => item.name).join(",")
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async toCreateOrViewCard() {
|
|
|
|
+ await this.toSave();
|
|
|
|
+ this.task = this.getTaskDetailData();
|
|
|
|
+ if (!this.examTaskDetail.cardId) {
|
|
|
|
+ this.$refs.CardOptionDialog.open();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this.examTaskDetail.makeMethod === "SELECT") {
|
|
|
|
+ this.$refs.CardOptionDialog.open();
|
|
|
|
+ } else if (this.examTaskDetail.makeMethod === "SELF") {
|
|
|
|
+ this.toEditCard();
|
|
|
|
+ } else {
|
|
|
|
+ // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
|
|
|
|
+ if (this.examTaskDetail.status === "SUBMIT") {
|
|
|
|
+ this.toEditCard();
|
|
|
|
+ } else {
|
|
|
|
+ this.toViewCard();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ cardConfirm(data) {
|
|
|
|
+ this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
|
|
|
|
+ },
|
|
|
|
+ async changeCreateCardType() {
|
|
|
|
+ const h = this.$createElement;
|
|
|
|
+ const result = await this.$confirm({
|
|
|
|
+ title: "切换题卡操作说明",
|
|
|
|
+ message: h("div", null, [
|
|
|
|
+ h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
|
|
|
|
+ h(
|
|
|
|
+ "p",
|
|
|
|
+ null,
|
|
|
|
+ "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
|
|
|
|
+ )
|
|
|
|
+ ]),
|
|
|
|
+ cancelButtonClass: "el-button--danger is-plain",
|
|
|
|
+ confirmButtonClass: "el-button--primary",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ if (result !== "confirm") return;
|
|
|
|
+ this.clearMakeMethod();
|
|
|
|
+ this.toCreateOrViewCard();
|
|
|
|
+ },
|
|
|
|
+ async clearMakeMethod() {
|
|
|
|
+ // 清除后台记录的题卡
|
|
|
|
+ if (this.examTask.id) await switchCardCreateMethod(this.examTask.id);
|
|
|
|
+
|
|
|
|
+ this.examTaskDetail.makeMethod = "";
|
|
|
|
+ this.examTaskDetail.cardId = "";
|
|
|
|
+ },
|
|
|
|
+ clearCard() {
|
|
|
|
+ this.clearMakeMethod();
|
|
|
|
+ },
|
|
|
|
+ getTaskDetailData() {
|
|
|
|
+ let data = { ...this.examTaskDetail };
|
|
|
|
+ data.paperType = this.paperAttachments.map(item => item.name).join(",");
|
|
|
|
+ data.paperAttachmentIds = JSON.stringify(this.paperAttachments, (k, v) =>
|
|
|
|
+ k === "url" ? undefined : v
|
|
|
|
+ );
|
|
|
|
+ data.paperConfirmAttachmentIds = JSON.stringify(
|
|
|
|
+ this.paperConfirmAttachments
|
|
|
|
+ );
|
|
|
|
+ return data;
|
|
|
|
+ },
|
|
|
|
+ checkDataValid() {
|
|
|
|
+ const attachmentValid = !this.paperAttachments.some(
|
|
|
|
+ item => !item.attachmentId
|
|
|
|
+ );
|
|
|
|
+ // 设置了入库强制包含试卷时,校验试卷是否上传。
|
|
|
|
+ if (this.examTaskDetail.includePaper && !attachmentValid) {
|
|
|
|
+ this.$message.error("请完成试卷文件上传!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // if (!this.paperConfirmAttachments.length) {
|
|
|
|
+ // this.$message.error("请上传入库审核表!");
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ if (!this.examTaskDetail.cardId) {
|
|
|
|
+ this.$message.error("请选择题卡创建方式!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (
|
|
|
|
+ this.examTaskDetail.makeMethod !== "SELECT" &&
|
|
|
|
+ this.examTaskDetail.status !== "SUBMIT"
|
|
|
|
+ ) {
|
|
|
|
+ this.$message.error("请先提交题卡!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ },
|
|
|
|
+ async toSave() {
|
|
|
|
+ const valid = await this.$refs.examTaskComp.validate().catch(() => {});
|
|
|
|
+ if (!valid) return;
|
|
|
|
+
|
|
|
|
+ if (this.isSubmit) return;
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+ const examTaskDetail = this.getTaskDetailData();
|
|
|
|
+ examTaskDetail.operateType = "STAGE";
|
|
|
|
+ const datas = {
|
|
|
|
+ examTaskDetail,
|
|
|
|
+ examTask: this.examTask
|
|
|
|
+ };
|
|
|
|
+ const data = await teacherCreateTaskApply(datas).catch(() => {});
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+ if (!data) return;
|
|
|
|
+
|
|
|
|
+ this.$message.success("保存成功!");
|
|
|
|
+ },
|
|
|
|
+ async submit() {
|
|
|
|
+ const valid = await this.$refs.examTaskComp.validate().catch(() => {});
|
|
|
|
+ if (!valid) return;
|
|
|
|
+
|
|
|
|
+ if (!this.checkDataValid()) return;
|
|
|
|
+
|
|
|
|
+ this.$confirm(
|
|
|
|
+ "任务确定提交后,则不可更改试卷及答题卡内容,确定提交该任务?",
|
|
|
|
+ "提示",
|
|
|
|
+ {
|
|
|
|
+ cancelButtonClass: "el-button--danger is-plain",
|
|
|
|
+ confirmButtonClass: "el-button--primary",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(async () => {
|
|
|
|
+ const examTaskDetail = this.getTaskDetailData();
|
|
|
|
+ examTaskDetail.operateType = "SUBMIT";
|
|
|
|
+ const datas = {
|
|
|
|
+ examTaskDetail,
|
|
|
|
+ examTask: this.examTask
|
|
|
|
+ };
|
|
|
|
+ const data = await teacherCreateTaskApply(datas).catch(() => {});
|
|
|
|
+
|
|
|
|
+ if (!data) return;
|
|
|
|
+ this.$message.success("提交成功!");
|
|
|
|
+ this.cancel();
|
|
|
|
+ this.$emit("modified");
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ // image-preview
|
|
|
|
+ toPreview(index) {
|
|
|
|
+ this.curImageIndex = index;
|
|
|
|
+ this.selectImage(index);
|
|
|
|
+ this.$refs.SimpleImagePreview.open();
|
|
|
|
+ },
|
|
|
|
+ selectImage(index) {
|
|
|
|
+ this.curImage = this.paperConfirmAttachments[index];
|
|
|
|
+ },
|
|
|
|
+ toPrevImage() {
|
|
|
|
+ if (this.curImageIndex === 0) {
|
|
|
|
+ this.curImageIndex = this.paperConfirmAttachments.length - 1;
|
|
|
|
+ } else {
|
|
|
|
+ this.curImageIndex--;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.selectImage(this.curImageIndex);
|
|
|
|
+ },
|
|
|
|
+ toNextImage() {
|
|
|
|
+ if (this.curImageIndex === this.paperConfirmAttachments.length - 1) {
|
|
|
|
+ this.curImageIndex = 0;
|
|
|
|
+ } else {
|
|
|
|
+ this.curImageIndex++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.selectImage(this.curImageIndex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|