Jelajahi Sumber

试卷上传调整

zhangjie 3 tahun lalu
induk
melakukan
6fecb2cb1f

+ 51 - 14
src/modules/exam/components/UploadPaperDialog.vue

@@ -8,6 +8,7 @@
     :close-on-click-modal="false"
     :close-on-press-escape="false"
     append-to-body
+    destroy-on-close
     @opened="visibleChange"
   >
     <div class="file-upload-body">
@@ -17,14 +18,16 @@
       <upload-file-view
         input-width="360px"
         :format="curConfig.format"
-        :upload-url="uploadUrl"
+        :upload-url="curConfig.uploadUrl"
         :upload-data="curConfig.uploadData"
         @uploading="uplaoding"
         @upload-error="uplaodError"
         @upload-success="uploadSuccess"
         ref="UploadFileView"
       ></upload-file-view>
-      <el-button @click="toPreview" style="margin-left: 10px;">预览</el-button>
+      <el-button type="info" @click="toPreview" style="margin-left: 10px;"
+        >预览</el-button
+      >
     </div>
     <div slot="footer">
       <el-button type="primary" @click="confirm" :disabled="loading"
@@ -61,24 +64,30 @@ export default {
     return {
       modalIsShow: false,
       loading: false,
+      hasViewed: false,
       attachment: {},
       config: {
         paper: {
           title: "试卷文件",
           format: ["pdf"],
-          uploadData: { type: "PAPER" }
+          uploadData: { type: "PAPER" },
+          uploadUrl: "/api/admin/common/file/exam_paper_upload"
         },
         paperConfirm: {
           title: "附件",
           format: ["jpg", "png"],
-          uploadData: { type: "UPLOAD" }
+          uploadData: { type: "UPLOAD" },
+          uploadUrl: "/api/admin/common/file/upload"
         }
       },
-      curConfig: { format: [] },
-      // import
-      uploadUrl: "/api/admin/common/file/upload"
+      curConfig: { format: [], uploadUrl: "" }
     };
   },
+  computed: {
+    IS_UPLOAD_PAPER() {
+      return this.uploadType === "paper";
+    }
+  },
   methods: {
     visibleChange() {
       this.$refs.UploadFileView.setAttachmentName(
@@ -86,6 +95,7 @@ export default {
       );
       this.attachment = { ...this.paperAttachment };
       this.curConfig = this.config[this.uploadType];
+      this.hasViewed = false;
     },
     // upload-handler
     uplaodError(errorData) {
@@ -98,12 +108,23 @@ export default {
     uploadSuccess(data) {
       this.loading = false;
       this.$message.success("上传成功!");
-      let infos = {
-        attachmentId: data.id,
-        filename: data.filename,
-        url: data.url,
-        pages: data.pages
-      };
+      let infos = {};
+      if (this.IS_UPLOAD_PAPER) {
+        infos = {
+          attachmentId: data.translate.id,
+          filename: data.filename,
+          url: data.translate.url,
+          pages: data.translate.pages,
+          original: data.original
+        };
+      } else {
+        infos = {
+          attachmentId: data.id,
+          filename: data.filename,
+          url: data.url,
+          pages: data.pages
+        };
+      }
       this.attachment = Object.assign(this.attachment, infos);
     },
     uplaoding() {
@@ -116,6 +137,18 @@ export default {
       this.modalIsShow = true;
     },
     confirm() {
+      if (!this.attachment.attachmentId) {
+        this.$message.error(`请先上传${this.curConfig.title}!`);
+        return;
+      }
+      if (
+        !this.hasViewed &&
+        this.IS_UPLOAD_PAPER &&
+        this.attachment.attachmentId !== this.paperAttachment.attachmentId
+      ) {
+        this.$message.error(`请先预览上传的试卷!`);
+        return;
+      }
       this.$emit("confirm", this.attachment, this.uploadType);
       this.cancel();
     },
@@ -124,7 +157,11 @@ export default {
         this.$message.error(`请先上传${this.curConfig.title}!`);
         return;
       }
-      const data = await attachmentPreview(this.attachment.attachmentId);
+
+      let attachmentId = this.attachment.attachmentId;
+      if (this.IS_UPLOAD_PAPER) this.hasViewed = true;
+
+      const data = await attachmentPreview(attachmentId);
       window.open(data.url);
     }
   }

+ 10 - 0
src/modules/print/views/PrintTaskManage.vue

@@ -11,6 +11,14 @@
               @change="printPlanChange"
             ></print-plan-select>
           </el-form-item>
+          <el-form-item label="印刷室:">
+            <print-room-select
+              v-model.trim="filter.printHouseId"
+              placeholder="印刷室"
+              clearable
+              @change="printPlanChange"
+            ></print-room-select>
+          </el-form-item>
           <el-form-item label="印刷状态:">
             <el-select
               v-model="filter.status"
@@ -167,6 +175,7 @@
           prop="printPlanName"
           label="印刷计划"
         ></el-table-column>
+        <el-table-column prop="printHouseName" label="印刷室"></el-table-column>
         <el-table-column
           prop="examDate"
           label="考试日期"
@@ -348,6 +357,7 @@ export default {
     return {
       filter: {
         printPlanId: "",
+        printHouseId: "",
         status: "",
         courseCode: "",
         paperNumber: "",