<template>
  <div class="deviceStatistics card">
    <div class="card-head">
      <div class="title">当前设备告警记录</div>
      <div class="search">
        <el-select class="select" style="width: 120px; margin-right: 20px">
          <el-option label="户外押送" value="1" />
          <el-option label="审讯模式" value="2" />
        </el-select>
        <el-select class="select" style="width: 120px">
          <el-option label="户外押送" value="1" />
          <el-option label="审讯模式" value="2" />
        </el-select>
      </div>
    </div>

    <TableCustom :columns="columns" :tableData="tableData" :total="page.total" :refresh="getData" :currentPage="page.index" :changePage="changePage">
      <template #state="{ rows }">
        <el-tag :type="rows.state ? 'success' : 'danger'">
          {{ rows.state ? "正常" : "异常" }}
        </el-tag>
      </template>
    </TableCustom>
  </div>
</template>
<script setup>
defineProps({
  tableData: {
    type: Array,
    default: () => [],
  },
  page: {
    type: Object,
    default: () => ({}),
  },
  getData: {
    type: Function,
    default: () => {},
  },
  changePage: {
    type: Function,
    default: () => {},
  },
});

// 表格相关
let columns = [
  { type: "index", label: "序号", width: 55, align: "center" },
  { prop: "name", label: "事件类型" },
  { prop: "name", label: "触发时间" },
  { prop: "state", label: "处理状态" },
];
</script>
<style scoped lang="less">
.card {
  height: 100%;
  background: #ffffff;
  padding: 16px 10px;
  box-sizing: border-box;

  .card-head {
    color: #061451;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .title {
      &::before {
        display: inline-block;
        margin-right: 10px;
        content: "";
        width: 2px;
        height: 14px;
        border-radius: 20px;
        background: #061451;
      }
    }
    .search {
      display: flex;
      align-items: center;
    }
  }
}
</style>
