浏览代码

页面返回时,保留场次选择值

lideyin 4 年之前
父节点
当前提交
cf27d12bdf
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      src/modules/oe/component/commonForm.vue

+ 15 - 1
src/modules/oe/component/commonForm.vue

@@ -222,7 +222,10 @@ export default {
         });
         });
     },
     },
     changeExam(examId) {
     changeExam(examId) {
-      this.form.examStageId = "";
+      // if (this.form.clearStageOnChangeExam != false) {
+      //   this.form.examStageId = "";
+      // }
+
       this.examList.forEach(exam => {
       this.examList.forEach(exam => {
         if (exam.id == examId) {
         if (exam.id == examId) {
           this.form.examType = exam.examType;
           this.form.examType = exam.examType;
@@ -244,6 +247,7 @@ export default {
           } else {
           } else {
             this.examStageList4Search = [];
             this.examStageList4Search = [];
             this.examStageDisabled4Search = true;
             this.examStageDisabled4Search = true;
+            this.form.examStageId = "";
           }
           }
         }
         }
       }
       }
@@ -285,6 +289,16 @@ export default {
           if ("search" == where) {
           if ("search" == where) {
             this.queryExamStages4SearchLoading = false;
             this.queryExamStages4SearchLoading = false;
             this.examStageList4Search = response.data;
             this.examStageList4Search = response.data;
+            if (
+              !(
+                this.examStageList4Search.length > 0 &&
+                this.examStageList4Search.some(
+                  p => p.id == this.form.examStageId
+                )
+              )
+            ) {
+              this.form.examStageId = "";
+            }
           } else if ("insertOrUpdate" == where) {
           } else if ("insertOrUpdate" == where) {
             this.queryExamStages4InsertOrUpdateLoading = false;
             this.queryExamStages4InsertOrUpdateLoading = false;
             this.examStageList4InsertOrUpdate = response.data;
             this.examStageList4InsertOrUpdate = response.data;