<template>
  <div class="main-box">
    <div class="card filter">
      <TreeFilter
        label="structure_name"
        id="structure_id"
        title=""
        :data="treeFilterData"
        ref="treeFilterRef"
        :default-value="initParam.structure_id"
      />
    </div>
    <div class="table-box"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import TreeFilter from "@/components/TreeFilter/index.vue";

import { getStructureList, getStageList, getSubjectList, getSchemeList } from "@/api/modules/base";
import { getResList } from "@/api/modules/res";

const treeFilterData = ref<any>([]);

const initParam = reactive({ structure_id: "367554" });

const getSchemeTree = async (scheme_id: number = 500124397) => {
  //   const { data } = await getStructureList({ scheme_id });
  const data = [
    {
      structure_id: "1",
      structure_name: "华东分部",
      children: [
        {
          structure_id: "11",
          structure_name: "研发部"
        },
        {
          structure_id: "12",
          structure_name: "市场部"
        },
        {
          structure_id: "13",
          structure_name: "商务部"
        },
        {
          structure_id: "14",
          structure_name: "财务部"
        }
      ]
    },
    {
      structure_id: "2",
      structure_name: "华南分部",
      children: [
        {
          structure_id: "21",
          structure_name: "研发部"
        },
        {
          structure_id: "22",
          structure_name: "市场部"
        },
        {
          structure_id: "23",
          structure_name: "商务部"
        },
        {
          structure_id: "24",
          structure_name: "财务部"
        }
      ]
    },
    {
      structure_id: "3",
      structure_name: "西北分部",
      children: [
        {
          structure_id: "31",
          structure_name: "研发部"
        },
        {
          structure_id: "32",
          structure_name: "市场部"
        },
        {
          structure_id: "33",
          structure_name: "商务部"
        },
        {
          structure_id: "34",
          structure_name: "财务部"
        }
      ]
    }
  ];
  treeFilterData.value = data;
  initParam.structure_id = data[0].structure_id.toString();
};

onMounted(() => {
  getSchemeTree();
});
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
