<template>
  <div id="bottom1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-line" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">产出数量</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board class="dv-scr-board" :config="config" ref="scroll-board" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      config: {
        header: [ '<span style="color:#dad052;font-weight:bold;font-size:17px;">产线',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">产品编码',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">产品描述',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">当前工单',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">面别',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">当前进度',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">完工率',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">节拍时间',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">开始生产时间',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">预计完成时间',
                  '<span style="color:#dad052;font-weight:bold;font-size:17px;">抛料PPM'],
        data: [
        ],
        headerHeight: 35,
        headerBGC: '#0f1325', //表头
        oddRowBGC: '#0f1325', //奇数行
        evenRowBGC: '#171c33', //偶数行
        //index: true,
        rowNum:7,
        columnWidth: [120,180,350,180,100,140,130,100,220,220,120],
        align: ['center']
      }
    }
  },
  mounted() {
    this.refreshdata()
  },
  methods: {
    refreshdata() {
      this.getdata(); //获取-数据
      setInterval(() => {
        this.getdata(); //获取--数据
      }, 30000);
    },
    async getdata() {
      await this.$http.get("kanban/datalist.action?caller=KB!SMT!BUTTOM1&_noc=1&page=1&pageSize=100&condition=1=1")
          .then((result)=>{
                    let dataList = JSON.parse(result.data.data);
                    let resultList = new Array();
                    for (let index = 0; index < dataList.length; index++) {
                      const element = dataList[index];
                      let item = new Array();
                      item.push(element.v_linecode);
                      item.push(element.v_prcode);
                      item.push(element.v_prdetail);
                      item.push(element.v_macode);
                      item.push(element.v_ab);
                      item.push(element.v_jd);
                      item.push(element.v_finishrate);
                      item.push(element.v_jptime);
                      item.push(element.v_actbegintime);
                      item.push(element.v_planenddate);
                      item.push(element.v_plppm);
                      //item.push("<span  class='colorGrass'>"+element.value+"</span>");
                      resultList.push(item);
                    }
                    const scrollBoard = this.$refs['scroll-board'];
                    //刷新数据
                    scrollBoard.updateRows(resultList);
                },(result)=>{
                    console.error(result)
                    }
          );
    }
  }
}
</script>

<style lang="scss" scoped>
$box-height: 410px;
$box-width: 100%;
#bottom1 {
  padding: 16px;
  padding-top: 20px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  //  font-size: 15px;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-scr-board {
      width: 100%;
      height: 340px;
    }
  }
}
</style>
