Przeglądaj źródła

场次相关bug fix

lideyin 4 lat temu
rodzic
commit
298673d297

+ 84 - 15
src/modules/examwork/view/stageSpecialSettings.vue

@@ -403,7 +403,7 @@
         <!-- 修改场次弹出框 -->
         <el-dialog
           title="编辑场次"
-          width="650px"
+          width="700px"
           :visible.sync="editStageVisible"
         >
           <el-form
@@ -473,8 +473,13 @@
                 </el-form-item>
               </el-row>
               <el-row v-if="editStageForm.submitType == 'TIMING_END'">
-                <el-form-item label="统一交卷时间">
-                  <el-input v-model="editStageForm.submitDuration">
+                <el-form-item label="统一交卷时间" prop="submitDuration">
+                  <el-input
+                    class="input_width_lg"
+                    v-model="editStageForm.submitDuration"
+                    maxlength="10"
+                    @keyup.native="handleSubmitDuration4editStage"
+                  >
                     <template slot="prepend">开考后</template>
                     <template slot="append">分钟</template>
                   </el-input>
@@ -491,13 +496,14 @@
         <!-- 通用设置弹出框 -->
         <el-dialog
           title="收卷设置"
-          width="650px"
+          width="700px"
           :visible.sync="editStageCommonSettingVisible"
         >
           <el-form
             :inline="true"
             inline-message
             :model="editStageCommonSettingForm"
+            :rules="commonSettingRules"
             ref="editStageCommonSettingForm"
             label-position="right"
             label-width="120px"
@@ -512,7 +518,16 @@
               </el-form-item>
             </el-row>
             <el-row>
-              <el-form-item label="收卷设置">
+              <el-form-item label="考试名称">
+                <el-input
+                  class="input_width_lg"
+                  v-model="editStageCommonSettingForm.examName"
+                  :disabled="true"
+                />
+              </el-form-item>
+            </el-row>
+            <el-row>
+              <el-form-item label="收卷设置" prop="submitType">
                 <el-radio-group
                   class="pull_right_sm"
                   v-model="editStageCommonSettingForm.submitType"
@@ -525,8 +540,13 @@
             <el-row
               v-if="editStageCommonSettingForm.submitType == 'TIMING_END'"
             >
-              <el-form-item label="统一交卷时间">
-                <el-input v-model="editStageCommonSettingForm.submitDuration">
+              <el-form-item label="统一交卷时间" prop="submitDuration">
+                <el-input
+                  class="input_width_lg"
+                  v-model="editStageCommonSettingForm.submitDuration"
+                  maxlength="10"
+                  @keyup.native="handleSubmitDuration"
+                >
                   <template slot="prepend">开考后</template>
                   <template slot="append">分钟</template>
                 </el-input>
@@ -566,6 +586,7 @@ export default {
         callback();
       }
     };
+
     return {
       loading: false,
       startExamDatetimeRange: [],
@@ -608,6 +629,7 @@ export default {
       editStageCommonSettingForm: {
         id: null,
         examId: null,
+        examName: "",
         submitType: "NORMAL",
         submitDuration: 0
       },
@@ -634,6 +656,29 @@ export default {
             validator: validateExamDatetimeRange,
             trigger: "blur"
           }
+        ],
+        submitDuration: [
+          {
+            required: true,
+            trigger: "blur",
+            message: "定点交卷时长不允许为空"
+          }
+        ]
+      },
+      commonSettingRules: {
+        submitType: [
+          {
+            required: true,
+            trigger: "change",
+            message: "请选择交卷类型"
+          }
+        ],
+        submitDuration: [
+          {
+            required: true,
+            trigger: "blur",
+            message: "定点交卷时长不允许为空"
+          }
         ]
       },
       tableData: [],
@@ -652,6 +697,18 @@ export default {
     }
   },
   methods: {
+    handleSubmitDuration() {
+      this.editStageCommonSettingForm.submitDuration = this.editStageCommonSettingForm.submitDuration.replace(
+        /[^\d]/g,
+        ""
+      );
+    },
+    handleSubmitDuration4editStage() {
+      this.editStageForm.submitDuration = this.editStageForm.submitDuration.replace(
+        /[^\d]/g,
+        ""
+      );
+    },
     handleAddStage() {
       this.resetAddStageForm();
       this.addStageVisible = true;
@@ -672,13 +729,13 @@ export default {
     },
     handleCommonSetting() {
       this.editStageCommonSettingForm.examId = this.formSearch.examId;
+      this.editStageCommonSettingForm.examName = this.examName;
       this.editStageCommonSettingForm.submitType = "NORMAL";
       this.editStageCommonSettingForm.submitDuration = 0;
       var url = EXAM_WORK_API + "/examStage/getExamStageSetting";
       this.$httpWithMsg
         .get(url, { params: this.formSearch })
         .then(response => {
-          debugger;
           if (response.data) {
             this.editStageCommonSettingForm.id = response.data.id;
             this.editStageCommonSettingForm.submitType =
@@ -979,13 +1036,21 @@ export default {
     },
     saveEditStageCommonSetting() {
       var url = EXAM_WORK_API + "/examStage/saveStageSetting";
-      this.$httpWithMsg.post(url, this.editStageCommonSettingForm).then(() => {
-        this.$notify({
-          type: "success",
-          message: "保存成功"
-        });
-        this.searchForm();
-        this.editStageCommonSettingVisible = false;
+      this.$refs.editStageCommonSettingForm.validate(valid => {
+        if (valid) {
+          this.$httpWithMsg
+            .post(url, this.editStageCommonSettingForm)
+            .then(() => {
+              this.$notify({
+                type: "success",
+                message: "保存成功"
+              });
+              this.searchForm();
+              this.editStageCommonSettingVisible = false;
+            });
+        } else {
+          return false;
+        }
       });
     },
 
@@ -1073,4 +1138,8 @@ export default {
 .editForm .el-form-item {
   margin-bottom: 12px;
 }
+
+.input_width_lg {
+  width: 300px;
+}
 </style>

+ 7 - 7
src/modules/oe/views/examScheduling.vue

@@ -520,13 +520,16 @@ export default {
     },
 
     calcSummary(fileList) {
-      this.summaryList = [];
-      this.md5Size = 0;
+      var summaryList = [];
+      var md5Size = 0;
+
       for (let i = 0; i < fileList.length; i++) {
         let f = fileList[i];
         this.getFileMD5(f.raw, md5 => {
-          this.summaryList.push({ index: i, summary: md5 });
-          this.md5Size++;
+          summaryList.push({ index: i, summary: md5 });
+          md5Size++;
+          this.summaryList = summaryList;
+          this.md5Size = md5Size;
         });
       }
     },
@@ -1002,7 +1005,6 @@ export default {
           this.search();
         })
         .catch(e => {
-          debugger;
           let errMsg = "上传失败";
           if (e.response) {
             errMsg = e.response.data.desc;
@@ -1018,8 +1020,6 @@ export default {
         });
     },
     beforeFileUpload(file) {
-      debugger;
-
       const isLt5M = file.size / 1024 / 1024 <= 5;
       if (!isLt5M) {
         this.$message.error("上传的单个数据文件大小不能超过5MB!");