<template>
  <div class="left-content-equipment-check">
    <div class="el-table-wrapper fix-table">
      <TechyTable
        key="table-1"
        :showIndex="false"
        :page="1"
        :limit="8"
        :table-config="tableProps"
        :table-data="tableData"
      ></TechyTable>
    </div>
  </div>
</template>

<script>
import TechyTable from './TechyTable.vue'

const PriorityComponent = {
  name: 'PriorityComponent',
  props: {
    injectData: Object
  },
  computed: {
    bgColor() {
      const colors = ['#9c4048', '#ffbd43', '#0b58ff', '#90dd48', '#449028', '#091238']
      return colors[this.injectData.priority - 1]
    },
    priorityText() {
      return ['一级', '二级', '三级', '四级', '五级'][this.injectData.priority - 1]
    }
  },
  methods: {},
  render: function(h) {
    return h(
      'span',
      {
        style: {
          display: 'inline-block',
          borderRadius: 'calc(2px * var(--beilv))',
          padding: 'calc(2px * var(--beilv)) calc(6px * var(--beilv))',
          color: '#fff',
          opacity: '0.6',
          fontSize: 'calc(12px * var(--beilv))',
          lineHeight: 1,
          backgroundColor: this.bgColor
        }
      },
      this.priorityText
    )
  }
}

const tableProps = [
  { prop: 'eqName', label: '设备名称', align: 'center', 'min-width': 120 },
  // { prop: 'pl', label: '所属产线', align: 'center', 'min-width': 100 },
  { prop: 'warningLevel', label: '提示等级', align: 'center', 'min-width': 70, subcomponent: PriorityComponent },
  { prop: 'checkContent', label: '巡检内容', align: 'center', 'min-width': 120 }
]
const tableData = [
  { eqName: 'A1钢化', pl: 'A', priority: 1, checkContent: '表面检测光源和相机的卫生' },
  // { eqName: '一镀', pl: 'A', priority: 1, checkContent: '辊道下方的碎玻璃清理' },
  { eqName: 'B2钢化', pl: 'B', priority: 3, checkContent: '边角检测设备水平的校正' },
  { eqName: 'B1冷却机', pl: 'B', priority: 2, checkContent: '表面检测光源和相机的卫生' },
  // { eqName: '预热', pl: 'A', priority: 1, checkContent: '辊道下方的碎玻璃清理' },
  { eqName: 'B1钢后清洗机', pl: 'B', priority: 3, checkContent: '检查每日不良是否存在误检' },
  { eqName: 'B2磨边', pl: 'B', priority: 3, checkContent: '设备表面的卫生' },
  { eqName: 'B1打孔', pl: 'B', priority: 2, checkContent: '边角检测光源和相机的卫生' },
  { eqName: 'B1磨边后清洗机', pl: 'B', priority: 1, checkContent: '边角检测光源和相机的卫生' },
  // { eqName: '冷却', pl: 'B', priority: 1, checkContent: '辊道下方的碎玻璃清理' },
  // { eqName: '丝印', pl: 'B', priority: 3, checkContent: '操作台保持整洁' },
  // { eqName: '丝印', pl: 'A', priority: 2, checkContent: '检查每日不良是否存在误检' },
  { eqName: 'B1钢化', pl: 'B', priority: 2, checkContent: '检查每日不良是否存在误检' },
  // { eqName: '冷却', pl: 'A', priority: 2, checkContent: '辊道下方的碎玻璃清理' },
  { eqName: 'A1下片', pl: 'A', priority: 1, checkContent: '水冷机内水量充足并且清洁' },
  { eqName: 'A2钢化', pl: 'A', priority: 2, checkContent: '操作台保持整洁' },
  // { eqName: '预热', pl: 'B', priority: 3, checkContent: '水冷机内水量充足并且清洁' },
  { eqName: 'A3磨边后清洗机', pl: 'A', priority: 2, checkContent: '水冷机内水量充足并且清洁' },
  { eqName: 'B3上片', pl: 'B', priority: 3, checkContent: '边角检测光源和相机的卫生' },
  // { eqName: '预热', pl: 'A', priority: 2, checkContent: '表面检测光源和相机的卫生' }
]

export default {
  name: 'LeftContentEquipmentCheck',
  components: { TechyTable },
  data() {
    return { tableProps, tableData }
  },
  created() {},
  mounted() {},
  methods: {}
}
</script>

<style scoped>
.fix-table >>> .el-table td .cell {
  width: 60% !important;
  margin: auto;
  text-align: left;
}

.left-content-equipment-check {
  height: calc(100% - calc(32px * var(--beilv)));
  display: flex;
  gap: calc(100vmin / 1920 * 36);
  overflow: hidden;
}

.el-table-wrapper {
  flex: 1;
}

.left-content-equipment-check > div {
  overflow: hidden;
  /* overflow-x: scroll; */
}

.el-table-wrapper >>> * {
  background: transparent;
}
.el-table-wrapper >>> .el-table::before,
.el-table-wrapper >>> .el-table--group::after,
.el-table-wrapper >>> .el-table--border::after {
  background: transparent;
}

.el-table-wrapper >>> .el-table {
  font-size: 8px;
  background-color: transparent;
  color: #fff9;
  border: 0;
  height: 100%;
  /* overflow-y: auto; */
}

.el-table-wrapper >>> .el-table th.is-leaf,
.el-table-wrapper >>> .el-table td {
  border-color: #0d1728;
  padding: 0;
}

.el-table__row--striped:hover > td,
.el-table-wrapper >>> .el-table__row:hover > td {
  background-color: rgba(79, 114, 136, 0.29) !important;
}

.el-table-wrapper >>> table {
  border: unset;
}

.el-table-wrapper >>> thead {
  color: #fff;
}
.el-table-wrapper >>> tr {
  background: unset;
}
.el-table-wrapper >>> tbody td > div,
.el-table-wrapper >>> thead th > div {
  white-space: nowrap;
}
.el-table-wrapper >>> th,
.el-table-wrapper >>> td {
  padding: 0;
}

.el-table-wrapper >>> tbody > tr:nth-child(even) {
  background: rgba(76, 97, 123, 0.2);
}
</style>
