<template>
  <div class="main-box">
    <el-tabs v-model="activeName" @tab-change="tabChange">
      <el-tab-pane label="条文属性" name="attr" :disabled="tagRef?.editing">
        <div class="card">
          <GroupTagList ref="attrRef" :is-attr="true" />
        </div>
      </el-tab-pane>
      <el-tab-pane label="命名标签" name="tag" :disabled="attrRef?.editing" lazy>
        <div class="card">
          <GroupTagList ref="tagRef" :is-attr="false" />
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { TabPaneName } from "element-plus";
import GroupTagList from "./components/GroupTagList.vue";
const activeName = ref("attr");
const attrRef = ref<typeof GroupTagList>();
const tagRef = ref<typeof GroupTagList>();

// 切换
function tabChange(name: TabPaneName) {
  if (name === "attr") {
    attrRef.value?.getDataList();
  } else {
    tagRef.value?.getDataList();
  }
}
</script>
<style lang="scss" scoped>
.main-box {
  height: 100%;
  padding: 0;
  padding-bottom: 10px;
  :deep(.el-tabs) {
    display: flex;
    flex-direction: column;
    width: 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;
      .el-tab-pane {
        height: 100%;
      }
    }
  }
}
.card {
  height: 100%;
  margin: 0 20px;
}
</style>
