|
@@ -6,8 +6,8 @@
|
|
|
<div class="stickyBox my-3">
|
|
|
<headSearch></headSearch>
|
|
|
</div>
|
|
|
- <cityFilter class="mx-5 mb-3" @updateCheckedInput="checkedInputChange"></cityFilter>
|
|
|
- <conditionFilter class="mx-5 mb-3"></conditionFilter>
|
|
|
+ <cityFilter class="mx-5 mb-3" ref="cityFilterRef" @updateCheckedInput="updateRouteQuery"></cityFilter>
|
|
|
+ <conditionFilter class="mx-5 mb-3" ref="conditionFilterRef" @conditionFilterChange="updateRouteQuery"></conditionFilter>
|
|
|
</v-card>
|
|
|
<div class="d-flex mt-3">
|
|
|
<div class="mr-3" style="min-width: 884px;">
|
|
@@ -40,6 +40,7 @@ import { useRoute, useRouter } from 'vue-router'
|
|
|
defineOptions({name: 'retrieval-position-page'})
|
|
|
// const route = useRoute()
|
|
|
const route = useRoute(); const router = useRouter()
|
|
|
+const cityFilterRef = ref(); const conditionFilterRef = ref()
|
|
|
console.log('to:/recruit/position-> query', route.query)
|
|
|
|
|
|
const pageInfo = { pageNo: 1, pageSize: 20}
|
|
@@ -120,14 +121,38 @@ const handleChangePage = (index) => {
|
|
|
getPositionList()
|
|
|
}
|
|
|
|
|
|
-const checkedInputChange = (idChecked) => {
|
|
|
- console.log('str11111111111', idChecked)
|
|
|
-
|
|
|
- let str = ref('')
|
|
|
- idChecked.forEach((_e, index) => {
|
|
|
- if (_e?.length) str.value += `${index ? '&' : '' }level${index+1}=${_e.join('_')}`
|
|
|
+const removeEmptyStringsAndReturnNew = (obj) => {
|
|
|
+ const result = {}
|
|
|
+ Object.keys(obj).forEach(function(key) {
|
|
|
+ if (obj[key]) {
|
|
|
+ result[key] = obj[key]
|
|
|
+ }
|
|
|
})
|
|
|
- if (str.value) router.push(`${route.path}?${str.value}`)
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+const updateRouteQuery = () => {
|
|
|
+ const queryObj = { cityFilter: null, conditionFilter: null }
|
|
|
+ if (cityFilterRef.value?.getQuery) {
|
|
|
+ queryObj.cityFilter = removeEmptyStringsAndReturnNew(cityFilterRef.value?.getQuery())
|
|
|
+ }
|
|
|
+ if (conditionFilterRef.value?.getQuery) {
|
|
|
+ queryObj.conditionFilter = removeEmptyStringsAndReturnNew(conditionFilterRef.value?.getQuery())
|
|
|
+ }
|
|
|
+ let queryArr = []
|
|
|
+ if (queryObj) {
|
|
|
+ Object.keys(queryObj)?.forEach(_k => {
|
|
|
+ const newObj = queryObj[_k]
|
|
|
+ if (newObj) {
|
|
|
+ const arr = Object.keys(newObj).map((itemKey, index) => {
|
|
|
+ return `${index ? '&' : ''}${itemKey}=${newObj[itemKey]}`
|
|
|
+ })
|
|
|
+ if (arr?.length) queryArr = [ ...queryArr, ...arr]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const str = queryArr?.join()
|
|
|
+ if (str) router.push(`${route.path}?${str}`)
|
|
|
}
|
|
|
|
|
|
</script>
|