|
@@ -24,7 +24,6 @@
|
|
|
:semester-id="examTask.semesterId"
|
|
|
:clearable="false"
|
|
|
class="width-full"
|
|
|
- @change="emitRelateInfo('exam')"
|
|
|
></exam-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -92,6 +91,13 @@
|
|
|
>
|
|
|
</div>
|
|
|
<table class="table mb-2">
|
|
|
+ <colgroup>
|
|
|
+ <col width="100" />
|
|
|
+ <col width="280" />
|
|
|
+ <col width="140" />
|
|
|
+ <col />
|
|
|
+ <col width="60" />
|
|
|
+ </colgroup>
|
|
|
<tr>
|
|
|
<th>试卷类型</th>
|
|
|
<th>试卷文件</th>
|
|
@@ -124,7 +130,11 @@
|
|
|
{{ createCardTypeName }}
|
|
|
</td>
|
|
|
<td :rowspan="paperAttachments.length" v-if="index === 0">
|
|
|
- <el-select v-model="examTaskDetail.cardId" placeholder="请选择">
|
|
|
+ <el-select
|
|
|
+ class="mr-2"
|
|
|
+ v-model="examTaskDetail.cardId"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
<el-option
|
|
|
v-for="item in cards"
|
|
|
:key="item.id"
|
|
@@ -133,6 +143,19 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!examTaskDetail.cardId"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!canCreateCard"
|
|
|
+ @click="toCreateCard"
|
|
|
+ >新建</el-button
|
|
|
+ >
|
|
|
</td>
|
|
|
<td>
|
|
|
<el-button
|
|
@@ -226,19 +249,23 @@
|
|
|
@on-next="toNextImage"
|
|
|
ref="SimpleImagePreview"
|
|
|
></simple-image-preview>
|
|
|
+ <!-- ModifyCard -->
|
|
|
+ <modify-card ref="ModifyCard" @modified="cardModified"></modify-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import UploadPaperDialog from "../UploadPaperDialog";
|
|
|
import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
+import ModifyCard from "../../../card/components/ModifyCard";
|
|
|
import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
|
|
|
import { cardForSelectList } from "../../api";
|
|
|
-import { courseQuery } from "../../../base/api";
|
|
|
+import { courseQuery, examConfigByExamIdOrgId } from "../../../base/api";
|
|
|
+import { mapState, mapMutations } from "vuex";
|
|
|
|
|
|
export default {
|
|
|
name: "info-exam-task",
|
|
|
- components: { UploadPaperDialog, SimpleImagePreview },
|
|
|
+ components: { UploadPaperDialog, SimpleImagePreview, ModifyCard },
|
|
|
props: {
|
|
|
datas: {
|
|
|
type: Object,
|
|
@@ -300,6 +327,11 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapState("exam", [
|
|
|
+ "infoExamTask",
|
|
|
+ "infoExamTaskDetail",
|
|
|
+ "infoExamPrintPlan"
|
|
|
+ ]),
|
|
|
createCardTypeName() {
|
|
|
return CARD_SOURCE_TYPE[this.examTaskDetail.makeMethod] || "";
|
|
|
},
|
|
@@ -307,15 +339,27 @@ export default {
|
|
|
return this.paperAttachments.length < 1
|
|
|
? 1
|
|
|
: this.paperAttachments.length;
|
|
|
+ },
|
|
|
+ canCreateCard() {
|
|
|
+ return this.examTask.courseCode && this.examTask.examId;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ "examTask.examId": function(val, oldval) {
|
|
|
+ if (val !== oldval) this.examAndRoomChange();
|
|
|
+ },
|
|
|
+ "examTask.teachingRoomId": function(val, oldval) {
|
|
|
+ if (val !== oldval) this.examAndRoomChange();
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations("exam", ["updateTaskInfo"]),
|
|
|
initData() {
|
|
|
- this.examTask = { ...this.datas.examTask };
|
|
|
- this.examTaskDetail = { ...this.datas.examTaskDetail };
|
|
|
+ this.examTask = { ...this.infoExamTask };
|
|
|
+ this.examTaskDetail = { ...this.infoExamTaskDetail };
|
|
|
this.paperAttachments = this.examTaskDetail.paperAttachmentIds
|
|
|
? JSON.parse(this.examTaskDetail.paperAttachmentIds)
|
|
|
: [];
|
|
@@ -330,20 +374,20 @@ export default {
|
|
|
: [];
|
|
|
|
|
|
this.getCourses();
|
|
|
- this.getCardList();
|
|
|
+ this.getCardList(true);
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.examTaskComp.clearValidate();
|
|
|
});
|
|
|
},
|
|
|
- async getCardList() {
|
|
|
+ async getCardList(selectDefaultCard = false) {
|
|
|
if (!this.examTask.courseCode || !this.examTask.examId) return;
|
|
|
const data = await cardForSelectList({
|
|
|
courseCode: this.examTask.courseCode,
|
|
|
examId: this.examTask.examId
|
|
|
});
|
|
|
this.cards = data || [];
|
|
|
- if (this.cards.length) {
|
|
|
+ if (this.cards.length && selectDefaultCard) {
|
|
|
this.examTaskDetail.cardId = data[0].id;
|
|
|
}
|
|
|
},
|
|
@@ -364,7 +408,6 @@ export default {
|
|
|
this.examTaskDetail.cardId = "";
|
|
|
this.cards = [];
|
|
|
this.getCourses();
|
|
|
- this.emitRelateInfo("exam");
|
|
|
},
|
|
|
courseChange(val) {
|
|
|
if (val) {
|
|
@@ -377,7 +420,50 @@ export default {
|
|
|
this.examTaskDetail.cardId = "";
|
|
|
this.cards = [];
|
|
|
this.getCardList();
|
|
|
- this.emitRelateInfo("course");
|
|
|
+ this.updateTaskInfo({ infoExamTask: this.examTask });
|
|
|
+ },
|
|
|
+ async examAndRoomChange() {
|
|
|
+ const { examId, teachingRoomId } = this.examTask;
|
|
|
+ this.updateTaskInfo({ infoExamTask: this.examTask });
|
|
|
+
|
|
|
+ if (examId && teachingRoomId) {
|
|
|
+ const examPrintPlan = await examConfigByExamIdOrgId({
|
|
|
+ examId,
|
|
|
+ orgId: teachingRoomId
|
|
|
+ });
|
|
|
+ this.examTask.cardRuleId = examPrintPlan.cardRuleId;
|
|
|
+ this.updateTaskInfo({
|
|
|
+ infoExamPrintPlan: Object.assign(
|
|
|
+ {},
|
|
|
+ this.infoExamPrintPlan,
|
|
|
+ examPrintPlan
|
|
|
+ ),
|
|
|
+ infoExamTask: this.examTask
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toCreateCard() {
|
|
|
+ this.$ls.set("prepareTcPCard", {
|
|
|
+ courseCode: this.examTask.courseCode,
|
|
|
+ courseName: this.examTask.courseName,
|
|
|
+ schoolName: this.$ls.get("schoolName"),
|
|
|
+ makeMethod: "SELF",
|
|
|
+ cardRuleId: this.examTask.cardRuleId,
|
|
|
+ type: "CUSTOM",
|
|
|
+ createMethod: "STANDARD"
|
|
|
+ });
|
|
|
+ this.$refs.ModifyCard.open();
|
|
|
+ },
|
|
|
+ async cardModified(cardId) {
|
|
|
+ if (!cardId) return;
|
|
|
+ let card = this.cards.find(item => item.id === cardId);
|
|
|
+ if (card) {
|
|
|
+ this.examTaskDetail.cardId = card.id;
|
|
|
+ } else {
|
|
|
+ await this.getCardList();
|
|
|
+ card = this.cards.find(item => item.id === cardId);
|
|
|
+ this.examTaskDetail.cardId = card.id;
|
|
|
+ }
|
|
|
},
|
|
|
async checkData() {
|
|
|
const valid = await this.$refs.examTaskComp.validate().catch(() => {});
|
|
@@ -403,12 +489,12 @@ export default {
|
|
|
|
|
|
return Promise.resolve(true);
|
|
|
},
|
|
|
- getData() {
|
|
|
+ updeteData() {
|
|
|
let data = {
|
|
|
- examTask: this.examTask,
|
|
|
- examTaskDetail: this.getTaskDetailData()
|
|
|
+ infoExamTask: this.examTask,
|
|
|
+ infoExamTaskDetail: this.getTaskDetailData()
|
|
|
};
|
|
|
- return data;
|
|
|
+ this.updateTaskInfo(data);
|
|
|
},
|
|
|
emitRelateInfo(type) {
|
|
|
this.$emit("relate-info-change", this.getData(), type);
|