item.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div>
  3. <div v-if="items.length">
  4. <div v-for="val in items" :key="val.id" class="itemBox mb-3" style="height: 134px;">
  5. <div class="d-flex justify-space-between cursor-pointer" style="padding: 10px 20px;">
  6. <div class="position">
  7. <div class="d-flex align-center">
  8. <span class="position-name">{{ formatName(val.name) }}</span>
  9. </div>
  10. <div :class="['mt-3', 'other-info', 'ellipsis']">
  11. <span>{{ !val.areaId ? '全国' : val.areaName }}</span>
  12. <span class="lines" v-if="!val.areaId || (val.areaName && val.eduName)"></span>
  13. <span>{{ val.eduName }}</span>
  14. <span class="lines"></span>
  15. <span>{{ val.expName }}</span>
  16. <span class="lines"></span>
  17. <span v-if="!val.payFrom && !val.payTo">面议</span>
  18. <span v-else>{{ val.payFrom ? val.payFrom + '-' : '' }}{{ val.payTo }}{{ val.payName ? '/' + val.payName : '' }}</span>
  19. <span class="lines" v-if="val.positionName"></span>
  20. <span>{{ val.positionName }}</span>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="bottom pa-5 d-flex justify-space-between align-center">
  25. <div>到期时间:{{ val.expireTime ? timesTampChange(val.expireTime, 'Y-M-D') : '长期有效' }}</div>
  26. <div class="d-flex">
  27. <span class="cursor-pointer actions" @click="handleEdit(val)">编辑</span>
  28. <span class="lines"></span>
  29. <span class="cursor-pointer actions" @click="handleRemove(val)">移出招聘会</span>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <Empty v-else :elevation="false"></Empty>
  35. </div>
  36. <Loading :visible="loading"></Loading>
  37. </template>
  38. <script setup>
  39. defineOptions({ name: 'enterprise-position-item'})
  40. import { ref } from 'vue'
  41. import { useRouter, useRoute } from 'vue-router'
  42. import { timesTampChange } from '@/utils/date'
  43. import Snackbar from '@/plugins/snackbar'
  44. import { getEnterprisePubJobTypePermission } from '@/api/recruit/enterprise/position'
  45. import { quitJobFairPosition } from '@/api/recruit/enterprise/jobFair'
  46. import Confirm from '@/plugins/confirm'
  47. import { formatName } from '@/utils/getText'
  48. const emit = defineEmits(['refresh'])
  49. defineProps({
  50. items: Array
  51. })
  52. const loading = ref(false)
  53. const router = useRouter()
  54. const route = useRoute()
  55. // 职位编辑
  56. const handleEdit = async (val) => {
  57. const data = await getEnterprisePubJobTypePermission()
  58. if (!data || !data.length) return Snackbar.warning('没有该操作权限,请联系平台管理员升级后再试')
  59. router.push(`/recruit/enterprise/jobFair/details/${route.params.id}/edit?id=${val.id}`)
  60. }
  61. const handleRemove = ({ id }) => {
  62. Confirm('确定要移出该职位吗?', '提示').then(async () => {
  63. await quitJobFairPosition({
  64. jobFairId: route.params.id,
  65. jobId: id
  66. })
  67. Snackbar.success('移出成功')
  68. emit('refresh')
  69. })
  70. }
  71. </script>
  72. <style scoped lang="scss">
  73. .itemBox {
  74. position: relative;
  75. border: 1px solid #e5e6eb;
  76. }
  77. .position-name {
  78. color: var(--color-333);
  79. font-size: 19px;
  80. }
  81. .position {
  82. max-width: 46%;
  83. position: relative;
  84. .item-select {
  85. position: absolute;
  86. left: -8px;
  87. top: -13px;
  88. }
  89. }
  90. .lines {
  91. display: inline-block;
  92. width: 1px;
  93. height: 17px;
  94. vertical-align: middle;
  95. background-color: #e0e0e0;
  96. margin: 0 10px;
  97. }
  98. .other-info {
  99. font-size: 15px;
  100. color: var(--color-666);
  101. }
  102. .bottom {
  103. position: absolute;
  104. bottom: 0;
  105. left: 0;
  106. width: 100%;
  107. height: 40px;
  108. background-color: #f7f8fa;
  109. font-size: 14px;
  110. color: var(--color-888);
  111. }
  112. .actions:hover {
  113. color: var(--v-primary-base);
  114. }
  115. </style>