From f72f8966ba4e1715e8df82d5cf1c7e912b6da719 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期一, 01 四月 2024 10:21:07 +0800
Subject: [PATCH] 检索的bug

---
 packageBookService/pages/bookServices/list/index.js |   78 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 68 insertions(+), 10 deletions(-)

diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js
index 5cd1be5..f8279a2 100644
--- a/packageBookService/pages/bookServices/list/index.js
+++ b/packageBookService/pages/bookServices/list/index.js
@@ -34,7 +34,6 @@
       options: [],
       disabled: false,
     },
-    disabledSecondList: false,
     majorProjectList: {
       value: [],
       options: [],
@@ -53,6 +52,12 @@
     loading: false,
     noData: false,
     showDropdown: false,
+    isRequesting: false,
+    disabledStair: false,
+    disabledSecondList: false,
+    disabledProject: false,
+    disabledNewForms: false,
+    triggered: false,
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -134,7 +139,13 @@
    * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
    */
   onPullDownRefresh() {
-    console.log('涓嬫媺');
+    this.setData({
+      triggered: true
+    })
+    this.setData({
+      'pageCount.page': 1
+    })
+    this.getBookList(this.data.path);
   },
 
   /**
@@ -143,11 +154,13 @@
   onReachBottom(e) {
     const flag = this.data.bookList.length < this.data.pageCount.total
     if (flag) {
-      this.setData({
-        isMore: true,
-        "pageCount.page": this.data.pageCount.page + 1
-      })
-      this.getBookList(this.data.path)
+      if (!this.data.isRequesting) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.getBookList(this.data.path)
+      }
     } else {
       this.setData({
         isMore: true,
@@ -170,6 +183,9 @@
   },
   // 鑾峰彇涓�绾у垪琛�
   getStairList(path) {
+    this.setData({
+      disabledStair: false
+    })
     const query = {
       path,
       filterList: [],
@@ -199,6 +215,11 @@
         'stairList.options': options,
         'stairList.value': this.data.stairCode,
       });
+      if (!options.length) {
+        this.setData({
+          disabledStair: true
+        })
+      }
     });
   },
   // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被
@@ -236,6 +257,10 @@
   },
   // 鑾峰彇閲嶇偣椤圭洰
   getProjectList(type) {
+    this.setData({
+      disabledProject: false,
+      disabledNewForms: false
+    })
     const options = [];
     const arr = [];
     let array = [];
@@ -243,7 +268,7 @@
       refCodes: [type],
     };
     app.MG.store.getProductTypeField(query).then((res) => {
-      array = JSON.parse(res[0].config).option;
+      array = JSON.parse(res[0].config).option.filter(item => item.value == this.data.assortCheck.code);
       for (let index = 0; index < array.length; index++) {
         const element = array[index];
         if (element.child) {
@@ -261,6 +286,11 @@
             label: element.name,
           });
         }
+        if (!options.length) {
+          this.setData({
+            disabledProject: true
+          })
+        }
         this.setData({
           'majorProjectList.options': options,
         });
@@ -272,6 +302,11 @@
             label: element.name,
           });
         }
+        if (!options.length) {
+          this.setData({
+            disabledNewForms: true
+          })
+        }
         this.setData({
           'newTextBook.options': options,
         });
@@ -281,9 +316,13 @@
   },
   // 鑾峰彇鍥句功鍒楄〃
   getBookList(path) {
+    if (this.data.isRequesting) {
+      return false;
+    }
     this.setData({
       loading: true,
-      noData: false
+      noData: false,
+      isRequesting: true
     })
     let sort;
     let pathObj = {};
@@ -342,12 +381,31 @@
         bookList: res.datas,
         enable: false,
         "pageCount.total": res.total,
-        loading: false
+        loading: false,
+        isRequesting: false
       });
       if (!res.datas.length) {
         this.setData({
           noData: true,
         })
+        if (!this.data.pathList.length) {
+          // 鏈�夋嫨浜岀骇鍒嗙被锛屼笖鏃犲浘涔�
+          this.setData({
+            disabledSecondList: true
+          })
+        } else {
+          this.setData({
+            disabledSecondList: false
+          })
+        }
+      }
+      if (this.data.triggered) {
+        this.setData({
+          triggered: false
+        })
+        wx.showToast({
+          title: '鍒锋柊鎴愬姛',
+        })
       }
     });
   },

--
Gitblit v1.9.1