Эх сурвалжийг харах

监考待审-考试记录详情改造

deason 2 жил өмнө
parent
commit
b41eb6541c

+ 44 - 21
src/modules/oe/component/ExamRecordDetail.vue

@@ -11,34 +11,42 @@
           <el-col :span="8" class="capture-title">
             <span>考试记录ID:{{ examRecordDataId }}</span>
           </el-col>
-          <el-col v-if="showAudit" :span="8" style="text-align: center">
-            <el-button
-              circle
-              size="small"
-              type="primary"
-              icon="el-icon-d-arrow-left"
-              title="上一条"
-            ></el-button>
+          <el-col v-if="showAuditButton" :span="8" style="text-align: center">
             <el-button
               size="small"
               type="success"
-              icon="el-icon-success"
-              title="通过"
+              icon="el-icon-check"
+              :disabled="!needAudit"
+              round
+              @click="auditExamRecordData(true)"
               >通过</el-button
             >
             <el-button
               size="small"
               type="danger"
-              icon="el-icon-error"
-              title="不通过"
+              icon="el-icon-close"
+              :disabled="!needAudit"
+              round
+              @click="auditExamRecordData(false)"
               >不通过</el-button
             >
+          </el-col>
+
+          <el-col :span="showAuditButton ? 8 : 16" style="text-align: right">
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-arrow-left"
+              round
+              @click="changeExamRecordData(false)"
+              >上一条</el-button
+            >
             <el-button
-              circle
               size="small"
               type="primary"
-              icon="el-icon-d-arrow-right"
-              title="下一条"
+              round
+              @click="changeExamRecordData(true)"
+              >下一条 <i class="el-icon-arrow-right el-icon--right"></i
             ></el-button>
           </el-col>
         </el-row>
