positions.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <!-- 在招职位 -->
  2. <template>
  3. <div class="top">
  4. <div class="d-flex">
  5. <div class="font-weight-bold position-category-left">职位类别:</div>
  6. <div class="position-category-right">
  7. <span
  8. :class="['category-item', {'default-active': k.active}, {'font-weight-bold': k.active}]"
  9. v-for="k in positionCategory"
  10. :key="k.id"
  11. @click="handleClickCategory(k)"
  12. >{{ k.id === -1 ? `${k.label}` : `${k.label} (${k.number})` }}</span>
  13. </div>
  14. </div>
  15. <div class="d-flex mt-3">
  16. <areaType v-if="areaList.length" :list="areaList" @inputChange="val => handleSearch('areaIds', val)"></areaType>
  17. <expType :isSingle="true" @inputChange="val => handleSearch('expType', val)"></expType>
  18. <educationType :isSingle="true" @inputChange="val => handleSearch('eduType', val)"></educationType>
  19. <payScope @input-change="val => handleSearch('payType', val)"></payScope>
  20. <div style="width: 300px;">
  21. <v-text-field
  22. v-model="query.content"
  23. variant="outlined"
  24. label="查找职位关键字"
  25. hide-details
  26. color="primary"
  27. append-inner-icon="mdi-magnify"
  28. @click:append-inner="handleSearch('content', { values: query.content })"
  29. @keyup.enter="handleSearch('content', { values: query.content })"
  30. >
  31. </v-text-field>
  32. </div>
  33. </div>
  34. </div>
  35. <v-divider class="mt-5"></v-divider>
  36. <div class="bottom mt-4">
  37. <div v-if="list.length">
  38. <div
  39. v-for="(val, i) in list"
  40. :key="i"
  41. :class="['bottom-item', {'border-bottom-dashed': i !== list.length -1}, 'd-flex', 'justify-space-between', 'cursor-pointer']"
  42. @mouseenter="val.active = true"
  43. @mouseleave="val.active = false"
  44. @click="handlePosition(val)"
  45. >
  46. <div>
  47. <p v-if="val.job.name.includes('style')" :class="['name', {'default-active': val.active }]" v-html="val.job.name"></p>
  48. <p v-else :class="['name', {'default-active': val.active }]">{{ val.job.name }}</p>
  49. <div style="line-height: 40px;">
  50. <span v-for="k in desc" :key="k.mdi" class="mr-5">
  51. <v-icon color="var(--color-666)" size="15">{{ k.mdi }}</v-icon>
  52. <span class="ml-1 tag-text">{{ val.job[k.value] }}</span>
  53. </span>
  54. </div>
  55. </div>
  56. <div v-if="!val.active" class="text-right">
  57. <p class="salary">{{ val.job.payFrom ? val.job.payFrom + '-' : '' }}{{ val.job.payTo }}{{ val.job.payName ? '/' + val.job.payName : '' }}</p>
  58. <div class="update-time">{{ timesTampChange(val.job.updateTime) }} 刷新</div>
  59. </div>
  60. <div v-else class="account-info">
  61. <v-avatar :image="val.contact.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></v-avatar>
  62. <span class="account-label">{{ val.contact.name }} · {{ val.contact.postNameCn }}</span>
  63. <span>
  64. <v-btn class="half-button" color="primary" size="small">立即沟通</v-btn>
  65. </span>
  66. </div>
  67. </div>
  68. <MPagination
  69. :total="total"
  70. :page="pageInfo.pageNo"
  71. :limit="pageInfo.pageSize"
  72. @handleChange="handleChangePage"
  73. ></MPagination>
  74. </div>
  75. <Empty v-else :elevation="false"></Empty>
  76. </div>
  77. </template>
  78. <script setup>
  79. defineOptions({name: 'enterprise-enterpriseCenter-positions'})
  80. import { reactive, ref, provide } from 'vue'
  81. import { useRoute, useRouter } from 'vue-router'
  82. import { timesTampChange } from '@/utils/date'
  83. import { getDict } from '@/hooks/web/useDictionaries'
  84. import { dealDictObjData } from '@/utils/position'
  85. import { getJobAdvertisedPositionCount, getJobAreaByEnterpriseId, getJobAdvertisedSearch } from '@/api/position'
  86. import MPagination from '@/components/CtPagination'
  87. import expType from '@/views/recruit/personal/position/components/conditionFilter/expType.vue'
  88. import educationType from '@/views/recruit/personal/position/components/conditionFilter/educationType.vue'
  89. import payScope from '@/views/recruit/personal/position/components/conditionFilter/payScope.vue'
  90. import areaType from '@/views/recruit/personal/position/components/conditionFilter/areaType.vue'
  91. const props = defineProps({
  92. info: {
  93. type: Object,
  94. default: () => {}
  95. }
  96. })
  97. const total = ref(0)
  98. const pageInfo = ref({
  99. pageSize: 10,
  100. pageNo: 1
  101. })
  102. let query = reactive({})
  103. const route = useRoute(); const router = useRouter()
  104. const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
  105. if (routeQuery?.content) query.content = routeQuery?.content
  106. provide('routeQuery', routeQuery)
  107. if (routeQuery) query = routeQuery
  108. // 职位详情
  109. const handlePosition = (val) => {
  110. window.open(`/recruit/personal/position/details/${val.job.positionId}`)
  111. }
  112. // 行业列表
  113. const industryList = ref([])
  114. const getDictData = async () => {
  115. const { data } = await getDict('menduner_industry_type', {}, 'industryList')
  116. industryList.value = data
  117. }
  118. getDictData()
  119. // 职位类别&工作地点
  120. const positionCategory = ref([])
  121. const areaList = ref([])
  122. const getData = async () => {
  123. const data = await getJobAdvertisedPositionCount({ enterpriseId: props.info.enterprise.id })
  124. areaList.value = await getJobAreaByEnterpriseId({ enterpriseId: props.info.enterprise.id })
  125. const list = data.map(val => {
  126. const value = industryList.value.find(e => Number(e.id) === Number(val.key))
  127. return { id: value.id, label: value.nameCn, number: val.value, active: false }
  128. })
  129. positionCategory.value = [{ id: -1, label: '全部', active: true }, ...list]
  130. }
  131. const getPoAr = async () => {
  132. await getData()
  133. // 职位类别回显
  134. if (routeQuery?.positionId) {
  135. positionCategory.value.map(e => e.active = false)
  136. positionCategory.value.find(e => e.id === routeQuery.positionId).active = true
  137. }
  138. }
  139. getPoAr()
  140. // 职位类别选中
  141. const handleClickCategory = (k) => {
  142. positionCategory.value.map(e => e.active = false)
  143. k.active = !k.active
  144. handleSearch('positionId', { values: k.id })
  145. }
  146. const dealRouteQuery = () => {
  147. const arr = Object.keys(query).map(e => {
  148. if (Array.isArray(query[e]) && !query[e].length) {
  149. delete query[e]
  150. }
  151. if (!query[e]) delete query[e]
  152. if (e !== 'pageSize' && e !== 'pageNo' && e !== 'enterpriseId') return `${e}=${query[e]}`
  153. }).filter(Boolean)
  154. const str = ['key=recruitmentPositions', ...arr].join('&')
  155. if (str) router.replace(`${route.path}?${str}`)
  156. }
  157. const handleSearch = (key, { values }) => {
  158. if (values === -1 || !values || values[0] === -1 || !values.length) delete query[key]
  159. else query[key] = values
  160. dealRouteQuery()
  161. getPositionList(true)
  162. }
  163. // 职位列表
  164. const list = ref([])
  165. // 职位列表
  166. const getPositionList = async (isSearch) => {
  167. query = {
  168. ...query,
  169. ...pageInfo.value,
  170. enterpriseId: props.info.enterprise.id
  171. }
  172. delete query.key
  173. if (isSearch) query.pageNo = 1
  174. const { list: arr, total: number } = await getJobAdvertisedSearch(query)
  175. total.value = number
  176. list.value = arr.map(e => {
  177. e.active = false
  178. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  179. return e
  180. })
  181. }
  182. getPositionList()
  183. const handleChangePage = (index) => {
  184. pageInfo.value.pageNo = index
  185. getPositionList()
  186. }
  187. // 城市、学历、工作经验
  188. const desc = [
  189. { mdi: 'mdi-map-marker-outline', value: 'areaName' },
  190. { mdi: 'mdi-school-outline', value: 'eduName' },
  191. { mdi: 'mdi-clock-time-ten-outline', value: 'expName' }
  192. ]
  193. </script>
  194. <style scoped lang="scss">
  195. .bottom-item {
  196. width: 100%;
  197. height: 68px;
  198. margin-bottom: 12px;
  199. }
  200. .name {
  201. position: relative;
  202. max-width: 200px;
  203. margin-right: 8px;
  204. overflow: hidden;
  205. text-overflow: ellipsis;
  206. white-space: nowrap;
  207. font-weight: 600;
  208. }
  209. .salary {
  210. font-size: 16px;
  211. font-weight: 700;
  212. color: var(--v-error-base);
  213. line-height: 22px;
  214. flex: none;
  215. }
  216. .tag-text {
  217. color: var(--color-222);
  218. font-size: 14px;
  219. }
  220. .update-time {
  221. color: var(--color-666);
  222. font-size: 14px;
  223. line-height: 40px;
  224. }
  225. .account-info {
  226. line-height: 52px;
  227. .account-label {
  228. color: var(--color-666);
  229. font-size: 14px;
  230. font-weight: 600;
  231. margin: 0 10px;
  232. }
  233. }
  234. .position-category-left {
  235. width: 80px;
  236. }
  237. .position-category-right {
  238. flex: 1;
  239. }
  240. .category-item {
  241. display: inline-block;
  242. margin-right: 20px;
  243. font-size: 15px;
  244. color: var(--color-666);
  245. cursor: pointer;
  246. &:hover {
  247. color: var(--v-primary-base);
  248. }
  249. }
  250. :deep(.v-field__input) {
  251. height: 28px;
  252. padding: 0 0 0 10px;
  253. font-size: 12px;
  254. min-height: 28px;
  255. }
  256. </style>