|
@@ -12,10 +12,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="d-flex mt-3">
|
|
|
- <areaType v-if="areaList.length" :list="areaList" @inputChange="val => handleSearch('areaIds', val)"></areaType>
|
|
|
- <expType :isSingle="true" @inputChange="val => handleSearch('expType', val)"></expType>
|
|
|
- <educationType :isSingle="true" @inputChange="val => handleSearch('eduType', val)"></educationType>
|
|
|
- <payScope @input-change="val => handleSearch('payType', val)"></payScope>
|
|
|
+ <conditionFilter v-if="show" ref="conditionFilterRef" :showFilterList="showFilterList" @reset="handleReset" @change="handleQueryChange"></conditionFilter>
|
|
|
<div style="width: 300px;">
|
|
|
<v-text-field
|
|
|
v-model="query.content"
|
|
@@ -79,7 +76,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'recruitment-positions'})
|
|
|
-import { reactive, ref, provide } from 'vue'
|
|
|
+import { reactive, ref } from 'vue'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import { timesTampChange } from '@/utils/date'
|
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
@@ -88,10 +85,7 @@ import { prologue, defaultText } from '@/hooks/web/useIM'
|
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
|
import { getJobAdvertisedPositionCount, getJobAreaByEnterpriseId, getJobAdvertisedSearch } from '@/api/position'
|
|
|
import MPagination from '@/components/CtPagination'
|
|
|
-import expType from '@/views/recruit/personal/position/components/conditionFilter/expType.vue'
|
|
|
-import educationType from '@/views/recruit/personal/position/components/conditionFilter/educationType.vue'
|
|
|
-import payScope from '@/views/recruit/personal/position/components/conditionFilter/payScope.vue'
|
|
|
-import areaType from '@/views/recruit/personal/position/components/conditionFilter/areaType.vue'
|
|
|
+import conditionFilter from '@/views/recruit/personal/position/components/conditionFilter'
|
|
|
|
|
|
const props = defineProps({
|
|
|
info: {
|
|
@@ -107,9 +101,9 @@ const pageInfo = ref({
|
|
|
})
|
|
|
let query = reactive({})
|
|
|
const route = useRoute(); const router = useRouter()
|
|
|
-const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
|
-if (routeQuery?.content) query.content = routeQuery?.content
|
|
|
-provide('routeQuery', routeQuery)
|
|
|
+let routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
|
+if (routeQuery?.content) query.content = routeQuery?.content || ''
|
|
|
+// provide('routeQuery', routeQuery)
|
|
|
if (routeQuery) query = routeQuery
|
|
|
|
|
|
// 职位详情
|
|
@@ -125,12 +119,32 @@ const getDictData = async () => {
|
|
|
}
|
|
|
getDictData()
|
|
|
|
|
|
+const show = ref(false)
|
|
|
+const showFilterList = ref([
|
|
|
+ { key: 'expType', isSingle: false },
|
|
|
+ { key: 'eduType', isSingle: true },
|
|
|
+ { key: 'payType', isSingle: true },
|
|
|
+])
|
|
|
+const getProvideData = (list) => {
|
|
|
+ if (!list?.length) return
|
|
|
+ getDict('menduner_area_type', {}, 'areaList').then(({ data }) => {
|
|
|
+ data = data?.length && data || []
|
|
|
+ const arr = list.map(e => {
|
|
|
+ const obj = data.find(k => k.id === e.key)
|
|
|
+ if (!obj) return
|
|
|
+ return { label: obj.name, value: obj.id }
|
|
|
+ }).filter(Boolean)
|
|
|
+ if (arr?.length) showFilterList.value.unshift({ key: 'areaIds', isSingle: true, provideData: arr})
|
|
|
+ show.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 职位类别&工作地点
|
|
|
const positionCategory = ref([])
|
|
|
-const areaList = ref([])
|
|
|
const getData = async () => {
|
|
|
const data = await getJobAdvertisedPositionCount({ enterpriseId: props.info.enterprise.id })
|
|
|
- areaList.value = await getJobAreaByEnterpriseId({ enterpriseId: props.info.enterprise.id })
|
|
|
+ const areaList = await getJobAreaByEnterpriseId({ enterpriseId: props.info.enterprise.id })
|
|
|
+ getProvideData(areaList)
|
|
|
const list = data.map(val => {
|
|
|
const value = industryList.value.find(e => Number(e.id) === Number(val.key))
|
|
|
if (!value) return
|
|
@@ -148,8 +162,6 @@ const getPoAr = async () => {
|
|
|
}
|
|
|
getPoAr()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 职位类别选中
|
|
|
const handleClickCategory = (k) => {
|
|
|
positionCategory.value.map(e => e.active = false)
|
|
@@ -169,9 +181,11 @@ const dealRouteQuery = () => {
|
|
|
if (str) router.replace(`${route.path}?${str}`)
|
|
|
}
|
|
|
|
|
|
-const handleSearch = (key, { values }) => {
|
|
|
- if (values === -1 || !values || values[0] === -1 || !values.length) delete query[key]
|
|
|
- else query[key] = values
|
|
|
+const handleSearch = (key, { values = [] }) => {
|
|
|
+ if (key) {
|
|
|
+ if (values === -1 || !values || values[0] === -1 || !values.length) delete query[key]
|
|
|
+ else query[key] = values
|
|
|
+ }
|
|
|
dealRouteQuery()
|
|
|
getPositionList(true)
|
|
|
}
|
|
@@ -202,6 +216,22 @@ const handleChangePage = (index) => {
|
|
|
getPositionList()
|
|
|
}
|
|
|
|
|
|
+// 参数改变
|
|
|
+const handleQueryChange = (key, val) => { // val为字符串,数组的话用_下划线分隔
|
|
|
+ pageInfo.value.pageNo = 1
|
|
|
+ const values = val ? val.split('_') : []
|
|
|
+ handleSearch(key, { values })
|
|
|
+}
|
|
|
+
|
|
|
+// 清空筛选条件
|
|
|
+const handleReset = async () => {
|
|
|
+ pageInfo.value.pageNo = 1
|
|
|
+ showFilterList.value.forEach(e => {
|
|
|
+ delete query[e.key]
|
|
|
+ })
|
|
|
+ handleSearch(null, {})
|
|
|
+}
|
|
|
+
|
|
|
// 城市、学历、工作经验
|
|
|
const desc = [
|
|
|
{ mdi: 'mdi-map-marker-outline', value: 'areaName' },
|