details.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <v-card class="card-box pa-4">
  3. <div class="position-relative">
  4. <div class="text-end mb-3">
  5. <v-btn color="primary" @click="handleAdd">新增职位</v-btn>
  6. <v-btn color="primary" class="mx-3" variant="outlined" @click="handleJoin">选择已发布的职位加入招聘会</v-btn>
  7. <v-btn color="primary" v-if="bgImg" variant="outlined" prepend-icon="mdi-share-all" @click="handleShare">我的分享海报</v-btn>
  8. </div>
  9. <JobItem :items="jobList" @refresh="getJobList"></JobItem>
  10. <v-navigation-drawer v-model="showDrawer" location="right" temporary width="600">
  11. <Loading :visible="positionLoading" :contained="true"></Loading>
  12. <div class="resume-box">
  13. <div class="resume-header">
  14. <div class="resume-title mr-5">已发布职位</div>
  15. </div>
  16. </div>
  17. <div class="px-3">
  18. <v-text-field
  19. v-model="positionSearch"
  20. append-inner-icon="mdi-magnify"
  21. density="compact"
  22. :label="t('position.positionName')"
  23. variant="outlined"
  24. hide-details
  25. color="primary"
  26. single-line
  27. @click:append-inner="getPositionList"
  28. @keyup.enter="getPositionList"
  29. ></v-text-field>
  30. </div>
  31. <div class="pa-3" v-if="positionItems.length">
  32. <div v-for="val in positionItems" :key="val.id" class="itemBox mb-3" style="height: 80px;">
  33. <div class="d-flex justify-space-between" style="padding: 10px 20px;">
  34. <div class="position">
  35. <div class="d-flex align-center justify-space-between">
  36. <span class="position-name">{{ formatName(val.name) }}</span>
  37. <div>
  38. <v-btn size="small" color="primary" @click="handleTo(val)">添加至招聘会</v-btn>
  39. </div>
  40. </div>
  41. <div :class="['mt-3', 'other-info', 'ellipsis']">
  42. <span>{{ val.areaName ? val.area?.str : '全国' }}</span>
  43. <span class="lines" v-if="val.eduName"></span>
  44. <span>{{ val.eduName }}</span>
  45. <span class="lines"></span>
  46. <span>{{ val.expName }}</span>
  47. <span class="lines"></span>
  48. <span v-if="!val.payFrom && !val.payTo">面议</span>
  49. <span v-else>{{ val.payFrom ? val.payFrom + '-' : '' }}{{ val.payTo }}{{ val.payName ? '/' + val.payName : '' }}</span>
  50. <span class="lines" v-if="val.positionName"></span>
  51. <span>{{ val.positionName }}</span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <CtPagination
  57. v-if="total"
  58. :total="positionTotal"
  59. :page="positionPageInfo.pageNo"
  60. :limit="positionPageInfo.pageSize"
  61. @handleChange="handleChangePage"
  62. ></CtPagination>
  63. </div>
  64. <Empty v-else :elevation="false"></Empty>
  65. </v-navigation-drawer>
  66. <div class="hideCanvasView">
  67. <JobFairEntShare
  68. :show="showShare"
  69. :enterpriseName="enterpriseName"
  70. :logoUrl="logoUrl"
  71. :positionList="positionList"
  72. :bgImg="bgImg"
  73. @success="handlePreview"
  74. ></JobFairEntShare>
  75. </div>
  76. </div>
  77. </v-card>
  78. <PreviewImage v-if="showPreview" :urlList="[previewSrc]" :fileName="enterpriseName" @close="showPreview = !showPreview, showShare = false" />
  79. </template>
  80. <script setup>
  81. defineOptions({ name: 'jobFairJob'})
  82. import { ref } from 'vue'
  83. import { getJobFairPosition, getJobFair } from '@/api/recruit/enterprise/jobFair'
  84. import { dealDictArrayData } from '@/utils/position.js'
  85. import JobItem from './job/item.vue'
  86. import { useRouter, useRoute } from 'vue-router'
  87. import { useI18n } from '@/hooks/web/useI18n'
  88. import Snackbar from '@/plugins/snackbar'
  89. import { getEnterprisePubJobTypePermission } from '@/api/recruit/enterprise/position'
  90. import { getJobAdvertisedList } from '@/api/position'
  91. import { formatName } from '@/utils/getText'
  92. import JobFairEntShare from '@/views/recruit/components/jobFairEntShare'
  93. const router = useRouter()
  94. const route = useRoute()
  95. const { id } = route.params
  96. const { t } = useI18n()
  97. // 职位列表
  98. const jobList = ref([])
  99. const positionItems = ref([])
  100. const positionTotal = ref(0)
  101. const positionLoading = ref(false)
  102. const total = ref(0)
  103. const positionPageInfo = ref({
  104. pageSize: 10,
  105. pageNo: 1,
  106. })
  107. const positionSearch = ref('')
  108. // 分享海报
  109. const entBaseInfo = ref(localStorage.getItem('entBaseInfo') ? JSON.parse(localStorage.getItem('entBaseInfo')) : {})
  110. const showShare = ref(false)
  111. const showPreview = ref(false)
  112. const enterpriseName = ref(formatName(entBaseInfo.value.enterpriseAnotherName || entBaseInfo.value.enterpriseName))
  113. const logoUrl = ref(entBaseInfo.value.logoUrl)
  114. const previewSrc = ref('')
  115. const positionList = ref([])
  116. const bgImg = ref('')
  117. // 职位列表
  118. const getJobList = async () => {
  119. const data = await getJobFairPosition(id)
  120. if (!data || !data.length) return jobList.value = []
  121. jobList.value = dealDictArrayData([], data)
  122. }
  123. const handleAdd = async () => {
  124. const data = await getEnterprisePubJobTypePermission()
  125. if (!data || !data.length) return Snackbar.warning('没有该操作权限,请联系平台管理员升级后再试')
  126. router.push(`/recruit/enterprise/jobFair/details/${id}/edit`)
  127. }
  128. const showDrawer = ref(false)
  129. const handleJoin = async () => {
  130. getPositionList()
  131. showDrawer.value = true
  132. }
  133. const handleChangePage = (index) => {
  134. positionPageInfo.value.pageNo = index
  135. getPositionList()
  136. }
  137. const handleTo = (val) => {
  138. router.push(`/recruit/enterprise/jobFair/details/${id}/edit?id=${val.id}`)
  139. }
  140. // 获取职位列表
  141. const getPositionList = async () => {
  142. positionLoading.value = true
  143. const query = {
  144. ...positionPageInfo.value,
  145. status: 0,
  146. hasExpiredData: false,
  147. hire: false
  148. }
  149. if ( positionSearch.value) {
  150. Object.assign(query, {
  151. name: positionSearch.value,
  152. })
  153. }
  154. try {
  155. const { list, total } = await getJobAdvertisedList(query)
  156. positionTotal.value = total
  157. positionItems.value = list.length ? dealDictArrayData([], list) : []
  158. } finally {
  159. positionLoading.value = false
  160. }
  161. }
  162. getJobList()
  163. const getJob = async () => {
  164. const data = await getJobFair(id)
  165. if (!data) return
  166. bgImg.value = data.contentImg
  167. }
  168. getJob()
  169. // 分享海报预览
  170. const handlePreview = (val) => {
  171. if (!val) return
  172. previewSrc.value = val
  173. showPreview.value = true
  174. }
  175. const handleShare = () => {
  176. positionList.value = jobList.value && jobList.value.length > 0 ? jobList.value.map(e => formatName(e.name)).slice(0, 2) : []
  177. showShare.value = true
  178. }
  179. </script>
  180. <style scoped lang="scss">
  181. .hideCanvasView {
  182. position: fixed;
  183. top: -99999px;
  184. left: -99999px;
  185. z-index: -99999;
  186. }
  187. .resume-box {
  188. padding-top: 120px;
  189. }
  190. .itemBox {
  191. position: relative;
  192. border: 1px solid #e5e6eb;
  193. }
  194. .position-name {
  195. color: var(--color-333);
  196. font-size: 19px;
  197. }
  198. .position {
  199. width: 100%;
  200. position: relative;
  201. .item-select {
  202. position: absolute;
  203. left: -8px;
  204. top: -13px;
  205. }
  206. }
  207. .lines {
  208. display: inline-block;
  209. width: 1px;
  210. height: 17px;
  211. vertical-align: middle;
  212. background-color: #e0e0e0;
  213. margin: 0 10px;
  214. }
  215. .other-info {
  216. font-size: 15px;
  217. color: var(--color-666);
  218. }
  219. .bottom {
  220. position: absolute;
  221. bottom: 0;
  222. left: 0;
  223. width: 100%;
  224. height: 40px;
  225. background-color: #f7f8fa;
  226. font-size: 14px;
  227. color: var(--color-888);
  228. }
  229. .actions:hover {
  230. color: var(--v-primary-base);
  231. }
  232. </style>