@@ -206,17 +214,21 @@ export default {
   props: {
     examRecordDataId: {
       type: Number,
-      default: 0,
+      default: null,
+    },
+    showAuditButton: {
+      type: Boolean,
+      default: false,
     },
   },
   data() {
     return {
-      showAudit: true,
       examRecordData: [],
       photoCaptures: [],
       examProcessRecords: [],
       studentBasePhotoPath: "",
       syncCapturePhotoPath: "",
+      needAudit: false,
     };
   },
   computed: {
@@ -231,18 +243,26 @@ export default {
     this.initDetail();
   },
   methods: {
+    changeExamRecordData(isNext) {
+      this.$emit("changeExamRecordData", isNext);
+    },
+    auditExamRecordData(isPass) {
+      this.$emit("auditExamRecordData", isPass);
+    },
     initDetail() {
-      console.log("examRecordDataId:" + this.examRecordDataId);
       if (this.examRecordDataId) {
+        console.log("examRecordDataId:" + this.examRecordDataId);
         this.getExamRecordData();
         this.getPhotoCaptures();
         this.getExamProcessRecords();
       } else {
+        console.log("initDetail...");
         this.examRecordData = [];
         this.photoCaptures = [];
         this.examProcessRecords = [];
         this.studentBasePhotoPath = "";
         this.syncCapturePhotoPath = "";
+        this.needAudit = false;
       }
     },
     getExamRecordData() {
@@ -258,6 +278,9 @@ export default {
             if (result.syncCaptureFileUrl) {
               this.syncCapturePhotoPath = result.syncCaptureFileUrl;
             }
+            if (this.showAuditButton) {
+              this.needAudit = result.isWarn;
+            }
             this.getStudentInfo(result.studentId);
           }
         });
@@ -304,9 +327,9 @@ export default {
     },
     disciplineTypeFilter: function (value) {
       if (value && value.indexOf("&&") > -1) {
-        var arr = value.split("&&");
-        var detail = "";
-        for (var i = 0; i < arr.length; i++) {
+        let arr = value.split("&&");
+        let detail = "";
+        for (let i = 0; i < arr.length; i++) {
           detail += arr[i] + "<br>";
         }
         return detail;

+ 146 - 56
src/modules/oe/views/awaitingAudit.vue

@@ -363,7 +363,7 @@
                             size="mini"
                             type="success"
                             icon="el-icon-success"
-                            @click="auditPass(scope.row.dataId)"
+                            @click="auditPass(scope.row.dataId, false)"
                             >通&nbsp;&nbsp;&nbsp;&nbsp;过</el-button
                           >
                         </el-dropdown-item>
@@ -373,7 +373,7 @@
                             size="mini"
                             type="danger"
                             icon="el-icon-error"
-                            @click="openAuditDialog(scope.row.dataId)"
+                            @click="openAuditDialog(scope.row.dataId, false)"
                             >不通过</el-button
                           >
                         </el-dropdown-item>
@@ -399,6 +399,7 @@
       </el-row>
       <el-dialog
         title="审核"
+        width="400px"
         :visible.sync="dialogFormVisible"
         @closed="auditDialogClosed"
       >
@@ -432,7 +433,7 @@
             <el-input
               v-model="auditForm.disciplineDetail"
               type="textarea"
-              :autosize="{ minRows: 6, maxRows: 10 }"
+              :autosize="{ minRows: 3, maxRows: 5 }"
               placeholder="请输入内容"
             ></el-input>
           </el-form-item>
@@ -443,7 +444,8 @@
         </el-form>
       </el-dialog>
       <el-dialog
-        title="审核"
+        title="批量审核"
+        width="400px"
         :visible.sync="dialogBatchFormVisible"
         @closed="batchAuditDialogClosed"
       >
@@ -477,7 +479,7 @@
             <el-input
               v-model="batchAuditForm.disciplineDetail"
               type="textarea"
-              :autosize="{ minRows: 6, maxRows: 10 }"
+              :autosize="{ minRows: 3, maxRows: 5 }"
               placeholder="请输入内容"
             ></el-input>
           </el-form-item>
@@ -496,6 +498,9 @@
       >
         <ExamRecordDetail
           :exam-record-data-id="curSelectedExamRecordDataId"
+          :show-audit-button="curSelectedShowAuditButton"
+          @changeExamRecordData="changeExamRecordData"
+          @auditExamRecordData="auditExamRecordData"
         ></ExamRecordDetail>
       </el-dialog>
     </el-main>
@@ -509,31 +514,34 @@ 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.routeSelectedIds;
-    next();
-  },
+  // 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.routeSelectedIds;
+  //   next();
+  // },
   data() {
     return {
       curSelectedExamRecordDataId: null,
+      curSelectedShowAuditButton: false,
       examRecordDataDialog: false,
+      toNext: false,
+      curTotalPages: 0,
       routeSelectedIds: [],
       total: 0,
       tableLoading: false,
@@ -609,7 +617,7 @@ export default {
     },
   },
   created() {
-    this.backFill();
+    // this.backFill();
     this.getDisciplineTypeList("");
   },
   methods: {
@@ -688,13 +696,14 @@ export default {
             this.tableData = response.data.content;
             this.total = response.data.totalElements;
             this.form.pageNo = response.data.number + 1;
+            this.curTotalPages = response.data.totalPages;
           } else {
             this.tableData = [];
           }
           this.tableLoading = false;
-          this.$router.push({
-            path: "/oe/awaitingAudit?" + new URLSearchParams(params),
-          });
+          // this.$router.push({
+          //   path: "/oe/awaitingAudit?" + new URLSearchParams(params),
+          // });
         });
     },
     formatVirtualCameraName(row) {
@@ -749,12 +758,13 @@ export default {
                 type: "success",
                 duration: 5000,
               });
-              this.search();
+              // this.search();
             });
         })
         .catch(() => {});
     },
-    openAuditDialog(examRecordDataId) {
+    openAuditDialog(examRecordDataId, toNext) {
+      this.toNext = toNext;
       this.dialogFormVisible = true;
       this.auditForm = {
         examRecordDataId: examRecordDataId,
@@ -795,7 +805,10 @@ export default {
                 duration: 5000,
               });
               this.dialogFormVisible = false;
-              this.search();
+              // this.search();
+              if (this.toNext) {
+                this.changeExamRecordData(true);
+              }
             });
         } else {
           return false;
@@ -821,7 +834,7 @@ export default {
                   duration: 5000,
                 });
                 this.dialogBatchFormVisible = false;
