|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<el-dialog
|
|
|
- class="preview-task-paper task-detail"
|
|
|
+ class="modify-task-paper task-detail"
|
|
|
:visible.sync="modalIsShow"
|
|
|
- title="卷库预览"
|
|
|
+ :title="title"
|
|
|
top="10vh"
|
|
|
width="900px"
|
|
|
:close-on-click-modal="false"
|
|
@@ -11,6 +11,14 @@
|
|
|
@open="visibleChange"
|
|
|
>
|
|
|
<div class="part-box part-box-pad part-box-border">
|
|
|
+ <div v-if="IS_EDIT" 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>
|
|
@@ -55,6 +63,29 @@ export default {
|
|
|
default() {
|
|
|
return {};
|
|
|
}
|
|
|
+ },
|
|
|
+ editType: {
|
|
|
+ type: String,
|
|
|
+ default: "PREVIEW",
|
|
|
+ validator: val => ["EDIT", "PREVIEW"].includes(val)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ title() {
|
|
|
+ const names = {
|
|
|
+ EDIT: "编辑卷库",
|
|
|
+ PREVIEW: "卷库详情"
|
|
|
+ };
|
|
|
+ return names[this.editType];
|
|
|
+ },
|
|
|
+ IS_PREVIEW() {
|
|
|
+ return this.editType === "PREVIEW";
|
|
|
+ },
|
|
|
+ IS_EDIT() {
|
|
|
+ return this.editType === "EDIT";
|
|
|
+ },
|
|
|
+ CAN_EDIT_CARD() {
|
|
|
+ return this.editType === "EDIT" && !this.instance.exposedPaperType;
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -78,9 +109,52 @@ export default {
|
|
|
open() {
|
|
|
this.modalIsShow = true;
|
|
|
},
|
|
|
- // downloadPaper(attachment) {
|
|
|
- // window.open(attachment.url);
|
|
|
- // },
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ },
|
|
|
async downloadPaper(attachment) {
|
|
|
const data = await attachmentPreview(attachment.attachmentId);
|
|
|
window.open(data.url);
|