浏览代码

首页分页修复

曹冬冬 5 年之前
父节点
当前提交
663f3ce19f
共有 1 个文件被更改,包括 16 次插入3 次删除
  1. 16 3
      src/views/myHistoryTest/myHistoryTest.js

+ 16 - 3
src/views/myHistoryTest/myHistoryTest.js

@@ -69,24 +69,31 @@ export default {
         this.houseList = res.list;
       }
     });
-    this.getTestList();
+    this.getTestList(true);
   },
   methods: {
     dataformat(val) {
       return timeFormat.dateStr(val);
     },
-    getTestList() {
+    getTestList(isFirst) {
+      if (isFirst) {
+        this.pageNo = 1;
+      }
+      console.log("XSSSSSSS", isFirst)
       console.log("加载第" + this.pageNo + "页");
       this.loading = true
       let data = {
         "orderType": this.currOrderType,
         "houseNameList": this.ownHouseName == "所属项目" ? '' : this.ownHouseName,
         "pageNo": this.pageNo++,
-        "pageSize": 39
+        "pageSize": isFirst ? 39 : 40
       }
       api.testList(data).then((res) => {
         if (res.success) {
           this.total = res.pageModel.total;
+          if (isFirst) {
+            this.dataList = [];
+          }
           this.dataList.push(...res.pageModel.resultSet);
           console.log("success", this.dataList, res.pageModel);
         } else {
@@ -94,6 +101,12 @@ export default {
         }
         this.loading = false
       })
+        .then(() => {
+          this.loading = false
+        })
+        .catch(() => {
+          this.loading = false
+        });
     },
     projectCommand(command) {
       if (this.houseList.indexOf(command) == -1) {