<!--
  -    Copyright (c) 2018-2025, cyweb All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without
  - modification, are permitted provided that the following conditions are met:
  -
  - Redistributions of source code must retain the above copyright notice,
  - this list of conditions and the following disclaimer.
  - Redistributions in binary form must reproduce the above copyright
  - notice, this list of conditions and the following disclaimer in the
  - documentation and/or other materials provided with the distribution.
  - Neither the name of the pig4cloud.com developer nor the names of its
  - contributors may be used to endorse or promote products derived from
  - this software without specific prior written permission.
  -
  -->

<template>
  <div class="layout-padding">
    <div class="layout-padding-auto layout-padding-view">
      <el-tabs v-model="activeName" @tab-click="handleTabClick">
        <el-tab-pane label="回校列表" name="tab">
          <TabIndex ref="tabIndexRef" />
        </el-tab-pane>
        <el-tab-pane label="回校统计" name="static">
          <StaticIndex ref="staticIndexRef" />
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup lang="ts" name="backSchool">
import { ref, nextTick, defineAsyncComponent } from 'vue'

const TabIndex = defineAsyncComponent(() => import('./tabIndex.vue'))
const StaticIndex = defineAsyncComponent(() => import('./staticIndex.vue'))

const activeName = ref('tab')
const tabIndexRef = ref()
const staticIndexRef = ref()

const handleTabClick = (tab: any) => {
  if (tab.paneName == 'tab') {
    nextTick(() => {
      tabIndexRef.value?.init()
    })
  } else {
    nextTick(() => {
      staticIndexRef.value?.init()
    })
  }
}
</script>

<style lang="scss" scoped>
:deep(.el-tabs) {
  height: 100%;
  display: flex;
  flex-direction: column;
  
  .el-tab-pane {
    height: 100%;
  }
}
</style>
