positions.vue 8.5 KB

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