<template>
  <div>
    <el-row :gutter="10">
      <el-col :span="12">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="企业详情" />
          </template>
          <Info :id="id"/>
        </el-card>
      </el-col>
      <el-col v-hasPermi="['menduner:system:enterprise-business:query']" :span="12">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="企业工商信息" />
          </template>
          <Business :id="id" />
        </el-card>
      </el-col>
    </el-row>

    <el-row class="m-t-20px">
      <el-col :span="24">
        <el-card shadow="never">
          <el-tabs>
            <el-tab-pane label="下级企业">
              <SubordinateEnterprises :id="id" />
            </el-tab-pane>
            <el-tab-pane label="企业用户">
              <EnterpriseUser :id="id" />
            </el-tab-pane>
            <el-tab-pane label="招聘职位">
              <EnterpriseJob :id="id" />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
defineOptions({ name: 'EnterpriseDetails'})
import { useTagsViewStore } from '@/store/modules/tagsView'
import { ElMessage } from 'element-plus'
import Info from './components/info.vue'
import Business from './components/businessInfo.vue'
import SubordinateEnterprises from './components/subordinateEnterprises.vue'
import EnterpriseUser from './components/user.vue'
import EnterpriseJob from './components/job.vue'

/** 初始化 */
const { currentRoute } = useRouter() // 路由
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const id = route.params.id
onMounted(() => {
  if (!id) {
    ElMessage.warning('参数错误，企业编号不能为空！')
    delView(unref(currentRoute))
    return
  }
})
</script>
