<template>
  <el-table v-loading="loading" :data="tableData" :stripe="true" class="m-t-20px">
    <el-table-column label="企业名称" align="center" prop="enterpriseName" />
    <el-table-column label="所属部门" align="center" prop="deptName" />
    <el-table-column label="所属行业" align="center" prop="industryId" />
    <el-table-column label="职位名称" align="center" prop="positionName" />
    <el-table-column label="薪酬" align="center" prop="pay" />
    <el-table-column label="薪酬类型" align="center" prop="payUnit">
      <template #default="scope">
        <dict-tag :type="DICT_TYPE.MENDUNER_PAY_TYPE" :value="scope.row.payUnit" />
      </template>
    </el-table-column>
    <el-table-column label="货币类型" align="center" prop="currencyType">
      <template #default="scope">
        <dict-tag :type="DICT_TYPE.MENDUNER_CURRENCY_TYPE" :value="scope.row.currencyType" />
      </template>
    </el-table-column>
    <el-table-column
      label="工作开始日期"
      align="center"
      prop="startTime"
      :formatter="dateFormatter2"
      width="180px"
    />
    <el-table-column
      label="工作结束日期"
      align="center"
      prop="endTime"
      :formatter="dateFormatter2"
      width="180px"
    />
    <el-table-column label="业绩" align="center" prop="achievement" :show-overflow-tooltip="true" />
    <el-table-column label="工作内容" align="center" prop="content" :show-overflow-tooltip="true" />
  </el-table>

  <Pagination
    :total="total"
    v-model:page="queryParams.pageNo"
    v-model:limit="queryParams.pageSize"
    @pagination="getList"
  />
</template>

<script setup>
defineOptions({ name: 'PersonExpList'})
import { PersonInfoApi } from '@/api/menduner/system/person'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter2 } from '@/utils/formatTime'

const props = defineProps({
  userId: String
})

const loading = ref(false)
const tableData = ref([])
const total = ref(0)
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  userId: props.userId
})

const getList = async () => {
  loading.value = true
  try {
    const data = await PersonInfoApi.getPersonExpPage(queryParams)
    tableData.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}
getList()
</script>
