index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!-- 检索列表页 - 职位检索 -->
  2. <template>
  3. <div class="default-width">
  4. <div style="width: 100%; height: 20px;"></div>
  5. <v-card style="z-index: 998">
  6. <div class="stickyBox my-3">
  7. <headSearch></headSearch>
  8. </div>
  9. <cityFilter class="mx-5 mb-3" ref="cityFilterRef" @updateCheckedInput="updateRouteQuery"></cityFilter>
  10. <conditionFilter class="mx-5 mb-3" ref="conditionFilterRef" @conditionFilterChange="updateRouteQuery"></conditionFilter>
  11. </v-card>
  12. <div class="d-flex mt-3">
  13. <div class="mr-3" style="min-width: 884px;">
  14. <div v-if="!items?.length" style="text-align: center;">暂无数据</div>
  15. <PositionLongStrip v-else :items="items"></PositionLongStrip>
  16. </div>
  17. <rightRecommend></rightRecommend>
  18. </div>
  19. <CtPagination
  20. v-if="total > 0"
  21. :total="total"
  22. :page="pageInfo.pageNo"
  23. :limit="pageInfo.pageSize"
  24. @handleChange="handleChangePage"
  25. ></CtPagination>
  26. </div>
  27. </template>
  28. <script setup>
  29. import rightRecommend from './components/rightRecommend'
  30. import cityFilter from './components/cityFilter'
  31. import conditionFilter from './components/conditionFilter'
  32. import headSearch from '@/components/headSearch'
  33. import PositionLongStrip from '@/components/PositionLongStrip/item.vue'
  34. import { getJobAdvertisedSearch } from '@/api/position'
  35. import CtPagination from '@/components/CtPagination'
  36. // import { dealDictData } from '@/views/recruit/position/components/dict'
  37. import { ref } from 'vue'
  38. import { useRoute, useRouter } from 'vue-router'
  39. defineOptions({name: 'retrieval-position-page'})
  40. // const route = useRoute()
  41. const route = useRoute(); const router = useRouter()
  42. const cityFilterRef = ref(); const conditionFilterRef = ref()
  43. console.log('to:/recruit/position-> query', route.query)
  44. const pageInfo = { pageNo: 1, pageSize: 20}
  45. const items = ref([])
  46. const total = ref(0)
  47. // 测试数据
  48. const test = {
  49. job: {
  50. id: 1,
  51. pos: "广州",
  52. name: "测试数据",
  53. positionId: 1,
  54. payFrom: 5000,
  55. payTo: 12000,
  56. payUnit: 1,
  57. areaId: 110000,
  58. expType: 0,
  59. eduType: 0,
  60. tagList: [
  61. "无经验要求",
  62. "金融产品",
  63. ]
  64. },
  65. enterprise: {
  66. id: 1,
  67. name: "广州门墩儿科技有限公司",
  68. anotherName: "门墩儿科技",
  69. industryId: 1,
  70. scale: 0,
  71. financingStatus: 0,
  72. logoUrl: "https://img.bosszhipin.com/beijin/mcs/chatphoto/20171009/8b09998594701c82c6d9932c6f5d3ea293cf1c0a52480018916865cbf3ed2c2f.jpg?x-oss-process=image/resize,w_120,limit_0",
  73. tags: [ "培训/辅导机构", "天使轮", "100-499人"],
  74. tags1: [ '就近分配', '室内清洁', '系统接单', '无需坐班', '日常保洁', '简单易上手', '日常保洁', '简单易上手'],
  75. welfareList: ['周末双休', '五险一金', '包餐', '节日福利', '员工旅游', '定期体检', '全勤奖', '带薪年假,年底双薪等福利多多']
  76. },
  77. contact: {
  78. enterpriseId: 1,
  79. userId: 1,
  80. avatar: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F5bbef4cc-6268-46d9-87b3-3aa7d2168aad%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1718339519&t=6ff0d47abd90d209ca81b671e898deb8",
  81. name: "ces女士",
  82. status: 1,
  83. postNameCn: "人事经理",
  84. postNameEn: "uman resources",
  85. postCode: "HR"
  86. }
  87. }
  88. // 测试数据
  89. // 职位搜索
  90. const getPositionList = async () => {
  91. const pageReqVO = {
  92. ...pageInfo,
  93. // content: '', // 搜索内容,示例值(xx科技/xx经理)
  94. // areaIds: [], //工作地区id集合,示例值([])
  95. // expType: 0, // 工作经验(menduner_exp_type),示例值(1)
  96. // eduType: 0, // 学历要求(menduner_education_type),示例值(1)
  97. // payType: 0, // 薪酬待遇范围(menduner_pay_scope),示例值(12)
  98. // jobType: 0, // 求职类型(menduner_job_type),示例值(2)
  99. // positionId: 0, // 职位类型,示例值(2)
  100. // enterpriseType: 0, // 企业类型(menduner_enterprise_type)
  101. // industryIds: [], // 行业信息id集合,示例值([])
  102. // scale: 0, // 人员规模(0-20人,20-99人)示例值(1)
  103. // financingStatus: 0 // 融资阶段(未融资,天使轮,A轮,不需要融资),示例值(1)
  104. }
  105. const res = await getJobAdvertisedSearch(pageReqVO)
  106. // items.value = res.list
  107. // total.value = res.total
  108. // 测试数据
  109. items.value = [test, ...res.list]
  110. total.value = res.total + 1
  111. }
  112. // items.value = [test]
  113. getPositionList()
  114. const handleChangePage = (index) => {
  115. pageInfo.pageNo = index
  116. getPositionList()
  117. }
  118. const removeEmptyStringsAndReturnNew = (obj) => {
  119. const result = {}
  120. Object.keys(obj).forEach(function(key) {
  121. if (obj[key]) {
  122. result[key] = obj[key]
  123. }
  124. })
  125. return result
  126. }
  127. const updateRouteQuery = () => {
  128. const queryObj = { cityFilter: null, conditionFilter: null }
  129. if (cityFilterRef.value?.getQuery) {
  130. queryObj.cityFilter = removeEmptyStringsAndReturnNew(cityFilterRef.value?.getQuery())
  131. }
  132. if (conditionFilterRef.value?.getQuery) {
  133. queryObj.conditionFilter = removeEmptyStringsAndReturnNew(conditionFilterRef.value?.getQuery())
  134. }
  135. let queryArr = []
  136. if (queryObj) {
  137. Object.keys(queryObj)?.forEach(_k => {
  138. const newObj = queryObj[_k]
  139. if (newObj) {
  140. const arr = Object.keys(newObj).map((itemKey, index) => {
  141. return `${index ? '&' : ''}${itemKey}=${newObj[itemKey]}`
  142. })
  143. if (arr?.length) queryArr = [ ...queryArr, ...arr]
  144. }
  145. })
  146. }
  147. const str = queryArr?.join()
  148. if (str) router.push(`${route.path}?${str}`)
  149. }
  150. </script>