From df86d5bd8bbbe4b2d6ec8bdffa681848d92576ca Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 30 八月 2022 17:02:59 +0800
Subject: [PATCH] 1.修改bug2.保养部位增删查改开发完成

---
 src/views/kb/zhkb.vue |  156 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 107 insertions(+), 49 deletions(-)

diff --git a/src/views/kb/zhkb.vue b/src/views/kb/zhkb.vue
index 3ced825..974fb53 100644
--- a/src/views/kb/zhkb.vue
+++ b/src/views/kb/zhkb.vue
@@ -641,16 +641,16 @@
 
     getLineSearchTopLeftData() {
       this.lineArr.forEach((item, index) => {
-        // if (index === 0) {
-        this.handleEveryLine(item, index)
-        this.lineCodeArr.push(item.code)
-        // }
+        if (index <= 3) {
+          this.handleEveryLine(item, index)
+          this.lineCodeArr.push(item.code)
+        }
       })
     },
     // 澶勭悊姣忎竴鏉′骇绾�
     async handleEveryLine(item, index) {
       const res = await LineSearchTopLeftData([item])
-      console.log(res, 7)
+
       let res1, res2, res3, res4
       if (res.data[0].linecode === this.lineCodeArr[0]) {
         res1 = res
@@ -688,22 +688,25 @@
               children: res1.data[0].children ? res1.data[0].children[count] : []
             }
           }
-          // console.log(res1.data[0].children.length, 9999)
-          // console.log(res1.data[0].children, 8888)
-          // if (res1.data[0].children.length > 0 && res1.data[0].children.length === count++) {
-          if (res1.data[0].children.length === count++) {
-            count = 0
+          console.log(res1.data[0].children === null, 999)
+          if (res1.data[0].children === null) {
+            res1.data[0].children = []
+          }
+          if (this.lineContent01.children === undefined || res1.data[0].children.length >= 0) {
             LineSearchTopLeftData([item]).then(res => {
               res1 = res
-              this.lineContent01 = {
-                linename: res1.data[0].linename,
-                lineworkcont: res1.data[0].lineworkcont,
-                children: res1.data[0].children ? res1.data[0].children[count] : []
-              }
             })
-            // this.handleEveryLine(item, index)
           }
-        }, res1.data[0].children && res1.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+          if (res1.data[0].children.length === count++) {
+            count = 0
+            this.lineContent01 = {
+              linename: res1.data[0].linename,
+              lineworkcont: res1.data[0].lineworkcont,
+              children: res1.data[0].children ? res1.data[0].children[count] : []
+            }
+          }
+        }, 1000 * 3)
+        // }, res1.data[0].children && res1.data[0].children.length > 0 ? 1000 * 3 : 1000 * 3)
       } else if (index === 1) {
         let count = 0
         if (flag2) {
@@ -722,20 +725,47 @@
               children: res2.data[0].children ? res2.data[0].children[count] : []
             }
           }
-          if (res2.data[0].children.length === count++) {
-            count = 0
+          if (res2.data[0].children === null) {
+            res2.data[0].children = []
+          }
+          if (this.lineContent02.children === undefined || res2.data[0].children.length >= 0) {
             LineSearchTopLeftData([item]).then(res => {
               res2 = res
-              this.lineContent02 = {
-                linename: res2.data[0].linename,
-                lineworkcont: res2.data[0].lineworkcont,
-                children: res2.data[0].children ? res2.data[0].children[count] : []
-              }
             })
-
-            // this.handleEveryLine(item, index)
           }
-        }, res2.data[0].children && res2.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+          if (res2.data[0].children.length === count++) {
+            count = 0
+            this.lineContent02 = {
+              linename: res2.data[0].linename,
+              lineworkcont: res2.data[0].lineworkcont,
+              children: res2.data[0].children ? res2.data[0].children[count] : []
+            }
+          }
+        // }, res2.data[0].children && res2.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+        }, 1000 * 3)
+
+        // setInterval(() => {
+        //   if (count > 0) {
+        //     this.lineContent02 = {
+        //       linename: res2.data[0].linename,
+        //       lineworkcont: res2.data[0].lineworkcont,
+        //       children: res2.data[0].children ? res2.data[0].children[count] : []
+        //     }
+        //   }
+        //   if (res2.data[0].children.length === count++) {
+        //     count = 0
+        //     LineSearchTopLeftData([item]).then(res => {
+        //       res2 = res
+        //       this.lineContent02 = {
+        //         linename: res2.data[0].linename,
+        //         lineworkcont: res2.data[0].lineworkcont,
+        //         children: res2.data[0].children ? res2.data[0].children[count] : []
+        //       }
+        //     })
+        //
+        //     // this.handleEveryLine(item, index)
+        //   }
+        // }, res2.data[0].children && res2.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
       } else if (index === 2) {
         let count = 0
         if (flag3) {
@@ -754,19 +784,31 @@
               children: res3.data[0].children ? res3.data[0].children[count] : []
             }
           }
