<template>
  <div>
    <el-row :gutter="10">
      <el-col :span="12">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="人才详情" />
          </template>
          <Info :id="id" :user-id="userId" />
        </el-card>
      </el-col>
      <el-col :span="6" v-hasPermi="['menduner:system:person-job-favorite:query']">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="职位收藏、企业收藏数" />
          </template>
          <Collect :user-id="userId" />
        </el-card>
        <el-card shadow="never" class="m-t-10px" v-hasPermi="['menduner:system:cv-attachment:query']">
          <template #header>
            <CardTitle title="附件简历" />
          </template>
          <Attachment :user-id="userId" />
        </el-card>
      </el-col>
      <el-col :span="6" v-hasPermi="['menduner:system:user-account:query']">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="账户信息" />
          </template>
          <Account :user-id="userId" />
        </el-card>
      </el-col>
    </el-row>

    <el-row class="m-t-20px" v-if="type && type === '1'">
      <el-col :span="24">
        <Student :user-id="userId" />
      </el-col>
    </el-row>

    <el-row class="m-t-20px">
      <el-col :span="24">
        <el-card shadow="never">
          <el-tabs>
            <el-tab-pane label="职位投递记录" v-hasPermi="['menduner:system:job-cv-rel:query']">
              <DeliveryJob :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane label="面试邀约记录" v-hasPermi="['menduner:system:interview-invite:query']">
              <InterviewInvite :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:edu-exp:query']" label="教育经历">
              <Edu :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:work-exp:query']" label="工作经历">
              <Exp :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:job-interested:query']" label="求职意向">
              <JobIntention :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:user-account:query']" label="钱包充值记录">
              <RechargeOrder :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane label="余额明细" v-hasPermi="['pay:wallet:query']">
              <BalanceDetails :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:user-account-record:query']" label="积分变动记录">
              <PointsChange :user-id="userId" />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
defineOptions({ name: 'PersonDetails'})
import { useTagsViewStore } from '@/store/modules/tagsView'
import { ElMessage } from 'element-plus'
import Info from './components/info.vue'
import Account from './components/account.vue'
import Edu from './components/edu.vue'
import Exp from './components/exp.vue'
import JobIntention from './components/jobIntention.vue'
import RechargeOrder from './components/rechargeOrder.vue'
import PointsChange from './components/pointsChange.vue'
import Collect from './components/collect.vue'
import Attachment from './components/attachment.vue'
import DeliveryJob from './components/deliveryJob.vue'
import BalanceDetails from './components/balanceDetails.vue'
import InterviewInvite from './components/interviewInvite.vue'
import Student from './components/student.vue'

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