<template>
  <div class="main-box">
    <el-tabs v-model="activeName" @tab-change="tabChange">
      <el-tab-pane label="待分工" name="first">
        <DivisionList ref="firstRef" :is-allocated="false" />
      </el-tab-pane>
      <el-tab-pane label="已分工" name="second" lazy>
        <DivisionList ref="secondRef" :is-allocated="true" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { TabPaneName } from "element-plus";
import DivisionList from "./components/DivisionList.vue";
const activeName = ref("first");
const firstRef = ref<typeof DivisionList>();
const secondRef = ref<typeof DivisionList>();

function tabChange(name: TabPaneName) {
  if (name === "first") {
    firstRef.value?.getTableList();
  } else {
    secondRef.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>
