<template>
  <div class="container">
    <Info :infoData="projectData" />
    <div class="test-container">
      <div class="title">测试结果</div>
      <div>
        <el-button @click="handler('重庆')">生成报告</el-button>
        <el-button>导出结果</el-button>
      </div>
    </div>

    <el-table :data="tableData" style="width: 100%">
          <el-table-column prop="id" label="结果ID" />
          <el-table-column prop="time" label="时间" />
          <el-table-column prop="text" label="语料文本" />
          <el-table-column prop="rate" label="字识别率" show-overflow-tooltip>
            <template #default="{ row }">
              <div v-if="row.rate">{{ row.rate }}</div>
              <div v-else><el-tag type="info">未测试</el-tag></div>
            </template>
          </el-table-column>
          <el-table-column prop="result" label="测试结果">
            <template #default="{ row }">
              <el-tag :type="row.result ? 'success' : 'warning'">{{ row.result ? '通过' : '分析中' }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="can" label="CAN结果">
            <template #default="{ row }">
              <div v-if="row.rate">{{ row.can }}</div>
              <div v-else><el-tag type="danger">未测试</el-tag></div>
            </template>
          </el-table-column>
          <el-table-column prop="responseTime" label="响应时间" />
          <el-table-column prop="flag" label="结果标记 " />
        </el-table>
  </div>
</template>
<script setup>
import Info from './info.vue';

const route = useRoute();

const projectData = route.query.data 
  ? JSON.parse(route.query.data) 
  : {};

const tableData = ref([]);
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  height: 100%;

  .btn-container {
    background: #fff;
    margin: 4px 0;
    padding: 4px 0;
  }

  .test-container {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .title {
      font-size: 20px;
      font-weight: bold;
    }
  }

  .context-container {
    height: calc(100% - 200px);
    display: flex;
    gap: 10px;

    .left {
      width: 300px;
      
      .title {
        height: 40px;
        display: flex;
        align-items: center;
        background: #fff;
        padding-left: 12px;
        border: 1px solid #e4e7ed;
        margin-bottom: 2px;
      }

      .schemaList {
        height: calc(100% - 40px);
        overflow-y: auto;
        background: #fff;
        border: 1px solid #e4e7ed;

        .schema {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 12px;

          &:hover {
            background: #f0ecec;
          }
        }

        .activeItem {
          background: #f0ecec;
        }
      }
    }

    .right {
      flex: 1;
    }
  }
}
</style>