-                this.search();
+                // this.search();
               });
           });
         } else {
@@ -838,7 +851,7 @@ export default {
     /**
      * 审核通过
      */
-    auditPass(examRecordDataId) {
+    auditPass(examRecordDataId, toNext) {
       var auditParams = {
         examRecordDataId: examRecordDataId,
         isPass: true,
@@ -847,22 +860,101 @@ export default {
       this.$http
         .post("/api/ecs_oe_admin/exam/audit/single/audit", param)
         .then(() => {
-          this.search();
           this.$notify({
             title: "成功",
             message: "操作成功",
             type: "success",
             duration: 5000,
           });
+
+          // this.search();
+          if (toNext) {
+            this.changeExamRecordData(true);
+          }
         });
     },
+    curSelectedRow(examRecordDataId) {
+      for (let n = 0; n < this.tableData.length; n++) {
+        let row = this.tableData[n];
+        if (examRecordDataId === row.dataId) {
+          this.$refs["multipleTable"]?.toggleRowSelection(row, true);
+        } else {
+          this.$refs["multipleTable"]?.toggleRowSelection(row, false);
+        }
+      }
+    },
     examRecordDataDialogClose() {
-      this.curSelectedExamRecordDataId = null;
       this.examRecordDataDialog = false;
     },
-    examRecordDataDialogOpen(row) {
-      this.curSelectedExamRecordDataId = row.dataId;
+    examRecordDataDialogOpen(examRecordDataId, showAuditButton) {
       this.examRecordDataDialog = true;
+      this.curSelectedShowAuditButton = showAuditButton;
+      this.curSelectedExamRecordDataId = examRecordDataId;
+      this.curSelectedRow(examRecordDataId);
+    },
+    changeExamRecordData(isNext) {
+      console.log("isNext:" + isNext);
+      let curId = null;
+      let isFirst = false;
+      let isLast = false;
+      let rowSize = this.tableData.length;
+      for (let n = 0; n < rowSize; n++) {
+        isFirst = n === 0;
+        isLast = n === rowSize - 1;
+        let row = this.tableData[n];
+        if (this.curSelectedExamRecordDataId === row.dataId) {
+          curId = row.dataId;
+          if (isNext) {
+            if (!isLast) {
+              curId = this.tableData[n + 1].dataId;
+            } else {
+              if (this.form.pageNo < this.curTotalPages) {
+                // 跳到下一页
+                curId = null;
+                this.handleCurrentChange(this.form.pageNo + 1);
+              } else {
+                this.$message({
+                  message: "当前数据为最后一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
+            }
+          } else {
+            if (!isFirst) {
+              curId = this.tableData[n - 1].dataId;
+            } else {
+              if (this.form.pageNo > 1) {
+                // 跳到上一页
+                curId = null;
+                this.handleCurrentChange(this.form.pageNo - 1);
+              } else {
+                this.$message({
+                  message: "当前数据为第一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
+            }
+          }
+          break;
+        }
+      }
+
+      if (curId) {
+        this.curSelectedExamRecordDataId = curId;
+        this.curSelectedRow(curId);
+      } else {
+        this.examRecordDataDialogClose();
+      }
+    },
+    auditExamRecordData(isPass) {
+      console.log("isPass:" + isPass);
+      if (isPass) {
+        this.auditPass(this.curSelectedExamRecordDataId, true);
+      } else {
+        this.openAuditDialog(this.curSelectedExamRecordDataId, true);
+      }
     },
     gotoCaptureDetail(row) {
       if (!this.form.examId) {
@@ -875,25 +967,23 @@ export default {
         return false;
       }
 
-      // this.examRecordDataDialogOpen(row);
-      // if (true) return;
+      // let pendingOperate = !this.currentPagePrivileges.PENDING_OPERATE;
+      this.examRecordDataDialogOpen(row.dataId, true);
 
-      let pendingOperate = !this.currentPagePrivileges.PENDING_OPERATE;
-      let searchParam = JSON.stringify(this.form);
+      // this.routeSelectedIds = [];
+      // this.routeSelectedIds.push(row.dataId);
+      // this.$refs["multipleTable"]?.toggleRowSelection(row, true);
 
-      this.routeSelectedIds = [];
-      this.routeSelectedIds.push(row.dataId);
-      this.$refs["multipleTable"]?.toggleRowSelection(row, true);
-      this.$nextTick(() => {
-        /** checkbox UI选中状态延迟 */
-        setTimeout(() => {
-          this.$router.push({
-            path: "/oe/captureDetail/" + row.dataId + "/awaitingAudit",
-            // name: "captureDetail",
-            query: { pendingOperate, searchParam },
-          });
-        }, 200);
-      });
+      // let searchParam = JSON.stringify(this.form);
+      // this.$nextTick(() => {
+      //   /** checkbox UI选中状态延迟 */
+      //   setTimeout(() => {
+      //     this.$router.push({
+      //       path: "/oe/captureDetail/" + row.dataId + "/awaitingAudit",
+      //       query: { pendingOperate, searchParam },
+      //     });
+      //   }, 200);
+      // });
     },
     backFill() {
       var formData = this.$route.query;