<template>
  <div>
    <base-table
      :table-props="tableProps"
      :table-data="tableData"
      :max-height="tableH"
    />
  </div>
</template>
<script>
import { timeFormatter, tableHeight } from '@/utils'
const tableProps = [
  {
    prop: 'time',
    label: '检测时间',
    filter: timeFormatter,
    minWidth: 160
  },
  {
    prop: 'virtualcode',
    label: '玻璃ID',
    minWidth: 120
  },
  {
    prop: 'lineA',
    label: '加工条件',
    children: [
      {
        prop: 'palletId',
        label: '托盘ID'
      },
      {
        prop: 'grindtype',
        label: '研磨类型'
      }
    ]
  },
  {
    prop: 'lineB',
    label: '检测数据',
    children: [
      {
        prop: 'sums',
        label: '颗粒总数'
      },
      {
        prop: 'tin',
        label: '点状缺陷'
      },
      {
        prop: 'distortion',
        label: '变形'
      },
      {
        prop: 'tail',
        label: '拖尾'
      },
      {
        prop: 'bl',
        label: '气泡'
      },
      {
        prop: 'stone',
        label: '结石'
      },
      {
        prop: 'scratch',
        label: '划伤'
      },
      {
        prop: 'surfaceSum',
        label: '面检总数'
      }
    ]
  },
  {
    prop: 'lineC',
    label: '研磨电流(A)',
    children: [
      {
        prop: 'ae',
        label: 'A机台'
      },
      {
        prop: 'be',
        label: 'B机台'
      },
      {
        prop: 'ce',
        label: 'C机台'
      },
      {
        prop: 'alle',
        label: '总电流'
      }
    ]
  },
  {
    prop: 'eletricityConform',
    label: '工艺符合性',
    minWidth: 100
  },
  {
    prop: 'lineD',
    label: '研磨时间(S)',
    children: [
      {
        prop: 'ae',
        label: 'A机台'
      },
      {
        prop: 'be',
        label: 'B机台'
      },
      {
        prop: 'ce',
        label: 'C机台'
      },
      {
        prop: 'allt',
        label: '总研磨时间',
        minWidth: 100
      }
    ]
  }
]
export default {
  name: 'glassQualityReport',
  data() {
    return {
      tableProps,
      tableH: tableHeight(292)
    }
  },
  mounted() {
    window.addEventListener('resize', () => {
      this.tableH = tableHeight(292)
    })
  },
  props: {
    tableData: {
      type: Array,
      required: true,
      default: () => {
        return []
      }
    }
  }
}
</script>
