<template>
  <div style="flex: 1;">
    <Container name="工单监控" size="small" style="">
      <div style="padding: 5px 10px;">
        <dv-scroll-board :config="config" style="width:575px;height:380px" ref='worderScrollBoard'/>
      </div>
    </Container>
  </div>
</template>
<script>
import Container from '../components/Container.vue';
export default {
  name: 'WorkOrderMonitoring',
  components: { Container },
  computed: {
    order() {
      return this.$store.state.websocket.workOrder
    }
  },
  data() {
    return {
      config: {
        header: ['序号', '工单名称', '规格','产线','工单状态', '计划完成时间', '计划产量', '实际产量'],
        // headerHeight: '17',
        headerBGC: 'rgba(32, 55, 96, 0.8)',
        oddRowBGC: 'rgba(32, 55, 96, 0.8)',
        evenRowBGC: 'rgba(14, 32, 62, 0.8)',
        columnWidth: [60, 120, 80, 60, 80, 120, 120, 120],
        align: ['center'],
        data: [
          [1, '工单1', '行1列3', '', '','','',''],
          [2, '工单2', '行2列3', '', '','','',''],
          [3, '工单3', '行3列3', '', '','','',''],
          [4, '工单4', '行4列3', '', '','','',''],
          [5, '工单5', '行5列3', '', '','','',''],
          [6, '工单6', '行6列3', '', '','','',''],
          [7, '工单7', '行7列3', '', '','','',''],
          [8, '工单8', '行8列3', '', '','','',''],
          [9, '工单9', '行9列3', '', '','','',''],
          [10, '工单10', '行10列3', '', '','','','']
        ],
        rowNum: 10
      }
    }
  },
  watch:{
    order: {
			handler(newVal, oldVal) {
        let outArr = this.order.map((item, index) => [
          index+1,
          item.name,
          item.specifications,
          item.lines,
          item.status,
          item.planFinishTime,
          item.planQuantity,
          item.planAssignQuantity
      ]);
        this.config.data = outArr
        this.$refs['worderScrollBoard'].updateRows(outArr)
			}
		}
  }
}
</script>