<template>
  <div class="share-list-container">
    <el-card shadow="never" class="data-list-card">
      <div class="header-section">
        <div class="page-title">XXXXXXXX分享数据</div>
        <div class="count-info">报名：2</div>
      </div>

      <div class="table-content">
        <el-table :data="tableData" style="width: 100%" :header-cell-style="{ backgroundColor: '#f8f9fb' }">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="姓名" align="left" min-width="200">
            <template #default="scope">
              <span class="name-link">{{ scope.row.name }}</span>
            </template>
          </el-table-column>
          <el-table-column label="性别" align="center" prop="gender" width="100" />
          <el-table-column label="手机号" align="center" prop="phone" width="180" />
          <el-table-column label="状态" align="center" width="150">
            <template #default="scope">
              <div class="status-wrapper">
                <span class="status-dot" :class="'status-' + scope.row.status"></span>
                <span>{{ scope.row.statusText }}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="测评时间" align="center" prop="examTime" width="220" />
          <el-table-column label="操作" align="center" width="280" fixed="right">
            <template #default="scope">
              <el-button type="primary" link @click="handleExamDetail(scope.row)">测评详情</el-button>
              <el-button type="primary" link @click="handlePoster(scope.row)">生成海报</el-button>
              <el-button type="primary" link @click="handleResume(scope.row)">查看简历</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script setup name="ShareDataList">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const tableData = ref([
  { name: '小张小张自有主张', gender: '男', phone: '18438573743', status: 'pass', statusText: '通过', examTime: '2025-03-21 10:27:56' },
  { name: '小张小张自有主张', gender: '男', phone: '18438573743', status: 'fail', statusText: '未通过', examTime: '2025-03-21 10:27:56' },
  { name: '小张小张自有主张', gender: '男', phone: '18438573743', status: 'pending', statusText: '待评分', examTime: '2025-03-21 10:27:56' },
]);

const handleExamDetail = (row) => {
  router.push('/system/tenant/exam-report/index');
};

const handleResume = (row) => {
  router.push('/system/tenant/student-detail/index');
};

const handlePoster = (row) => {
  console.log('生成海报');
};
</script>

<style scoped lang="scss">
.share-list-container {
  padding: 20px;
  background-color: #f7f8fa;
  min-height: 100vh;
}
.data-list-card {
  border-radius: 8px;
  .header-section {
    margin-bottom: 25px;
    .page-title { font-size: 18px; font-weight: bold; margin-bottom: 10px; }
    .count-info { font-size: 14px; color: #666; }
  }
}
.name-link { color: #007bff; cursor: pointer; }
.status-wrapper { display: flex; align-items: center; justify-content: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pass { background-color: #67C23A; }
.status-fail { background-color: #F56C6C; }
.status-pending { background-color: #E6A23C; }
</style>
