loulijun2021
2022-12-12 17f529afef9f804f228857f6b47d0a446e55a707
src/views/kb/zhkb.vue
@@ -28,7 +28,11 @@
          <div class="kb_left_top kb_pd10">
            <div class="kb_left_top02">
              <div v-for="item in lineContent3" :key="item.workcode" class="kb_left_top_block">
              <div
                v-for="item in lineContent3"
                :key="item.workcode+JSON.stringify(item.children[0])"
                class="kb_left_top_block"
              >
                <div class="kb_block02 kb_pd10">
                  <div>
                    <div>销售单号:{{ item.saleordercode }}</div>
@@ -458,6 +462,125 @@
    getShopSearchLine() {
      let length, count
      LineSearchTopLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
        this.lineContent = res.data // 调用接口返回的数据
        this.number1 = this.lineContent.length // 产线加工中任务  单数
        const newData = []
        if (this.lineContent.length > 0) {
          this.lineContent.forEach(item => {
            if (item.children.length > 5) {
              newData.push({
                workcode: item.workcode,
                partname: item.partname,
                partnumber: item.partnumber,
                partspec: item.partspec,
                qty: item.qty,
                saleordercode: item.saleordercode,
                uom: item.uom,
                children: item.children.slice(0, 5)
              })
              newData.push({
                workcode: item.workcode,
                partname: item.partname,
                partnumber: item.partnumber,
                partspec: item.partspec,
                qty: item.qty,
                saleordercode: item.saleordercode,
                uom: item.uom,
                children: item.children.slice(5, 8)
              })
            } else {
              newData.push({
                workcode: item.workcode,
                partname: item.partname,
                partnumber: item.partnumber,
                partspec: item.partspec,
                qty: item.qty,
                saleordercode: item.saleordercode,
                uom: item.uom,
                children: item.children
              })
            }
          })
          console.log(newData.length, 9777)
        }
        this.lineContent = newData
        length = this.lineContent.length
        count = Math.ceil(length / 3) // 需要轮播的组数   3个为一组
        this.lineContent3 = this.lineContent.slice(0, 3)
      })
      let start = 0
      this.ShopSearchLineTask = setInterval(() => {
        if (Math.floor(start / 3) === count && count !== 0) {
          start = 0
          LineSearchTopLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
            this.lineContent = res.data // 调用接口返回的数据
            this.number1 = this.lineContent.length // 产线加工中任务  单数
            const newData = []
            if (this.lineContent.length > 0) {
              this.lineContent.forEach(item => {
                if (item.children.length > 5) {
                  newData.push({
                    workcode: item.workcode,
                    partname: item.partname,
                    partnumber: item.partnumber,
                    partspec: item.partspec,
                    qty: item.qty,
                    saleordercode: item.saleordercode,
                    uom: item.uom,
                    children: item.children.slice(0, 5)
                  }
                  )
                  newData.push({
                    workcode: item.workcode,
                    partname: item.partname,
                    partnumber: item.partnumber,
                    partspec: item.partspec,
                    qty: item.qty,
                    saleordercode: item.saleordercode,
                    uom: item.uom,
                    children: item.children.slice(5, 8)
                  })
                } else {
                  newData.push({
                    workcode: item.workcode,
                    partname: item.partname,
                    partnumber: item.partnumber,
                    partspec: item.partspec,
                    qty: item.qty,
                    saleordercode: item.saleordercode,
                    uom: item.uom,
                    children: item.children
                  })
                }
              })
            }
            this.lineContent = newData
            length = this.lineContent.length
            count = Math.ceil(length / 3) // 需要轮播的组数   3个为一组
            this.lineContent3 = this.lineContent.slice(0, 3)
          })
        } else if (count === 0) {
          clearInterval(this.ShopSearchLineTask)
          this.getShopSearchLine()
        }
        this.lineContent3 = this.lineContent.slice(start, start + 3)
        start = start + 3
      }, 1000 * 3)
    },
    // 产线加工中任务   备份方法
    getShopSearchLine2() {
      let length, count
      LineSearchTopLeftData({ shopcode: this.ShopArr.join(',') }).then(res => {
        this.lineContent = res.data
        length = this.lineContent.length
        count = Math.ceil(length / 3) // 需要轮播的组数   3个为一组