<template>
  <div class="app-container">
    <!-- 头部区域 -->
    <div class="header-section">
      <div class="header-content">
        <div>
          <h1 class="page-title">PDC线PAD模块路由导航</h1>
          <p class="page-subtitle">PLCS系统集成导航页</p>
        </div>
      </div>
    </div>

    <!-- 欢迎区域 -->
    <div class="welcome-section">
      <div class="welcome-card">
        <div class="welcome-content">
          <div class="welcome-icon">
            <el-icon size="60" color="#667eea">
              <Grid />
            </el-icon>
          </div>
          <div class="welcome-text">
            <h2>PDC线PAD模块路由导航</h2>
            <p>请选择以下功能模块进入相应系统</p>
          </div>
        </div>
      </div>
    </div>

    <!-- 导航功能区 -->
    <div class="navigation-section">
      <div class="nav-grid">
        <!-- PLCS接口调用记录 -->
        <div class="nav-card" @click="navigateTo('/InterfaceUseLog')">
          <div class="nav-icon">
            <el-icon size="48" color="#667eea">
              <DataBoard />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>PLCS接口调用记录</h3>
            <p>查询MOM接口数据调用记录，支持接口重试和流程重试</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- PLCS返修上线 -->
        <div class="nav-card" @click="navigateTo('/repairOnline')">
          <div class="nav-icon">
            <el-icon size="48" color="#67c23a">
              <RefreshRight />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>PLCS返修上线</h3>
            <p>处理产品返修上线业务，选择再起始工位和返修上线口</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- 电检工艺路线返修上线 -->
        <div class="nav-card" @click="navigateTo('/electricRepairOnline')">
          <div class="nav-icon">
            <el-icon size="48" color="#1f4037">
              <Connection />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>电检路线返修上线</h3>
            <p>专门处理电检路线产品返修，附带工艺开关</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- 手动静置出库 -->
        <div class="nav-card" @click="navigateTo('/manualStaticOut')">
          <div class="nav-icon">
            <el-icon size="48" color="#0f766e">
              <Timer />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>手动静置出库</h3>
            <p>OP431人工静置扫码查询，配置静置标准并确认上线</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- 返修记录查询 -->
        <div class="nav-card" @click="navigateTo('/repairOnlineSearch')">
          <div class="nav-icon">
            <el-icon size="48" color="#f093fb">
              <Search />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>返修记录查询</h3>
            <p>查询产品返修记录，支持按工位、产品编号、状态筛选</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- PLCS首件拍照上传 -->
        <div class="nav-card" @click="navigateTo('/firstPartImageUpload')">
          <div class="nav-icon">
            <el-icon size="48" color="#e6a23c">
              <Camera />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>PLCS首件拍照上传</h3>
            <p>首件产品拍照上传系统</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- PLCS工位异常处理 -->
        <div class="nav-card" @click="navigateTo('/op')">
          <div class="nav-icon">
            <el-icon size="48" color="#f56c6c">
              <Warning />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>PLCS工位异常处理</h3>
            <p>处理工位进站、出站异常，申请条码重试等操作</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>

        <!-- PACK下线三码校验 -->
        <div class="nav-card" @click="navigateTo('/threeCodeVerify')">
          <div class="nav-icon">
            <el-icon size="48" color="#409eff">
              <Aim />
            </el-icon>
          </div>
          <div class="nav-content">
            <h3>PACK下线三码校验</h3>
            <p>扫描PACK码、箱体码、客户标签码进行三码一致性校验</p>
          </div>
          <div class="nav-arrow">
            <el-icon>
              <ArrowRight />
            </el-icon>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { Grid, DataBoard, RefreshRight, Connection, Camera, Warning, ArrowRight, Search, Aim, Timer } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'

// 获取路由实例
const router = useRouter()

// 页面跳转
const navigateTo = (path) => {
  router.push(path)
}
</script>

<style lang="scss" scoped>
.app-container {
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

// 头部样式
.header-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .page-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 5px 0;
  }

  .page-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
  }

  .header-actions {
    display: flex;
    gap: 10px;
  }
}

// 欢迎区域
.welcome-section {
  padding: 30px;

  .welcome-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;

    .welcome-content {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20px;

      .welcome-icon {
        flex-shrink: 0;
      }

      .welcome-text {
        h2 {
          margin: 0 0 8px 0;
          color: #303133;
          font-size: 20px;
          font-weight: 600;
        }

        p {
          margin: 0;
          color: #606266;
          font-size: 14px;
        }
      }
    }
  }
}

// 导航区域
.navigation-section {
  flex: 1;
  padding: 0 30px 30px;
  overflow: auto;

  .nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
  }

  .nav-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    }

    .nav-icon {
      flex-shrink: 0;
      width: 80px;
      height: 80px;
      border-radius: 12px;
      background: linear-gradient(135deg, #f0f2f5 0%, #e8ecf2 100%);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .nav-content {
      flex: 1;

      h3 {
        margin: 0 0 8px 0;
        color: #303133;
        font-size: 16px;
        font-weight: 600;
      }

      p {
        margin: 0;
        color: #606266;
        font-size: 13px;
        line-height: 1.4;
      }
    }

    .nav-arrow {
      flex-shrink: 0;
      color: #c0c4cc;
      transition: color 0.3s ease;

      &:hover {
        color: #667eea;
      }
    }
  }
}


// 响应式适配
@media (max-width: 1200px) {
  .navigation-section {
    .nav-grid {
      grid-template-columns: 1fr;
    }
  }
}

@media (max-width: 768px) {
  .header-section {
    padding: 16px 20px;

    .header-content {
      flex-direction: column;
      gap: 12px;
      align-items: flex-start;
    }
  }

  .welcome-section {
    padding: 20px;

    .welcome-card {
      padding: 20px;

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

        .welcome-text {
          h2 {
            font-size: 18px;
          }
        }
      }
    }
  }

  .navigation-section {
    padding: 0 20px 20px;

    .nav-card {
      padding: 16px;

      .nav-icon {
        width: 60px;
        height: 60px;
      }

      .nav-content {
        h3 {
          font-size: 14px;
        }

        p {
          font-size: 12px;
        }
      }
    }
  }
}
</style>
