<template>
  <div class="deviceStatistics card">
    <div class="card-head">
      <div class="title">内容数据</div>
      <div class="condition">
        <el-input style="width: 240px" placeholder="搜索设备SN号" :suffix-icon="Search" />
      </div>
    </div>
    <TableCustom :columns="columns" :tableData="tableData" :total="page.total" :refresh="getData" :currentPage="page.index" :changePage="changePage">
      <template #location="{ rows }">
        <el-button type="success" link :icon="View"> 查看 </el-button>
      </template>
      <template #state="{ rows }">
        <el-tag :type="rows.state ? 'success' : 'danger'">
          {{ rows.state ? "正常" : "异常" }}
        </el-tag>
      </template>
    </TableCustom>
  </div>
</template>
<script setup>
import { ref } from "vue";
import { Search, View } from "@element-plus/icons-vue";
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: "IMEI号" },
  { prop: "time", label: "时间" },
  { prop: "location", label: "地理位置" },
  { prop: "state", label: "处理状态" },
];
</script>
<style scoped lang="less">
.card {
  height: 100%;
  background: #ffffff;
  padding: 16px 10px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  .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;
      }
    }
    .condition {
      display: flex;
      align-items: center;
      margin-left: 20px;
      .condition-time {
        border: 1px solid #dcdfe6;
        overflow: hidden;
        margin-left: 20px;
      }
    }
  }
}
</style>
