|
@@ -48,16 +48,36 @@ const cityFilterRef = ref(); const conditionFilterRef = ref()
|
|
const pageInfo = { pageNo: 1, pageSize: 20}
|
|
const pageInfo = { pageNo: 1, pageSize: 20}
|
|
const items = ref([])
|
|
const items = ref([])
|
|
const total = ref(0)
|
|
const total = ref(0)
|
|
-const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
|
|
-const testQuery = (route?.query && route.query && Object.keys(route?.query).length) ? reactive(route.query) : reactive({})
|
|
|
|
|
|
+// const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
|
|
+let routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? reactive(route.query) : reactive({})
|
|
provide('routeQuery', routeQuery)
|
|
provide('routeQuery', routeQuery)
|
|
|
|
|
|
-let pageReqVO = reactive({
|
|
|
|
- ...pageInfo
|
|
|
|
-})
|
|
|
|
|
|
+// let pageReqVO = reactive({
|
|
|
|
+// ...pageInfo
|
|
|
|
+// })
|
|
|
|
|
|
// 职位搜索
|
|
// 职位搜索
|
|
-const getPositionList = async () => {
|
|
|
|
|
|
+const getData = async () => {
|
|
|
|
+ const pageReqVO = { ...pageInfo }
|
|
|
|
+ // route.query参数
|
|
|
|
+ if (routeQuery && Object.keys(routeQuery).length) {
|
|
|
|
+ Object.keys(routeQuery).forEach(key => {
|
|
|
|
+ if (key === 'city') { // 工作地区id集合,示例值([])
|
|
|
|
+ const city = routeQuery[key]
|
|
|
|
+ const areaIds = []
|
|
|
|
+ const levelCountArr = city.split('__')
|
|
|
|
+ levelCountArr?.forEach(levelIds => {
|
|
|
|
+ const idArr = levelIds.split('_')
|
|
|
|
+ if (idArr?.length) {
|
|
|
|
+ idArr.forEach(idItem => areaIds.push(idItem))
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ pageReqVO.areaIds = areaIds
|
|
|
|
+ }
|
|
|
|
+ else pageReqVO[key] = routeQuery[key].split('_')
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ console.log('pageReqVO', pageReqVO)
|
|
const { list, total: number } = await getJobAdvertisedSearch(pageReqVO)
|
|
const { list, total: number } = await getJobAdvertisedSearch(pageReqVO)
|
|
items.value = list.map(e => {
|
|
items.value = list.map(e => {
|
|
e.job = { ...e.job, ...dealDictObjData({}, e.job) }
|
|
e.job = { ...e.job, ...dealDictObjData({}, e.job) }
|
|
@@ -66,6 +86,7 @@ const getPositionList = async () => {
|
|
})
|
|
})
|
|
total.value = number
|
|
total.value = number
|
|
}
|
|
}
|
|
|
|
+getData()
|
|
|
|
|
|
// const removeEmptyStringsAndReturnNew = (obj) => {
|
|
// const removeEmptyStringsAndReturnNew = (obj) => {
|
|
// const result = {}
|
|
// const result = {}
|
|
@@ -105,18 +126,20 @@ const getPositionList = async () => {
|
|
|
|
|
|
// 刷新路由
|
|
// 刷新路由
|
|
const updateRouter = () => {
|
|
const updateRouter = () => {
|
|
- const str = Object.keys(testQuery).length ? Object.keys(testQuery).reduce((res, _key) => {
|
|
|
|
- res += `${res ? '&' : ''}${_key}=${testQuery[_key]}`
|
|
|
|
|
|
+ const str = Object.keys(routeQuery).length ? Object.keys(routeQuery).reduce((res, _key) => {
|
|
|
|
+ res += `${res ? '&' : ''}${_key}=${routeQuery[_key]}`
|
|
return res
|
|
return res
|
|
}, '') : ''
|
|
}, '') : ''
|
|
- console.log('{route.path}?${str}->str', str)
|
|
|
|
|
|
+ // console.log('route.path', str)
|
|
|
|
+ // const str1 = "city=1__140000__140300__140321_140322_140303&jobType=1_3_0"
|
|
router.push(`${route.path}?${str}`)
|
|
router.push(`${route.path}?${str}`)
|
|
- handleSearchPosition()
|
|
|
|
|
|
+ // router.push(`${route.path}?${str1}`)
|
|
|
|
+ getData()
|
|
}
|
|
}
|
|
|
|
|
|
-const handleMounted = (key, val) => { // val为字符串
|
|
|
|
- testQuery[key] = val
|
|
|
|
- // console.log('testQuery', key, val)
|
|
|
|
|
|
+const handleMounted = (key, val) => { // val为字符串,数组的话用_下划线分隔
|
|
|
|
+ routeQuery[key] = val
|
|
|
|
+ console.log('routeQuery', key, val)
|
|
updateRouter()
|
|
updateRouter()
|
|
//
|
|
//
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -124,34 +147,34 @@ const handleMounted = (key, val) => { // val为字符串
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-// 职位搜索
|
|
|
|
-const handleSearchPosition = () => {
|
|
|
|
- // const conditionParams = conditionFilterRef.value?.params
|
|
|
|
- // const cityParams = cityFilterRef.value?.getQuery
|
|
|
|
- // pageReqVO = { ...pageReqVO, ...conditionParams, ...cityParams, content: pageReqVO.content }
|
|
|
|
- pageReqVO = { ...pageReqVO }
|
|
|
|
- getPositionList()
|
|
|
|
-}
|
|
|
|
|
|
+// // 职位搜索
|
|
|
|
+// const handleSearchPosition = () => {
|
|
|
|
+// // const conditionParams = conditionFilterRef.value?.params
|
|
|
|
+// // const cityParams = cityFilterRef.value?.getQuery
|
|
|
|
+// // pageReqVO = { ...pageReqVO, ...conditionParams, ...cityParams, content: pageReqVO.content }
|
|
|
|
+// pageReqVO = { ...pageReqVO }
|
|
|
|
+// getData()
|
|
|
|
+// }
|
|
|
|
|
|
// 职位类型、关键字
|
|
// 职位类型、关键字
|
|
const dealParams = (val, key) => {
|
|
const dealParams = (val, key) => {
|
|
- pageReqVO[key] = val
|
|
|
|
|
|
+ // pageReqVO[key] = val
|
|
handleMounted(val, key)
|
|
handleMounted(val, key)
|
|
}
|
|
}
|
|
|
|
|
|
-// 刷新后有参数则进行搜索
|
|
|
|
-if (routeQuery) {
|
|
|
|
- for (let i in routeQuery) {
|
|
|
|
- if (routeQuery[i].indexOf('_') !== -1) pageReqVO[i] = routeQuery[i].split('_')
|
|
|
|
- else pageReqVO[i] = routeQuery[i]
|
|
|
|
- }
|
|
|
|
- if (routeQuery.content) handleMounted(routeQuery.content, 'content')
|
|
|
|
- getPositionList()
|
|
|
|
-} else getPositionList()
|
|
|
|
|
|
+// // 刷新后有参数则进行搜索
|
|
|
|
+// if (routeQuery) {
|
|
|
|
+// for (let i in routeQuery) {
|
|
|
|
+// if (routeQuery[i].indexOf('_') !== -1) pageReqVO[i] = routeQuery[i].split('_')
|
|
|
|
+// else pageReqVO[i] = routeQuery[i]
|
|
|
|
+// }
|
|
|
|
+// if (routeQuery.content) handleMounted(routeQuery.content, 'content')
|
|
|
|
+// getData()
|
|
|
|
+// } else getData()
|
|
|
|
|
|
// 分页
|
|
// 分页
|
|
const handleChangePage = (index) => {
|
|
const handleChangePage = (index) => {
|
|
pageInfo.pageNo = index
|
|
pageInfo.pageNo = index
|
|
- getPositionList()
|
|
|
|
|
|
+ getData()
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|