index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div>
  3. <v-card class="card-box pa-5">
  4. <div class="d-flex justify-center mt-3">
  5. <TextUI :item="textItem" @enter="handleEnter" @appendInnerClick="handleEnter"></TextUI>
  6. </div>
  7. <div class="text-end">
  8. <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">{{ $t('position.newPositionsAdded') }}</v-btn>
  9. </div>
  10. <div class="mt-3">
  11. <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f7f8fa" @update:model-value="handleChangeTab">
  12. <v-tab v-for="val in tabList" :key="val.value" :value="val.value"> {{ val.label }}</v-tab>
  13. </v-tabs>
  14. <v-window v-model="tab" class="mt-1">
  15. <v-window-item v-for="val in tabList" :key="val.value" :value="val.value">
  16. <PositionItem v-if="items.length" :tab="val.value" :items="items" @refresh="getPositionList"></PositionItem>
  17. </v-window-item>
  18. </v-window>
  19. <Empty v-if="!items.length" :message="tipsText" :elevation="false"></Empty>
  20. <CtPagination
  21. v-else
  22. :total="total"
  23. :page="query.pageNo"
  24. :limit="query.pageSize"
  25. @handleChange="handleChangePage"
  26. ></CtPagination>
  27. </div>
  28. </v-card>
  29. </div>
  30. </template>
  31. <script setup>
  32. defineOptions({ name: 'enterprise-position-list'})
  33. import { ref } from 'vue'
  34. import TextUI from '@/components/FormUI/TextInput'
  35. import PositionItem from './components/item.vue'
  36. import { useRouter } from 'vue-router'
  37. import { getJobAdvertisedList } from '@/api/position'
  38. import { dealDictArrayData } from '@/views/recruit/personal/position/components/dict'
  39. import { useI18n } from '@/hooks/web/useI18n'
  40. const { t } = useI18n()
  41. const router = useRouter()
  42. const tab = ref(1)
  43. const total = ref(0)
  44. const tipsText = ref(t('common.noData'))
  45. const query = ref({
  46. pageSize: 10,
  47. pageNo: 1
  48. })
  49. const tabList = [
  50. { label: t('position.recruitmentInProgress'), value: 1 },
  51. { label: t('position.closed'), value: 2 },
  52. { label: t('position.expiredPosition'), value: 3 },
  53. { label: t('position.publicRecruitment'), value: 4 }
  54. ]
  55. const items = ref([])
  56. const textItem = ref({
  57. type: 'text',
  58. width: 600,
  59. value: '',
  60. label: '请输入职位名称',
  61. appendInnerIcon: 'mdi-magnify'
  62. })
  63. const handleAdd = () => {
  64. router.push('/recruit/enterprise/position/add')
  65. }
  66. // 获取职位列表
  67. const getPositionList = async () => {
  68. query.value.hasExpiredData = tab.value === 3 ? true : false
  69. if (tab.value !== 3) {
  70. query.value.status = tab.value === 1 ? 0 : 1
  71. } else delete query.value.status
  72. const { list, total: number } = await getJobAdvertisedList(query.value)
  73. if (!list.length) {
  74. if (query.value.name) tipsText.value = '暂无数据,请更换关键词后再试'
  75. }
  76. total.value = number
  77. items.value = list.length ? dealDictArrayData([], list) : []
  78. }
  79. getPositionList()
  80. const handleChangeTab = () => {
  81. query.value.pageNo = 1
  82. getPositionList()
  83. }
  84. const handleChangePage = (index) => {
  85. query.value.pageNo = index
  86. getPositionList()
  87. }
  88. // 职位名称检索
  89. const handleEnter = (e) => {
  90. query.value.name = e
  91. query.value.pageNo = 1
  92. getPositionList()
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. </style>