From 994a722829bd01de4b24f85c359b84dbf4047997 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 18 十一月 2022 08:56:31 +0800
Subject: [PATCH] 1.综合看板改为翻页形式

---
 src/views/kb/zhkb.vue |   67 ++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/src/views/kb/zhkb.vue b/src/views/kb/zhkb.vue
index 2bdb36a..ba642b3 100644
--- a/src/views/kb/zhkb.vue
+++ b/src/views/kb/zhkb.vue
@@ -332,6 +332,7 @@
 
       leftTopData: [],
       tableData: [],
+      tableDataTemp: [],
       tableDataRank: [],
       lineCodeArr: [],
 
@@ -408,7 +409,6 @@
       await this.getEcharts()
       await this.getTableDataRoll()
       await this.getTableDataRankRoll()
-      await this.getMarqueeTipsContent()
       await this.getMarqueeTipsContent()
     },
     // 鑾峰彇鍏憡
@@ -489,31 +489,54 @@
 
     // 浜х嚎鍔犲伐浠诲姟
     getTableDataRoll() {
-      LineSearchBottomLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
-        this.tableData = res.data
-        this.number2 = this.tableData.length
+      let startValue = 0 // 鍒濆鍊�
+      const scale = 10// 鍒诲害
 
-        const divData = this.$refs.tableData.bodyWrapper
-        // 鎷垮埌鍏冪礌鍚庯紝瀵瑰厓绱犺繘琛屽畾鏃跺鍔犺窛绂婚《閮ㄨ窛绂伙紝瀹炵幇婊氬姩鏁堟灉(姝ら厤缃负姣�100姣绉诲姩1鍍忕礌)
+      LineSearchBottomLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
+        this.tableDataTemp = res.data
+        this.number2 = res.data.length
+
+        this.tableData = this.tableDataTemp.slice(startValue, startValue + scale)
+
+        const loop = Math.floor(this.tableDataTemp.length / scale)// 闇�瑕佸惊鐜殑娆℃暟
+        let nowLoop = 0// 褰撳墠寰幆鐨勬鏁�
+
         this.TableDataRollTask = setInterval(() => {
-          // 鍏冪礌鑷璺濈椤堕儴1鍍忕礌
-          divData.scrollTop += 1
-          // divData.scrollTop += divData.scrollHeight / this.tableData.length
-          // 鍒ゆ柇鍏冪礌鏄惁婊氬姩鍒板簳閮�(鍙楂樺害+璺濈椤堕儴=鏁翠釜楂樺害)
-          if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
-            // 閲嶇疆table璺濈椤堕儴璺濈
-            divData.scrollTop = 0
-            LineSearchBottomLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
-              this.tableData = res.data
-              this.number2 = this.tableData.length
-              if (this.tableData.length > 10) {
-                clearInterval(this.TableDataRollTask)
-                this.getTableDataRoll()
-              }
-            })
+          startValue = startValue + scale
+          this.tableData = this.tableDataTemp.slice(startValue, startValue + scale)
+          if (nowLoop === loop) {
+            clearInterval(this.TableDataRollTask)
+            this.getTableDataRoll()
           }
-        }, this.tableData.length <= 10 ? 1000 * 3 : 100)
+          nowLoop++
+        }, 1000 * 10)
       })
+
+      // LineSearchBottomLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
+      //   this.tableData = res.data
+      //   this.number2 = this.tableData.length
+      //
+      //   const divData = this.$refs.tableData.bodyWrapper
+      //   // 鎷垮埌鍏冪礌鍚庯紝瀵瑰厓绱犺繘琛屽畾鏃跺鍔犺窛绂婚《閮ㄨ窛绂伙紝瀹炵幇婊氬姩鏁堟灉(姝ら厤缃负姣�100姣绉诲姩1鍍忕礌)
+      //   this.TableDataRollTask = setInterval(() => {
+      //     // 鍏冪礌鑷璺濈椤堕儴1鍍忕礌
+      //     divData.scrollTop += 1
+      //     // divData.scrollTop += divData.scrollHeight / this.tableData.length
+      //     // 鍒ゆ柇鍏冪礌鏄惁婊氬姩鍒板簳閮�(鍙楂樺害+璺濈椤堕儴=鏁翠釜楂樺害)
+      //     if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
+      //       // 閲嶇疆table璺濈椤堕儴璺濈
+      //       divData.scrollTop = 0
+      //       LineSearchBottomLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
+      //         this.tableData = res.data
+      //         this.number2 = this.tableData.length
+      //         if (this.tableData.length > 10) {
+      //           clearInterval(this.TableDataRollTask)
+      //           this.getTableDataRoll()
+      //         }
+      //       })
+      //     }
+      //   }, this.tableData.length <= 10 ? 1000 * 3 : 100)
+      // })
     },
     // 褰撴棩瀹屽伐浜у搧鏁伴噺鎺掕
     getTableDataRankRoll() {

--
Gitblit v1.9.3