import { NTabPane, NTabs } from 'naive-ui'
import { defineComponent, h, reactive, resolveDynamicComponent } from 'vue'
import CityList from './component/city-list'
import SubsidyList from './component/subsidy-list'
import { getTabsCache, setTabsCaches } from '@/hooks/use-async'
import { useRoute } from 'vue-router'
export default defineComponent({
  name: 'city-manage',
  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">
          <h2>城市管理</h2>

          <div class={['section-container']} style="padding-top: 20px">
            <CityList />
            {/* <NTabs
              type="line"
              size="large"
              v-model:value={state.tabName}
              onUpdate:value={(val: any) => setTabs(val)}
            >
              <NTabPane
                name="CityList"
                tab="城市列表"
                v-auth="cityFeeSetting/page1597885815002091522"
              >
                <CityList />
              </NTabPane>
              <NTabPane
                name="SubsidyList"
                tab="补助标准"
                v-auth="orchestraSubsidyStandard/page1597886618878201858"
              >
                <SubsidyList />
              </NTabPane>
            </NTabs> */}
          </div>
        </div>
      )
    }
  }
})
