|
@@ -119,12 +119,10 @@
|
|
|
<i
|
|
|
:class="[
|
|
|
'icon',
|
|
|
- attachment.attachmentId ? 'icon-files-act' : 'icon-files',
|
|
|
+ attachment.filename ? 'icon-files-act' : 'icon-files',
|
|
|
]"
|
|
|
></i
|
|
|
- >{{
|
|
|
- attachment.attachmentId ? attachment.filename : "选择试卷"
|
|
|
- }}
|
|
|
+ >{{ attachment.filename || "选择试卷" }}
|
|
|
</el-button>
|
|
|
</td>
|
|
|
<td v-else>
|
|
@@ -159,6 +157,20 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!attachment.cardId"
|
|
|
+ @click="toViewCard(attachment)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!attachment.cardId"
|
|
|
+ @click="toEditCard(attachment)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
</td>
|
|
|
<td v-else>
|
|
|
<el-select
|
|
@@ -194,21 +206,19 @@
|
|
|
{{ item.title }}
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <template v-if="!IS_TIKU_TAB">
|
|
|
- <span
|
|
|
- v-if="attachment.cardId"
|
|
|
- :class="[
|
|
|
- attachment.cardType === 'GENERIC'
|
|
|
- ? 'color-success'
|
|
|
- : 'color-primary',
|
|
|
- 'mr-1',
|
|
|
- {
|
|
|
- 'color-danger': attachment.used,
|
|
|
- },
|
|
|
- ]"
|
|
|
- >[{{ attachment.cardType === "GENERIC" ? "通" : "专" }}]</span
|
|
|
- >
|
|
|
- </template>
|
|
|
+ <span
|
|
|
+ v-if="attachment.cardId"
|
|
|
+ :class="[
|
|
|
+ attachment.cardType === 'GENERIC'
|
|
|
+ ? 'color-success'
|
|
|
+ : 'color-primary',
|
|
|
+ 'mr-1',
|
|
|
+ {
|
|
|
+ 'color-danger': attachment.used,
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ >[{{ attachment.cardType === "GENERIC" ? "通" : "专" }}]</span
|
|
|
+ >
|
|
|
<el-button
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
@@ -217,7 +227,6 @@
|
|
|
>预览</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="!IS_TIKU_TAB"
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
|
:disabled="
|
|
@@ -232,7 +241,6 @@
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
|
:disabled="
|
|
|
- IS_TIKU_TAB ||
|
|
|
!attachment.cardId ||
|
|
|
attachment.cardType === 'GENERIC' ||
|
|
|
!(!attachment.used && attachment.createId === user.id)
|
|
@@ -241,7 +249,6 @@
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="!IS_TIKU_TAB"
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
|
:disabled="!canCreateCard"
|
|
@@ -552,28 +559,17 @@ export default {
|
|
|
// console.log(val);
|
|
|
if (!val.id) return;
|
|
|
this.examTask.examModel = val.examModel;
|
|
|
- this.paperAttachments.forEach((item) => {
|
|
|
- item.cardId = "";
|
|
|
- item.cardType = "";
|
|
|
- item.createMethod = "";
|
|
|
- item.cardTitle = "";
|
|
|
- });
|
|
|
+ if (!this.IS_TIKU_TAB) {
|
|
|
+ this.paperAttachments.forEach((item) => {
|
|
|
+ item.cardId = "";
|
|
|
+ item.cardType = "";
|
|
|
+ item.createMethod = "";
|
|
|
+ item.cardTitle = "";
|
|
|
+ });
|
|
|
+ }
|
|
|
this.cards = [];
|
|
|
this.getCardList();
|
|
|
},
|
|
|
- teachingRoomChange() {
|
|
|
- this.examTask.courseCode = "";
|
|
|
- this.examTask.courseName = "";
|
|
|
- this.courses = [];
|
|
|
- this.paperAttachments.forEach((item) => {
|
|
|
- item.cardId = "";
|
|
|
- item.cardType = "";
|
|
|
- item.createMethod = "";
|
|
|
- item.cardTitle = "";
|
|
|
- });
|
|
|
- this.cards = [];
|
|
|
- this.getCourses();
|
|
|
- },
|
|
|
courseChange(val) {
|
|
|
if (val) {
|
|
|
const course = this.courses.find((item) => item.code === val);
|
|
@@ -586,6 +582,11 @@ export default {
|
|
|
item.cardType = "";
|
|
|
item.createMethod = "";
|
|
|
item.cardTitle = "";
|
|
|
+ if (this.IS_TIKU_TAB) {
|
|
|
+ item.paperId = "";
|
|
|
+ item.uuid = "";
|
|
|
+ item.filename = "";
|
|
|
+ }
|
|
|
});
|
|
|
this.cards = [];
|
|
|
this.getCardList();
|
|
@@ -721,6 +722,17 @@ export default {
|
|
|
const valid = await this.$refs.examTaskComp.validate().catch(() => {});
|
|
|
if (!valid) return Promise.reject();
|
|
|
|
|
|
+ if (this.IS_TIKU_TAB) {
|
|
|
+ const attachmentValid = !this.paperAttachments.some(
|
|
|
+ (item) => !item.filename
|
|
|
+ );
|
|
|
+ if (!attachmentValid) {
|
|
|
+ this.$message.error("请完成试卷选择!");
|
|
|
+ return Promise.reject();
|
|
|
+ }
|
|
|
+ return Promise.resolve(true);
|
|
|
+ }
|
|
|
+
|
|
|
// 设置了入库强制包含试卷时,校验试卷是否上传。
|
|
|
// 未设置入库强制包含试卷时,若有试卷上传,则需要上传全部。若无试卷上传,则通过。
|
|
|
if (this.examTaskDetail.includePaper) {
|
|
@@ -776,12 +788,16 @@ export default {
|
|
|
},
|
|
|
// select-paper
|
|
|
toSelect(attachment) {
|
|
|
- this.curAttachment = attachment;
|
|
|
- // this.$refs.SelectTikuPaperDialog.open();
|
|
|
- this.tikuPaperSelected({ id: "1", name: "paper-name" });
|
|
|
+ this.curAttachment = {
|
|
|
+ ...attachment,
|
|
|
+ courseCode: this.examTask.courseCode,
|
|
|
+ };
|
|
|
+ this.$refs.SelectTikuPaperDialog.open();
|
|
|
+ // this.tikuPaperSelected({ id: "1", name: "paper-name" });
|
|
|
},
|
|
|
async tikuPaperSelected(data) {
|
|
|
this.cardBuildPresetData = {
|
|
|
+ examId: this.examTask.examId,
|
|
|
courseCode: this.examTask.courseCode,
|
|
|
courseName: this.examTask.courseName,
|
|
|
schoolName: this.$ls.get("schoolName"),
|
|
@@ -800,10 +816,21 @@ export default {
|
|
|
this.$message.error(data.message);
|
|
|
return;
|
|
|
}
|
|
|
- Object.assign(this.curAttachment, {
|
|
|
+ const ind = this.paperAttachments.findIndex(
|
|
|
+ (item) => item.name === this.curAttachment.name
|
|
|
+ );
|
|
|
+ if (ind === -1) return;
|
|
|
+
|
|
|
+ const info = data.data;
|
|
|
+ this.curAttachment = { ...this.paperAttachments[ind] };
|
|
|
+ this.paperAttachments[ind] = Object.assign(this.paperAttachments[ind], {
|
|
|
paperId: this.cardBuildPresetData.paperId,
|
|
|
- cardId: data.cardId,
|
|
|
- cardTitle: data.cardTitle,
|
|
|
+ cardType: this.cardBuildPresetData.type,
|
|
|
+ createMethod: this.cardBuildPresetData.createMethod,
|
|
|
+ filename: this.cardBuildPresetData.paperName,
|
|
|
+ cardId: info.id,
|
|
|
+ cardTitle: info.title,
|
|
|
+ uuid: info.paperUuid,
|
|
|
});
|
|
|
},
|
|
|
// exam-task-detail edit
|
|
@@ -818,6 +845,8 @@ export default {
|
|
|
createMethod: "",
|
|
|
cardTitle: "",
|
|
|
filename: "",
|
|
|
+ paperId: null,
|
|
|
+ uuid: null,
|
|
|
pages: 0,
|
|
|
used: false,
|
|
|
createId: null,
|