Przeglądaj źródła

题卡编辑前页面信息缓存

zhangjie 4 lat temu
rodzic
commit
426ad352fa

+ 35 - 2
src/modules/customer/views/CustomerCard.vue

@@ -162,6 +162,7 @@ export default {
   data() {
     return {
       filter: {
+        schoolId: "",
         status: "STAGE",
         paperNumber: "",
         userId: "",
@@ -171,7 +172,8 @@ export default {
         finishEndTime: null
       },
       current: 1,
-      size: this.GLOBAL.pageSize,
+      size: 1,
+      // size: this.GLOBAL.pageSize,
       total: 0,
       multipleSelection: [],
       AUDITING_STATUS: {
@@ -193,9 +195,29 @@ export default {
     }
   },
   created() {
-    this.toPage(1);
+    this.initData();
   },
   methods: {
+    initData() {
+      const cachePageInfo = this.$ls.get("cachePageInfo");
+      if (cachePageInfo) {
+        this.filter = this.$objAssign(this.filter, cachePageInfo.filter);
+        if (this.filter.applyStartTime && this.filter.applyEndTime)
+          this.createTime = [
+            this.filter.applyStartTime,
+            this.filter.applyEndTime
+          ];
+        if (this.filter.finishStartTime && this.filter.finishEndTime)
+          this.finishTime = [
+            this.filter.finishStartTime,
+            this.filter.finishEndTime
+          ];
+        this.toPage(cachePageInfo.page);
+      } else {
+        this.toPage(1);
+      }
+      this.$ls.remove("cachePageInfo");
+    },
     async getList() {
       const datas = {
         ...this.filter,
@@ -288,6 +310,17 @@ export default {
         })
       );
     }
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.name === "CardDesign") {
+      this.$ls.set("cachePageInfo", {
+        page: this.current,
+        filter: this.filter
+      });
+    } else {
+      this.$ls.remove("cachePageInfo");
+    }
+    next();
   }
 };
 </script>

+ 48 - 1
src/modules/exam/components/ModifyTaskPaper.vue

@@ -11,6 +11,53 @@
       append-to-body
       @open="visibleChange"
     >
+      <div class="part-box part-box-pad part-box-border">
+        <el-form class="form-info" label-width="100px">
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="试卷编号:">
+                <span>{{ instance.paperNumber }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="课程(代码):">
+                <span>
+                  {{ instance.courseName }}({{ instance.courseCode }})
+                </span>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="卷型:">
+                <span>{{ instance.paperType }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="命题老师:">
+                <span>{{ instance.userName }}</span>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="已曝光:">
+                <span>{{
+                  instance.exposedPaperType | defaultFieldFilter
+                }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="未曝光:">
+                <span>{{
+                  instance.unexposedPaperType | defaultFieldFilter
+                }}</span>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+
       <div class="part-box part-box-pad part-box-border">
         <div v-if="IS_EDIT" class="mb-2 text-right">
           <el-button
@@ -132,7 +179,7 @@ const initTaskApply = {
   courseName: "",
   // 题卡状态
   status: "",
-  // 考务规则 TODO:
+  // 考务规则
   includePaper: false,
   customCard: false
 };

+ 19 - 1
src/modules/exam/components/WaitTaskExamTask.vue

@@ -75,9 +75,27 @@ export default {
     };
   },
   mounted() {
-    this.getList();
+    this.initData();
   },
   methods: {
+    async initData() {
+      const cachePageInfo = this.$ls.get("cachePageInfo");
+      if (cachePageInfo) {
+        this.current = cachePageInfo.page;
+        await this.getList();
+
+        this.$nextTick(() => {
+          const curRow = this.tasks.find(
+            item => item.id === cachePageInfo.curRowId
+          );
+          if (!curRow) return;
+          this.toDo(curRow);
+        });
+      } else {
+        this.toPage(1);
+      }
+      this.$ls.remove("cachePageInfo");
+    },
     async getList() {
       const datas = {
         pageNumber: this.current,

+ 35 - 3
src/modules/exam/views/TaskApplyManage.vue

@@ -232,11 +232,32 @@ export default {
       pickerOptions
     };
   },
-  created() {
-    this.getList();
+  mounted() {
+    this.initData();
   },
   methods: {
     ...mapActions("exam", ["updateWaitTaskCount"]),
+    async initData() {
+      const cachePageInfo = this.$ls.get("cachePageInfo");
+      if (cachePageInfo) {
+        this.filter = this.$objAssign(this.filter, cachePageInfo.filter);
+        if (this.filter.startTime && this.filter.endTime)
+          this.createTime = [this.filter.startTime, this.filter.endTime];
+        this.current = cachePageInfo.page;
+        await this.getList();
+
+        this.$nextTick(() => {
+          const curRow = this.examTasks.find(
+            item => item.id === cachePageInfo.curRowId
+          );
+          if (!curRow) return;
+          this.toEdit(curRow);
+        });
+      } else {
+        this.toPage(1);
+      }
+      this.$ls.remove("cachePageInfo");
+    },
     async getList() {
       const datas = {
         ...this.filter,
@@ -273,7 +294,6 @@ export default {
         .catch(() => {});
     },
     toEdit(row) {
-      console.log(row);
       this.curExamTask = row;
       this.editType = "APPLY";
       this.$refs.ModifyTaskApply.open();
@@ -287,6 +307,18 @@ export default {
       this.getList();
       this.updateWaitTaskCount(this.userRoles);
     }
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.name === "CardDesign") {
+      this.$ls.set("cachePageInfo", {
+        page: this.current,
+        filter: this.filter,
+        curRowId: this.curExamTask.id
+      });
+    } else {
+      this.$ls.remove("cachePageInfo");
+    }
+    next();
   }
 };
 </script>

+ 35 - 2
src/modules/exam/views/TaskPaperManage.vue

@@ -190,10 +190,31 @@ export default {
       pickerOptions
     };
   },
-  created() {
-    this.getList();
+  mounted() {
+    this.initData();
   },
   methods: {
+    async initData() {
+      const cachePageInfo = this.$ls.get("cachePageInfo");
+      if (cachePageInfo) {
+        this.filter = this.$objAssign(this.filter, cachePageInfo.filter);
+        if (this.filter.startTime && this.filter.endTime)
+          this.createTime = [this.filter.startTime, this.filter.endTime];
+        this.current = cachePageInfo.page;
+        await this.getList();
+
+        this.$nextTick(() => {
+          const curRow = this.papers.find(
+            item => item.id === cachePageInfo.curRowId
+          );
+          if (!curRow) return;
+          this.toEdit(curRow);
+        });
+      } else {
+        this.toPage(1);
+      }
+      this.$ls.remove("cachePageInfo");
+    },
     async getList() {
       const datas = {
         ...this.filter,
@@ -276,6 +297,18 @@ export default {
         this.$message.error("文件下载失败,请重新尝试!");
       }
     }
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.name === "CardDesign") {
+      this.$ls.set("cachePageInfo", {
+        page: this.current,
+        filter: this.filter,
+        curRowId: this.curPaper.id
+      });
+    } else {
+      this.$ls.remove("cachePageInfo");
+    }
+    next();
   }
 };
 </script>

+ 11 - 0
src/modules/exam/views/WaitTask.vue

@@ -69,6 +69,17 @@ export default {
         this.$refs.WaitTaskAudit.getList();
       }
     }
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.name === "CardDesign" && this.IS_QUESTION_TEACHER) {
+      this.$ls.set("cachePageInfo", {
+        page: this.$refs.WaitTaskExamTask.current,
+        curRowId: this.$refs.WaitTaskExamTask.curTask.id
+      });
+    } else {
+      this.$ls.remove("cachePageInfo");
+    }
+    next();
   }
 };
 </script>