فهرست منبع

feat:考试明细页面,从详情页返回列表,自动定位到当前考试所在分页,并选中考试记录.

chenhao 2 سال پیش
والد
کامیت
3fbf9d2e5f
1فایلهای تغییر یافته به همراه31 افزوده شده و 4 حذف شده
  1. 31 4
      src/modules/oe/views/examDetail.vue

+ 31 - 4
src/modules/oe/views/examDetail.vue

@@ -203,7 +203,7 @@
                     currentPagePrivileges.SNAPSHOT_DETAILS
                   "
                   type="text"
-                  @click="gotoCaptureDetail(scope.row.dataId)"
+                  @click="gotoCaptureDetail(scope.row)"
                   >{{ scope.row.dataId }}</el-button
                 >
                 <span
@@ -586,6 +586,27 @@ import _ from "lodash";
 export default {
   components: { commonFormVue },
   mixins: [pagePrivilege],
+  beforeRouteEnter(to, from, next) {
+    next((vm) => {
+      if (from.params?.checkedRows) {
+        const unwatch = vm.$watch("tableData", (tableData = []) => {
+          tableData.forEach((d) => {
+            vm.$refs["multipleTable"]?.toggleRowSelection(
+              d,
+              from.params.checkedRows.includes(d.dataId)
+            );
+          });
+          if (unwatch) {
+            unwatch();
+          }
+        });
+      }
+    });
+  },
+  beforeRouteLeave(to, from, next) {
+    to.params.checkedRows = this.selectedIds;
+    next();
+  },
   data() {
     return {
       isOnlineExam: false,
@@ -842,9 +863,15 @@ export default {
         "/admin/oe/examPaperDetail/" + courseId + "/" + examRecordDataId
       );
     },
-    gotoCaptureDetail(examRecordDataId) {
-      this.$router.push({
-        path: "/oe/captureDetail/" + examRecordDataId + "/examDetail",
+    gotoCaptureDetail(row) {
+      this.$refs["multipleTable"]?.toggleRowSelection(row, true);
+      this.$nextTick(() => {
+        /** checkbox UI选中状态延迟 */
+        setTimeout(() => {
+          this.$router.push({
+            path: "/oe/captureDetail/" + row.examRecordDataId + "/examDetail",
+          });
+        }, 200);
       });
     },
     exportData() {