loulijun2021
2023-05-11 c588a47c9c7fbcbe6e0a479cfb081ffa4db2a94c
src/views/kb/cjsc.vue
@@ -408,11 +408,12 @@
        const timer = setInterval(() => {
          startValue = startValue + scale
          this.tableDataCenterTop = this.tableDataCenterTopTemp.slice(startValue, startValue + scale)
          nowLoop++
          if (nowLoop === loop) {
            clearInterval(timer)
            this.getCenterTableDataSetInterval()
          }
          nowLoop++
          this.$nextTick(() => {
            this.tableDataCenterTop.forEach(i => {
              loadEcharts('progress' + i.RowNum, progress(i.good_qty, i.plan_qty))
@@ -430,94 +431,182 @@
    // 获取左上数据并定时刷新
    getLeftTopTableDataSetInterval() {
      let startValue = 0 // 初始值
      const scale = 10// 刻度
      // let startValue = 0 // 初始值
      // const scale = 10// 刻度
      //
      // WkshpLineData({ LineCode: '001' }).then(res => {
      //   this.tableDataLeftTopTemp = res.data
      //   this.tableDataLeftTop = this.tableDataLeftTopTemp.slice(startValue, startValue + scale)
      //
      //   const loop = Math.floor(this.tableDataLeftTopTemp.length / scale)// 需要循环的次数
      //   let nowLoop = 0// 当前循环的次数
      //
      //   const timer = setInterval(() => {
      //     startValue = startValue + scale
      //     this.tableDataLeftTop = this.tableDataLeftTopTemp.slice(startValue, startValue + scale)
      //     if (nowLoop === loop) {
      //       clearInterval(timer)
      //       this.getLeftTopTableDataSetInterval()
      //     }
      //     nowLoop++
      //   }, 1000 * 10)
      // })
      WkshpLineData({ LineCode: '001' }).then(res => {
        this.tableDataLeftTopTemp = res.data
        this.tableDataLeftTop = this.tableDataLeftTopTemp.slice(startValue, startValue + scale)
        const loop = Math.floor(this.tableDataLeftTopTemp.length / scale)// 需要循环的次数
        let nowLoop = 0// 当前循环的次数
        this.tableDataLeftTop = res.data
        const divData = this.$refs.tableDataLeftTopRef.bodyWrapper
        // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
        const timer = setInterval(() => {
          startValue = startValue + scale
          this.tableDataLeftTop = this.tableDataLeftTopTemp.slice(startValue, startValue + scale)
          if (nowLoop === loop) {
          // 元素自增距离顶部1像素
          divData.scrollTop += 1
          // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
          if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
            // 重置table距离顶部距离
            divData.scrollTop = 0
            WkshpLineData({ LineCode: '001' }).then(res => {
              this.tableDataLeftTop = res.data
              if (this.tableDataLeftTop.length > 10) {
            clearInterval(timer)
            this.getLeftTopTableDataSetInterval()
          }
          nowLoop++
        }, 1000 * 10)
            })
          }
        }, this.tableDataLeftTop.length <= 10 ? 1000 * 20 : 100)
      })
    },
    // 获取左下数据并定时刷新
    getLeftBottomTableDataSetInterval() {
      let startValue = 0 // 初始值
      const scale = 10// 刻度
      // let startValue = 0 // 初始值
      // const scale = 10// 刻度
      //
      // WkshpLineData({ LineCode: '002' }).then(res => {
      //   this.tableDataLeftBottomTemp = res.data
      //   this.tableDataLeftBottom = this.tableDataLeftBottomTemp.slice(startValue, startValue + scale)
      //
      //   const loop = Math.floor(this.tableDataLeftBottomTemp.length / scale)// 需要循环的次数
      //   let nowLoop = 0// 当前循环的次数
      //
      //   const timer = setInterval(() => {
      //     startValue = startValue + scale
      //     this.tableDataLeftBottom = this.tableDataLeftBottomTemp.slice(startValue, startValue + scale)
      //     if (nowLoop === loop) {
      //       clearInterval(timer)
      //       this.getLeftBottomTableDataSetInterval()
      //     }
      //     nowLoop++
      //   }, 1000 * 10)
      // })
      WkshpLineData({ LineCode: '002' }).then(res => {
        this.tableDataLeftBottomTemp = res.data
        this.tableDataLeftBottom = this.tableDataLeftBottomTemp.slice(startValue, startValue + scale)
        const loop = Math.floor(this.tableDataLeftBottomTemp.length / scale)// 需要循环的次数
        let nowLoop = 0// 当前循环的次数
        this.tableDataLeftBottom = res.data
        const divData = this.$refs.tableDataLeftBottomRef.bodyWrapper
        // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
        const timer = setInterval(() => {
          startValue = startValue + scale
          this.tableDataLeftBottom = this.tableDataLeftBottomTemp.slice(startValue, startValue + scale)
          if (nowLoop === loop) {
          // 元素自增距离顶部1像素
          divData.scrollTop += 1
          // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
          if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
            // 重置table距离顶部距离
            divData.scrollTop = 0
            WkshpLineData({ LineCode: '002' }).then(res => {
              this.tableDataLeftBottom = res.data
              if (this.tableDataLeftBottom.length > 10) {
            clearInterval(timer)
            this.getLeftBottomTableDataSetInterval()
          }
          nowLoop++
        }, 1000 * 10)
            })
          }
        }, this.tableDataLeftBottom.length <= 10 ? 1000 * 20 : 100)
      })
    },
    // 获取右上数据并定时刷新
    getRightTopTableDataSetInterval() {
      let startValue = 0 // 初始值
      const scale = 10// 刻度
      // let startValue = 0 // 初始值
      // const scale = 10// 刻度
      //
      // WkshpLineData({ LineCode: '003' }).then(res => {
      //   this.tableDataRightTopTemp = res.data
      //   this.tableDataRightTop = this.tableDataRightTopTemp.slice(startValue, startValue + scale)
      //
      //   const loop = Math.floor(this.tableDataRightTopTemp.length / scale)// 需要循环的次数
      //   let nowLoop = 0// 当前循环的次数
      //
      //   const timer = setInterval(() => {
      //     startValue = startValue + scale
      //     this.tableDataRightTop = this.tableDataRightTopTemp.slice(startValue, startValue + scale)
      //     if (nowLoop === loop) {
      //       clearInterval(timer)
      //       this.getRightTopTableDataSetInterval()
      //     }
      //     nowLoop++
      //   }, 1000 * 10)
      // })
      WkshpLineData({ LineCode: '003' }).then(res => {
        this.tableDataRightTopTemp = res.data
        this.tableDataRightTop = this.tableDataRightTopTemp.slice(startValue, startValue + scale)
        const loop = Math.floor(this.tableDataRightTopTemp.length / scale)// 需要循环的次数
        let nowLoop = 0// 当前循环的次数
        this.tableDataRightTop = res.data
        const divData = this.$refs.tableDataRightTopRef.bodyWrapper
        // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
        const timer = setInterval(() => {
          startValue = startValue + scale
          this.tableDataRightTop = this.tableDataRightTopTemp.slice(startValue, startValue + scale)
          if (nowLoop === loop) {
          // 元素自增距离顶部1像素
          divData.scrollTop += 1
          // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
          if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
            // 重置table距离顶部距离
            divData.scrollTop = 0
            WkshpLineData({ LineCode: '003' }).then(res => {
              this.tableDataRightTop = res.data
              if (this.tableDataRightTop.length > 10) {
            clearInterval(timer)
            this.getRightTopTableDataSetInterval()
          }
          nowLoop++
        }, 1000 * 10)
            })
          }
        }, this.tableDataRightTop.length <= 10 ? 1000 * 20 : 100)
      })
    },
    // 获取右下数据并定时刷新
    getRightBottomTableDataSetInterval() {
      let startValue = 0 // 初始值
      const scale = 10// 刻度
      // let startValue = 0 // 初始值
      // const scale = 10// 刻度
      //
      // WkshpLineData({ LineCode: '004' }).then(res => {
      //   this.tableDataRightBottomTemp = res.data
      //   this.tableDataRightBottom = this.tableDataRightBottomTemp.slice(startValue, startValue + scale)
      //
      //   const loop = Math.floor(this.tableDataRightBottomTemp.length / scale)// 需要循环的次数
      //   let nowLoop = 0// 当前循环的次数
      //
      //   const timer = setInterval(() => {
      //     startValue = startValue + scale
      //     this.tableDataRightBottom = this.tableDataRightBottomTemp.slice(startValue, startValue + scale)
      //     if (nowLoop === loop) {
      //       clearInterval(timer)
      //       this.getRightBottomTableDataSetInterval()
      //     }
      //     nowLoop++
      //   }, 1000 * 10)
      // })
      WkshpLineData({ LineCode: '004' }).then(res => {
        this.tableDataRightBottomTemp = res.data
        this.tableDataRightBottom = this.tableDataRightBottomTemp.slice(startValue, startValue + scale)
        const loop = Math.floor(this.tableDataRightBottomTemp.length / scale)// 需要循环的次数
        let nowLoop = 0// 当前循环的次数
        this.tableDataRightBottom = res.data
        const divData = this.$refs.tableDataRightBottomRef.bodyWrapper
        // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
        const timer = setInterval(() => {
          startValue = startValue + scale
          this.tableDataRightBottom = this.tableDataRightBottomTemp.slice(startValue, startValue + scale)
          if (nowLoop === loop) {
          // 元素自增距离顶部1像素
          divData.scrollTop += 1
          // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
          if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
            // 重置table距离顶部距离
            divData.scrollTop = 0
            WkshpLineData({ LineCode: '004' }).then(res => {
              this.tableDataRightBottom = res.data
              if (this.tableDataRightBottom.length > 10) {
            clearInterval(timer)
            this.getRightBottomTableDataSetInterval()
          }
          nowLoop++
        }, 1000 * 10)
            })
          }
        }, this.tableDataRightBottom.length <= 10 ? 1000 * 20 : 100)
      })
    },