Procházet zdrojové kódy

合伙人-合伙人列表搜索优化

panyong před 4 roky
rodič
revize
5d4f4cc874

+ 19 - 14
htmldev/loan/src/views/partner/all/components/main.vue

@@ -53,7 +53,8 @@
         numFetchStatus: 0,
         arrFetchStatus: ['正在加载,请稍后~', '上拉加载更多', '没有更多了', '出错啦'],
         booFetchData: false,
-        numPositionY: 0
+        numPositionY: 0,
+        flag: true
       }
     },
     activated () {
@@ -67,6 +68,7 @@
         this.numFetchStatus = 0
         this.booFetchData = false
         this.numPositionY = 0
+        this.flag = true
         this.funFetch()
       } else {
         this.$nextTick(() => {
@@ -88,19 +90,16 @@
     watch: {
       search: {
         handler: function (val) {
-          const timer = setTimeout(() => {
-            clearTimeout(timer)
-            this.pager = {
-              pagenum: 1,
-              pagesize: PAGESIZE,
-              pagecount: 1
-            }
-            this.listData = []
-            this.numFetchStatus = 0
-            this.booFetchData = false
-            this.numPositionY = 0
-            this.funFetch()
-          }, 1000)
+          this.pager = {
+            pagenum: 1,
+            pagesize: PAGESIZE,
+            pagecount: 1
+          }
+          this.listData = []
+          this.numFetchStatus = 0
+          this.booFetchData = false
+          this.numPositionY = 0
+          this.funFetch()
         }
       }
     },
@@ -109,7 +108,12 @@
         const vm = this
         const partnerStatus = this.$route.name === 'partnerUnsigned' ? '2' : (this.$route.name === 'partnerSign' ? '1' : '0')
         vm.numFetchStatus = 0
+        if (!vm.flag) {
+          return
+        }
+        vm.flag = false
         partnerList(vm.pager.pagenum, vm.pager.pagesize, this.search, partnerStatus).then(response => {
+          vm.flag = true
           if (response.status) {
             const data = response.data
             const temp = data.data
@@ -151,6 +155,7 @@
             vm.numFetchStatus = 3
           }
         }).catch(() => {
+          vm.flag = true
           Toast('出错啦')
           vm.numFetchStatus = 3
         })