<template>
  <div class="main-box">
    <el-tabs v-model="activeName" @tab-change="refreshData">
      <el-tab-pane label="待审核" name="pending">
        <AuditList ref="pendingRef" :is-audit="false" />
      </el-tab-pane>
      <el-tab-pane label="已审核" name="resolve" lazy>
        <AuditList ref="resolveRef" :is-audit="true" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup lang="ts" name="AnnoAudit">
import { ref } from "vue";
import { usePageKeepALive } from "@/hooks";
import AuditList from "./components/AuditList.vue";

const DETAIL_PAGE_ROUTE = "AnnoAuditDetail";
// 页面缓存
usePageKeepALive([DETAIL_PAGE_ROUTE], refreshData);
const pendingRef = ref<typeof AuditList>();
const resolveRef = ref<typeof AuditList>();
const activeName = ref("pending");

function refreshData() {
  if (activeName.value === "pending") {
    pendingRef.value?.getTableList();
  } else {
    resolveRef.value?.getTableList();
  }
}
</script>
<style lang="scss" scoped>
.main-box {
  height: 100%;
  padding: 0;
  padding-bottom: 10px;
  :deep(.el-tabs) {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin-top: 1px;

    --el-tabs-header-height: 56px;
    .el-tabs__header {
      margin-bottom: 10px;
      background: #ffffff;
      .el-tabs__nav-wrap {
        padding-left: 20px;
      }
      .el-tabs__item {
        font-size: 16px;
        &.is-active {
          font-size: 18px;
        }
      }
      .el-tabs__nav-scroll {
        &::after {
          height: 1px;
          background: #dcdfe6;
        }
      }
    }
    .el-tabs__content {
      flex: 1;
      margin: 0 20px;
      .el-tab-pane {
        height: 100%;
      }
    }
  }
}
</style>
