<script lang="ts" setup>
import { useRight } from "./useRight";

const { tableData, handleSizeChange, handleCurrentChange, currentPage } =
  useRight();
</script>

<template>
  <div>
    <zh-module
      class="h-full"
      title="告警信息"
      EnTitle="alarm information"
      showIcon
    >
      <div class="my-4">
        <div class="flex text-[#B3E3E8] px-10 space-x-3 text-sm mb-1">
          <div class="w-14 text-center">紧急</div>
          <div class="w-14 text-center">严重</div>
          <div class="w-14 text-center">一般</div>
          <div class="w-14 text-center">预警</div>
        </div>
        <div
          class="h-[35px] bg-[url('assets/images/device/r1-alarm.png')] text-center flex px-10 space-x-3 pt-1"
        >
          <div class="w-14 text-center font-bold text-[#CE2021]">3</div>
          <div class="w-14 text-center font-bold text-[#D95156]">12</div>
          <div class="w-14 text-center font-bold text-[#FE9800]">20</div>
          <div class="w-14 text-center font-bold text-[#E6E815]">23</div>
        </div>
      </div>
      <div class="h-[calc(100%-100px)]">
        <el-table :data="tableData" style="width: 100%" height="650">
          <el-table-column
            type="index"
            label="序号"
            width="60"
            align="center"
          />
          <el-table-column prop="type" label="报警类型" align="center">
            <template #default="{ row }">
              <el-tag v-if="row.type == '预警'" type="info">预警</el-tag>
              <el-tag v-else-if="row.type == '一般'" class="ml-2">一般</el-tag>
              <el-tag v-else-if="row.type == '严重'" type="warning"
                >严重</el-tag
              >
              <el-tag v-else-if="row.type == '紧急'" type="danger">紧急</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="content" label="报警内容" align="center" />
          <el-table-column prop="time" label="处理时间" align="center" />
        </el-table>
        <el-pagination
          v-model:current-page="currentPage"
          :page-size="100"
          :small="'small'"
          :background="true"
          layout="total,  prev, pager, next, jumper"
          :total="400"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </zh-module>
  </div>
</template>
