<template>
  <div class="main-dashboard">
    <div class="header">
      <h1>海洋科考数据统计分析</h1>
      <p>全面展示各类科考设备与平台的运行数据统计</p>
    </div>

    <el-row :gutter="20" class="stats-grid">
      <!-- 科考船汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('ships')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-ship"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">科考船汇总统计</h3>
              <p class="card-count">4艘</p>
              <p class="card-desc">探索一号、探索二号、探索三号、海警101船</p>
            </div>
          </div>
        </el-card>
      </el-col>

      <!-- 载人潜水器汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('hov')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-watermelon"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">载人潜水器汇总统计</h3>
              <p class="card-count">2型</p>
              <p class="card-desc">深海勇士、奋斗者等</p>
            </div>
          </div>
        </el-card>
      </el-col>

      <!-- 遥控潜水器汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('rov')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-cpu"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">遥控潜水器汇总统计</h3>
              <p class="card-count loading">数据加载中</p>
              <p class="card-desc"></p>
            </div>
          </div>
        </el-card>
      </el-col>

      <!-- 无人航行潜水器汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('uuv')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-help"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">无人航行潜水器汇总统计</h3>
              <p class="card-count loading">数据加载中</p>
              <p class="card-desc"></p>
            </div>
          </div>
        </el-card>
      </el-col>

      <!-- 基站汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('stations')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-office-building"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">基站汇总统计</h3>
              <p class="card-count no-data">暂无数据</p>
              <p class="card-desc">深海站、深渊站、国际站</p>
            </div>
          </div>
        </el-card>
      </el-col>

      <!-- 着陆器汇总统计 -->
      <el-col :xs="24" :sm="12" :md="8">
        <el-card
          class="stat-card"
          shadow="hover"
          @click.native="goToDetail('landers')"
        >
          <div class="card-content">
            <div class="card-icon">
              <i class="el-icon-place"></i>
            </div>
            <div class="card-info">
              <h3 class="card-title">着陆器汇总统计</h3>
              <p class="card-count no-data">暂无数据</p>
              <p class="card-desc"></p>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'MainDashboard',
  data() {
    return {

    }
  },
  methods: {
    goToDetail(type) {
      this.$router.push(`/container/${type}`);
    }
  }
}
</script>

<style scoped>
.main-dashboard {
  padding: 20px;
  background-color: #f0f7ff;
  min-height: calc(100vh - 130px);
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  color: #1a365d;
  font-size: 28px;
  margin-bottom: 10px;
  font-weight: 600;
}

.header p {
  color: #4a5568;
  font-size: 16px;
}

.stats-grid {
  margin: 0 auto;
}

.stat-card {
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 8px;
  border: none;
  height: 140px;
  display: flex;
  align-items: center;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card-content {
  display: flex;
  align-items: center;
  padding: 15px;
  width: 100%;
}

.card-icon {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background-color: #ebf8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  flex-shrink: 0;
}

.card-icon i {
  font-size: 36px;
  color: #3182ce;
}

.card-info {
  flex: 1;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
}

.card-count {
  font-size: 28px;
  font-weight: 700;
  color: #3182ce;
  margin-bottom: 5px;
}

.card-desc {
  font-size: 14px;
  color: #718096;
  line-height: 1.4;
}

.loading {
  color: #a0aec0;
}

.no-data {
  color: #e53e3e;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .stat-card {
    height: auto;
  }

  .card-content {
    flex-direction: column;
    text-align: center;
  }

  .card-icon {
    margin-right: 0;
    margin-bottom: 15px;
  }
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card {
  animation: fadeInUp 0.5s ease forwards;
}

.el-col:nth-child(1) .stat-card { animation-delay: 0.1s; }
.el-col:nth-child(2) .stat-card { animation-delay: 0.2s; }
.el-col:nth-child(3) .stat-card { animation-delay: 0.3s; }
.el-col:nth-child(4) .stat-card { animation-delay: 0.4s; }
.el-col:nth-child(5) .stat-card { animation-delay: 0.5s; }
.el-col:nth-child(6) .stat-card { animation-delay: 0.6s; }
</style>
