loulijun2021
2022-08-31 436569820a3084dcf90f8156a4f812bc220fbb98
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
@@ -676,7 +676,6 @@
            linename: res1.data[0].linename,
            lineworkcont: res1.data[0].lineworkcont,
            children: res1.data[0].children ? res.data[0].children[count] : []
            // children: res1.data[0].children[count]
          }
          flag1 = false
        }
@@ -688,22 +687,24 @@
              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)
      } else if (index === 1) {
        let count = 0
        if (flag2) {
@@ -722,20 +723,23 @@
              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] : []
            }
          }
        }, 1000 * 3)
      } else if (index === 2) {
        let count = 0
        if (flag3) {
@@ -754,19 +758,26 @@
              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] : []
              }
            })
            // this.handleEveryLine(item, index)
          }
        }, res3.data[0].children && res3.data[0].children.length > 0 ? 1000 * 3 : 1000 * 10)
          if (res3.data[0].children.length === count++) {
            count = 0
            this.lineContent03 = {
              linename: res3.data[0].linename,
              lineworkcont: res3.data[0].lineworkcont,
              children: res3.data[0].children ? res3.data[0].children[count] : []
            }
          }
        }, 1000 * 3)
      } else if (index === 3) {
        let count = 0
        if (flag4) {
@@ -785,20 +796,26 @@
              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] : []
            }
          }
        }, 1000 * 3)
      }
    },
@@ -809,7 +826,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 +836,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 +852,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 +862,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