import { NTabPane, NTabs } from 'naive-ui'
import { defineComponent, h, reactive, resolveDynamicComponent } from 'vue'
import EmployeeManage from './index'
import RoleManage from '@/views/system-manage/role-mange/index'
import StationManage from '@/views/system-manage/station-manage/index'
import { useRoute } from 'vue-router'
import { getTabsCache, setTabsCaches } from '@/hooks/use-async'
export default defineComponent({
  name: 'employee-tab',
  setup() {
    const state = reactive({
      tabName: 'CityList' as 'CityList' | 'SubsidyList'
    })
    const route = useRoute()
    getTabsCache((val: any) => {
      if (val.form.tabName) {
        state.tabName = val.form.tabName
      }
    })
    const setTabs = (val: any) => {
      setTabsCaches(val, 'tabName', route)
    }
    return () => {
      // const Component = resolveDynamicComponent(state.componentName)
      return (
        <div class="system-menu-container">
          <div class={['section-container']} style="padding-top: 0">
            <NTabs
              type="line"
              size="large"
              v-model:value={state.tabName}
              onUpdate:value={(val: any) => setTabs(val)}
            >
              <NTabPane name="CityList" tab="员工管理" v-auth="sysEmployee/page1674714842241478657">
                <EmployeeManage></EmployeeManage>
              </NTabPane>
              <NTabPane
                name="SubsidyList"
                tab="岗位管理"
                v-auth="sysPosition/page1674714590209945602"
              >
                <StationManage></StationManage>
              </NTabPane>
            </NTabs>
          </div>
        </div>
      )
    }
  }
})
