Prechádzať zdrojové kódy

支持上一页、下一页

deason 2 rokov pred
rodič
commit
17af0043f7

+ 44 - 23
src/modules/oe/views/alreadyAudited.vue

@@ -431,6 +431,7 @@
         <ExamRecordDetail
           :exam-record-data-id="curSelectedExamRecordDataId"
           :show-audit-button="curSelectedShowAuditButton"
+          :need-loading="needLoading"
           @changeExamRecordData="changeExamRecordData"
           @auditExamRecordData="auditExamRecordData"
         ></ExamRecordDetail>
@@ -451,6 +452,7 @@ export default {
     return {
       curSelectedExamRecordDataId: null,
       curSelectedShowAuditButton: false,
+      needLoading: false,
       examRecordDataDialog: false,
       toNext: false,
       curTotalPages: 0,
@@ -705,7 +707,7 @@ export default {
       this.resetForm();
       this.showAllCondition = false;
     },
-    search(type) {
+    async search(type) {
       if (!this.form.examId) {
         this.$notify({
           title: "警告",
@@ -728,7 +730,7 @@ export default {
       //   params.status = "UN_PASS";
       // }
 
-      this.$http
+      await this.$http
         .post("/api/ecs_oe_admin/exam/audit/list", params)
         .then((response) => {
           if (response.data) {
@@ -792,7 +794,7 @@ export default {
       this.curSelectedExamRecordDataId = examRecordDataId;
       this.curSelectedRow(examRecordDataId);
     },
-    changeExamRecordData(isNext) {
+    async changeExamRecordData(isNext) {
       // console.log("isNext:" + isNext);
       let curId = null;
       let isFirst = false;
@@ -808,31 +810,50 @@ export default {
             if (!isLast) {
               curId = this.tableData[n + 1].examRecordDataId;
             } else {
-              // if (this.form.pageNo < this.curTotalPages) {
-              //   // 跳到下一页
-              //   curId = null;
-              //   this.handleCurrentChange(this.form.pageNo + 1);
-              // }
-              this.$message({
-                message: "当前数据为最后一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo < this.curTotalPages) {
+                // 跳到下一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo + 1;
+                console.log("+++>toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId = this.tableData[0].examRecordDataId;
+                }
+              } else {
+                this.$message({
+                  message: "当前数据为最后一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
             }
           } else {
             if (!isFirst) {
               curId = this.tableData[n - 1].examRecordDataId;
             } else {
-              // if (this.form.pageNo > 1) {
-              //   // 跳到上一页
-              //   curId = null;
-              //   this.handleCurrentChange(this.form.pageNo - 1);
-              // }
-              this.$message({
-                message: "当前数据为第一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo > 1) {
+                // 跳到上一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo - 1;
+                console.log("--->toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId =
+                    this.tableData[this.tableData.length - 1].examRecordDataId;
+                }
+              } else {
+                this.$message({
+                  message: "当前数据为第一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
             }
           }
           break;

+ 43 - 23
src/modules/oe/views/examDetail.vue

@@ -565,6 +565,7 @@
         <ExamRecordDetail
           :exam-record-data-id="curSelectedExamRecordDataId"
           :show-audit-button="curSelectedShowAuditButton"
+          :need-loading="needLoading"
           @changeExamRecordData="changeExamRecordData"
         ></ExamRecordDetail>
       </el-dialog>
@@ -604,6 +605,7 @@ export default {
     return {
       curSelectedExamRecordDataId: null,
       curSelectedShowAuditButton: false,
+      needLoading: false,
       examRecordDataDialog: false,
       toNext: false,
       curTotalPages: 0,
@@ -791,7 +793,7 @@ export default {
         this.form.endTime = "";
       }
     },
-    search(type) {
+    async search(type) {
       if (!this.form.examId) {
         this.$notify({
           title: "警告",
@@ -811,7 +813,7 @@ export default {
       this.needShowReAudit = false;
 
       var params = JSON.parse(JSON.stringify(this.form));
-      this.$http
+      await this.$http
         .post("/api/ecs_oe_admin/exam/record/detail/list", params)
         .then((response) => {
           if (response.data) {
@@ -882,7 +884,7 @@ export default {
       this.curSelectedExamRecordDataId = examRecordDataId;
       this.curSelectedRow(examRecordDataId);
     },
-    changeExamRecordData(isNext) {
+    async changeExamRecordData(isNext) {
       // console.log("isNext:" + isNext);
       let curId = null;
       let isFirst = false;
@@ -898,31 +900,49 @@ export default {
             if (!isLast) {
               curId = this.tableData[n + 1].dataId;
             } else {
-              // if (this.form.pageNo < this.curTotalPages) {
-              //   // 跳到下一页
-              //   curId = null;
-              //   this.handleCurrentChange(this.form.pageNo + 1);
-              // }
-              this.$message({
-                message: "当前数据为最后一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo < this.curTotalPages) {
+                // 跳到下一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo + 1;
+                console.log("+++>toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId = this.tableData[0].dataId;
+                }
+              } 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);
-              // }
-              this.$message({
-                message: "当前数据为第一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo > 1) {
+                // 跳到上一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo - 1;
+                console.log("--->toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId = this.tableData[this.tableData.length - 1].dataId;
+                }
+              } else {
+                this.$message({
+                  message: "当前数据为第一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
             }
           }
           break;

+ 44 - 23
src/modules/oe/views/illegalityNameList.vue

@@ -214,6 +214,7 @@
         <ExamRecordDetail
           :exam-record-data-id="curSelectedExamRecordDataId"
           :show-audit-button="curSelectedShowAuditButton"
+          :need-loading="needLoading"
           @changeExamRecordData="changeExamRecordData"
         ></ExamRecordDetail>
       </el-dialog>
@@ -233,6 +234,7 @@ export default {
     return {
       curSelectedExamRecordDataId: null,
       curSelectedShowAuditButton: false,
+      needLoading: false,
       examRecordDataDialog: false,
       toNext: false,
       curTotalPages: 0,
@@ -331,7 +333,7 @@ export default {
         examStageId: null,
       };
     },
-    search(type) {
+    async search(type) {
       if (!this.form.examId) {
         this.$notify({
           title: "警告",
@@ -349,7 +351,7 @@ export default {
       if (params.examStageId == "") {
         params.examStageId = null;
       }
-      this.$http
+      await this.$http
         .post("/api/ecs_oe_admin/exam/audit/discipline/list", params)
         .then((response) => {
           if (response.data) {
@@ -393,7 +395,7 @@ export default {
       this.curSelectedShowAuditButton = showAuditButton;
       this.curSelectedExamRecordDataId = examRecordDataId;
     },
-    changeExamRecordData(isNext) {
+    async changeExamRecordData(isNext) {
       // console.log("isNext:" + isNext);
       let curId = null;
       let isFirst = false;
@@ -409,31 +411,50 @@ export default {
             if (!isLast) {
               curId = this.tableData[n + 1].examRecordDataId;
             } else {
-              // if (this.form.pageNo < this.curTotalPages) {
-              //   // 跳到下一页
-              //   curId = null;
-              //   this.handleCurrentChange(this.form.pageNo + 1);
-              // }
-              this.$message({
-                message: "当前数据为最后一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo < this.curTotalPages) {
+                // 跳到下一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo + 1;
+                console.log("+++>toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId = this.tableData[0].examRecordDataId;
+                }
+              } else {
+                this.$message({
+                  message: "当前数据为最后一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
             }
           } else {
             if (!isFirst) {
               curId = this.tableData[n - 1].examRecordDataId;
             } else {
-              // if (this.form.pageNo > 1) {
-              //   // 跳到上一页
-              //   curId = null;
-              //   this.handleCurrentChange(this.form.pageNo - 1);
-              // }
-              this.$message({
-                message: "当前数据为第一条!",
-                type: "warning",
-                showClose: true,
-              });
+              if (this.form.pageNo > 1) {
+                // 跳到上一页
+                curId = null;
+                this.form.pageNo = this.form.pageNo - 1;
+                console.log("--->toPage:" + this.form.pageNo);
+                this.needLoading = true;
+                await this.search();
+                this.needLoading = false;
+
+                if (this.tableData.length > 0) {
+                  curId =
+                    this.tableData[this.tableData.length - 1].examRecordDataId;
+                }
+              } else {
+                this.$message({
+                  message: "当前数据为第一条!",
+                  type: "warning",
+                  showClose: true,
+                });
+              }
             }
           }
           break;