<template>
  <div class="app-container home">
    <el-card class="box-card" shadow="hover">
      <template #header>
        <div class="card-header">
          <div>设备数量信息</div>
        </div>
      </template>
      <el-row class="card-content">
        <el-col :span="8">
          <h3>在线</h3>
          <h1 class="online">{{ deviceInfoList.onlineNum }}</h1>
        </el-col>
        <el-col :span="8">
          <h3>离线</h3>
          <h1 class="offline">{{ deviceInfoList.offlineNum }}</h1>
        </el-col>
        <el-col :span="8">
          <h3>总量</h3>
          <h1>{{ deviceInfoList.totalNum }}</h1>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script setup name="Index">
import { deviceInfo } from '../api';

const deviceInfoList = ref({})

function getDeviceInfo() {
  deviceInfo().then(res => {
    deviceInfoList.value = res.data
  })
}
getDeviceInfo()

</script>

<style scoped lang="scss">
:deep(.el-card__header) {
  height: 50px;
  display: flex;
  align-items: center;
  padding: 10px 15px !important;
}

.card-content {
  display: flex;

  .online {
    color: #13ce66;
  }

  .offline {
    color: #ff430d;
  }

  h1, h3{
    font-weight: bold;
  }
}
</style>