-          if (res3.data[0].children.length === count++) {
-            count = 0
+
+          if (res3.data[0].children === null) {
+            res3.data[0].children = []
+          }
+
+          if (this.lineContent03.children === undefined || res3.data[0].children.length >= 0) {
             LineSearchTopLeftData([item]).then(res => {
               res3 = res
-              this.lineContent03 = {
-                linename: res3.data[0].linename,
-                lineworkcont: res3.data[0].lineworkcont,
-                children: res3.data[0].children ? res3.data[0].children[count] : []
-              }
             })
+          }
+
+          if (res3.data[0].children.length === count++) {
+            count = 0
+            // LineSearchTopLeftData([item]).then(res => {
+            //   res3 = res
+            this.lineContent03 = {
+              linename: res3.data[0].linename,
+              lineworkcont: res3.data[0].lineworkcont,
+              children: res3.data[0].children ? res3.data[0].children[count] : []
+            }
+            // })
             // this.handleEveryLine(item, index)
           }
-        }, res3.data[0].children && res3.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+        // }, res3.data[0].children && res3.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+        }, 1000 * 3)
       } else if (index === 3) {
         let count = 0
         if (flag4) {
@@ -785,20 +827,27 @@
               children: res4.data[0].children ? res4.data[0].children[count] : []
             }
           }
-          // if (res4.data[0].children > 0 && res4.data[0].children.length === count++) {
-          if (res4.data[0].children.length === count++) {
-            count = 0
+
+          if (res4.data[0].children === null) {
+            res4.data[0].children = []
+          }
+
+          if (res4.data[0].children.length === count || this.lineContent04.children === undefined) {
             LineSearchTopLeftData([item]).then(res => {
               res4 = res
-              this.lineContent04 = {
-                linename: res4.data[0].linename,
-                lineworkcont: res4.data[0].lineworkcont,
-                children: res4.data[0].children ? res4.data[0].children[count] : []
-              }
             })
-            // this.handleEveryLine(item, index)
           }
-        }, res4.data[0].children && res4.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+
+          if (res4.data[0].children.length === count++) {
+            count = 0
+            this.lineContent04 = {
+              linename: res4.data[0].linename,
+              lineworkcont: res4.data[0].lineworkcont,
+              children: res4.data[0].children ? res4.data[0].children[count] : []
+            }
+          }
+        // }, res4.data[0].children && res4.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
+        }, 1000 * 3)
       }
     },
 
@@ -809,7 +858,7 @@
 
         const divData = this.$refs.tableData.bodyWrapper
         // 鎷垮埌鍏冪礌鍚庯紝瀵瑰厓绱犺繘琛屽畾鏃跺鍔犺窛绂婚《閮ㄨ窛绂伙紝瀹炵幇婊氬姩鏁堟灉(姝ら厤缃负姣�100姣绉诲姩1鍍忕礌)
-        setInterval(() => {
+        const task = setInterval(() => {
           // 鍏冪礌鑷璺濈椤堕儴1鍍忕礌
           divData.scrollTop += 1
           // divData.scrollTop += divData.scrollHeight / this.tableData.length
@@ -819,9 +868,13 @@
             divData.scrollTop = 0
             LineSearchBottomLeftData().then(res => {
               this.tableData = res.data
+              if (this.tableData.length > 10) {
+                clearInterval(task)
+                this.getTableDataRoll()
+              }
             })
           }
-        }, this.tableData.length <= 10 ? 1000 * 6 : 100)
+        }, this.tableData.length <= 10 ? 1000 * 3 : 100)
       })
     },
     // 褰撴棩瀹屽伐浜у搧鏁伴噺鎺掕
@@ -831,7 +884,7 @@
 
         const divData = this.$refs.tableDataRank.bodyWrapper
         // 鎷垮埌鍏冪礌鍚庯紝瀵瑰厓绱犺繘琛屽畾鏃跺鍔犺窛绂婚《閮ㄨ窛绂伙紝瀹炵幇婊氬姩鏁堟灉(姝ら厤缃负姣�100姣绉诲姩1鍍忕礌)
-        setInterval(() => {
+        const task = setInterval(() => {
           // 鍏冪礌鑷璺濈椤堕儴1鍍忕礌
           // divData.scrollTop += divData.scrollHeight / this.tableDataRank.length
           divData.scrollTop += 1
@@ -841,9 +894,14 @@
             divData.scrollTop = 0
             LineSearchTopRightData().then(res => {
               this.tableDataRank = res.data
+
+              if (this.tableDataRank.length > 10) {
+                clearInterval(task)
+                this.getTableDataRankRoll()
+              }
             })
           }
-        }, this.tableDataRank.length <= 10 ? 1000 * 6 : 100)
+        }, this.tableDataRank.length <= 10 ? 1000 * 3 : 100)
       })
     },
     // 鑾峰彇echarts

--
Gitblit v1.9.3