|
@@ -235,7 +235,6 @@ import UploadPaperDialog from "./UploadPaperDialog";
|
|
|
import ModifyCard from "../../card/components/ModifyCard";
|
|
|
import { taskApplyDetail, taskPaperApplyEdit, cardForSelectList } from "../api";
|
|
|
import { attachmentPreview } from "../../login/api";
|
|
|
-import { examRuleDetail } from "../../base/api";
|
|
|
import { COMMON_CARD_RULE_ID } from "@/constants/enumerate";
|
|
|
import { copyCard } from "../../card/api";
|
|
|
|
|
@@ -316,18 +315,10 @@ export default {
|
|
|
curAttachment: {},
|
|
|
curUploadType: "paper",
|
|
|
abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
|
|
|
- includePaper: false,
|
|
|
cards: []
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getExamRule();
|
|
|
- },
|
|
|
methods: {
|
|
|
- async getExamRule() {
|
|
|
- const examRule = await examRuleDetail();
|
|
|
- this.includePaper = examRule && examRule.includePaper;
|
|
|
- },
|
|
|
async getCardList() {
|
|
|
if (!this.curTaskApply.courseCode || !this.curTaskApply.examId) return;
|
|
|
const data = await cardForSelectList({
|
|
@@ -342,7 +333,8 @@ export default {
|
|
|
this.curTaskApply.courseCode = this.instance.courseCode;
|
|
|
this.curTaskApply.courseName = this.instance.courseName;
|
|
|
this.curTaskApply.cardRuleId = this.instance.cardRuleId;
|
|
|
- this.curTaskApply.includePaper = this.includePaper;
|
|
|
+ this.curTaskApply.includePaper =
|
|
|
+ data.printContent.indexOf("PAPER") !== -1;
|
|
|
this.paperAttachments = data.paperAttachmentIds
|
|
|
? JSON.parse(data.paperAttachmentIds)
|
|
|
: [];
|
|
@@ -511,13 +503,27 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
checkDataValid() {
|
|
|
- const attachmentValid = !this.paperAttachments.some(
|
|
|
- item => !item.attachmentId
|
|
|
- );
|
|
|
// 设置了入库强制包含试卷时,校验试卷是否上传。
|
|
|
- if (this.curTaskApply.includePaper && !attachmentValid) {
|
|
|
- this.$message.error("请完成试卷文件上传!");
|
|
|
- return;
|
|
|
+ // 未设置入库强制包含试卷时,若有试卷上传,则需要上传全部。若无试卷上传,则通过。
|
|
|
+ if (this.curTaskApply.includePaper) {
|
|
|
+ const attachmentValid = !this.paperAttachments.some(
|
|
|
+ item => !item.attachmentId
|
|
|
+ );
|
|
|
+ if (!attachmentValid) {
|
|
|
+ this.$message.error("请完成试卷文件上传!");
|
|
|
+ return Promise.reject();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const hasUploadPaperAttachments = this.paperAttachments.filter(
|
|
|
+ item => item.attachmentId
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ hasUploadPaperAttachments.length > 0 &&
|
|
|
+ hasUploadPaperAttachments.length !== this.paperAttachments.length
|
|
|
+ ) {
|
|
|
+ this.$message.error("有试卷文件未完成上传!");
|
|
|
+ return Promise.reject();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const cardValid = !this.paperAttachments.some(item => !item.cardId);
|