details.vue 8.4 KB

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