<template>
  <div id="digital-flop">
    <div
      class="digital-flop-item"
      v-for="item in digitalFlopData"
      :key="item.title"
    >
      <div class="digital-flop-title">{{ item.title }}</div>
      <div class="digital-flop">
        <dv-digital-flop
          :config="item.number"
          style="width:100px;height:50px;"
        />
        <div class="unit">{{ item.unit }}</div>
      </div>
    </div>

    <dv-decoration-10 />
  </div>
</template>

<script>
import {
  getDryingRoomList,
  getMesBoardEquProductionToday,
} from "@/api/kanban/dryingroom";
export default {
  name: 'DigitalFlop',
  data () {
    return {
      digitalFlopData: [],
      dryingRoomList: [],
      cxjZCNumber:0,

    }
  },
  methods: {
    createData () {
      const that = this;
      getDryingRoomList({
        factory: 999,
      }).then((response) => {
        if (response.data) {
           // console.log(response)
          this.cxjZCNumber=response.data.cxzc;
          this.cxjYCNumber=response.data.cxyc;
          this.dryingRoomList = response.data.result;
          this.digitalFlopData = [
            {
              title: '成型机运行',
              number: {
                number: [this.cxjZCNumber],
                content: '{nt}',
                textAlign: 'right',
                style: {
                  fill: '#4d99fc',
                  fontWeight: 'bold'
                }
              },

              unit: '台'
            },
            {
              title: '烘房运行(自动)',
              number: {
                number: [response.data.hfauto],
                content: '{nt}',
                textAlign: 'right',
                style: {
                  fill: '#4d99fc',
                  fontWeight: 'bold'
                }
              },

              unit: '座'
            },
            {
              title: '收坯机台运行',
              number: {
                number: [response.data.spzc],
                content: '{nt}',
                textAlign: 'right',
                style: {
                  fill: '#4d99fc',
                  fontWeight: 'bold'
                }
              },
              unit: '台'
            },
            {
              title: '成型缓存区数量',
              number: {
                number: [response.data.hcnumber],
                content: '{nt}',
                textAlign: 'right',
                style: {
                  fill: '#4d99fc',
                  fontWeight: 'bold'
                }
              },
              unit: '个'
            },

          ]

        }
      });

    },
  },
  mounted () {
    const { createData } = this

    createData()

    setInterval(createData, 5000)
  }
}
</script>


<style lang="less">
#digital-flop {
  position: relative;
  height: 15%;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(6, 30, 93, 0.5);

  .dv-decoration-10 {
    position: absolute;
    width: 95%;
    left: 2.5%;
    height: 5px;
    bottom: 0px;
  }

  .digital-flop-item {
    width: 11%;
    height: 80%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-left: 3px solid rgb(6, 30, 93);
    border-right: 3px solid rgb(6, 30, 93);
  }

  .digital-flop-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .digital-flop {
    display: flex;
    width: 200px;
  }

  .unit {
    margin-left: 10px;
    display: flex;
    align-items: flex-end;
    box-sizing: border-box;
    padding-bottom: 13px;
  }
}
</style>
