Quellcode durchsuchen

职位发布:工作经验、学历要求可选不限

Xiao_123 vor 4 Monaten
Ursprung
Commit
5b3c7bf7af

+ 2 - 3
src/components/Position/item.vue

@@ -13,14 +13,13 @@
             </div>
           </div>
           <div class="d-flex justify-space-between align-center">
-            <div>
-              <span v-for="(j, i) in desc" :key="i" class="font-size-13" style="color: #808080;">
+            <div class="text-truncate" style="width: 190px; color: #808080;">
+              <span v-for="(j, i) in desc" :key="i" class="font-size-13" style="">
                 <span
                   v-if="item[j.value] || j.value === 'areaName'"
                   class="mr-1 d-inline-block"
                 >
                 {{ j.value === 'areaName' ? !item.areaId ? '全国' : item.area?.str : item[j.value] }}
-                  <!-- {{ (j.value === 'areaName' && !item.areaId) ? '全国' :  item[j.value] }} -->
                 </span>
                 <span
                   v-if="i !== desc.length - 1 && (item[j.value] || (j.value === 'areaName' && !item.areaId)) && item[desc[i + 1].value]"

+ 1 - 1
src/config/axios/service.js

@@ -69,7 +69,7 @@ service.interceptors.request.use(
     let isToken = (config.headers || {}).isToken === false
     // token类型
     const tokenIndex = config.tokenIndex ? config.tokenIndex : getIsEnterprise() ? 1 : 2
-    // console.log('令牌类型', tokenIndex === 1 ? '企业:' : '个人:', getToken(tokenIndex))
+    console.log('令牌类型', tokenIndex === 1 ? '企业:' : '个人:', getToken(tokenIndex))
     whiteList.some((v) => {
       if (config.url) {
         config.url.indexOf(v) > -1

+ 1 - 1
src/permission.js

@@ -15,13 +15,13 @@ const { start, done } = useNProgress()
 //            3.personalCommon: 无需登录也能访问的页面
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
+  localStorage.setItem('routerTest', to.path) // 本地环境保存代码热更新会导致路径缺失问题
   // 获取商城装修模版
   const mallStore = useMallStore()
   if (!localStorage.getItem('mallTemplate')) {
     await mallStore.getMallDiyTemplate()
   }
   
-  localStorage.setItem('routerTest', to.path) // 本地环境保存代码热更新会导致路径缺失问题
   const tokenIndex = getIsEnterprise() ? 1: 2
   start()
   // loadStart()

+ 1 - 1
src/utils/auth.js

@@ -12,7 +12,7 @@ export const isEnterprise = () => {
   const testUsePath = localStorage.getItem('routerTest')
   if (currentRoute?.path === '/' && (testUsePath?.includes(substr) || testUsePath?.includes('/enterpriseVerification'))) bool = true
   // console.log('currentRoute', currentRoute.path)
-  // console.log('isEnterpriseBool', bool, currentRoute.path)
+  console.log('=========================', bool, currentRoute.path, testUsePath)
   return bool
 }
 

+ 4 - 2
src/utils/position.js

@@ -47,7 +47,8 @@ export const dealDictArrayData = (res, list) => {
       const valueKey = data.nameKey ? data.nameKey : 'label'
       const idKey = data.valueKey ? data.valueKey : 'value'
       if (!dictObj[data.value] || !Object.keys(dictObj[data.value]).length) return
-      const result = dictObj[data.value].find(val => val[idKey] === item[e])
+      // 工作经验、学历为null则是不限
+      const result = ['expType', 'eduType'].includes(e) && !item[e] ? { label: `${e === 'expType' ? '工作经验' : '学历' }不限` } : dictObj[data.value].find(val => val[idKey] === item[e])
       if (!result) return
       item[data.label] = result[valueKey] || ''
     })
@@ -63,7 +64,8 @@ export const dealDictObjData = (res, obj) => {
     if (!data) return
     const valueKey = data.nameKey ? data.nameKey : 'label'
     const idKey = data.valueKey ? data.valueKey : 'value'
-    const result = dictObj[data.value]?.find(val => val[idKey] === obj[e])
+    // 工作经验、学历为null则是不限
+    const result = ['expType', 'eduType'].includes(e) && !obj[e] ? { label: `${e === 'expType' ? '工作经验' : '学历' }不限` } : dictObj[data.value]?.find(val => val[idKey] === obj[e])
     if (!result) return
     res[data.label] = result[valueKey]
     res = { ...obj, ...res }

+ 3 - 3
src/views/recruit/enterprise/hirePosition/components/jobRequirements.vue

@@ -260,7 +260,7 @@ const getDictData = async () => {
   items.value.options.forEach(async (e) => {
     if (e.dictTypeName) {
       const { data } = await getDict(e.dictTypeName)
-      e.items = data
+      e.items = ['eduType', 'expType'].indexOf(e.key) !== -1 ? [{ label: '不限', value: -1 }, ...data] : data
     }
   })
 }
@@ -282,7 +282,7 @@ const getQuery = async () => {
     if (e.noParam) return
     if (e.key === 'tagList') {
       obj[e.key] = tag.value.length ? tag.value : []
-    }
+    } else if (['areaId', 'eduType', 'expType'].includes(e.key) && e.value === -1) obj[e.key] = null
     else obj[e.key] = e.value
   })
   if (obj.areaId === -1) obj.areaId = null
@@ -303,7 +303,7 @@ watch(
       if (e.key === 'tagList' && val[e.key] && val[e.key].length) {
         tag.value = val[e.key] && val[e.key].length ? val[e.key] : []
       }
-      if (e.key === 'areaId' && !val[e.key]) e.value = -1
+      if (['areaId', 'eduType', 'expType'].includes(e.key) && !val[e.key]) e.value = -1
       if (!val.payFrom && !val.payTo) {
         salary.value = true
         handleChangeSalary(salary.value)

+ 3 - 4
src/views/recruit/enterprise/positionManagement/components/jobRequirements.vue

@@ -259,7 +259,7 @@ const getDictData = async () => {
   items.value.options.forEach(async (e) => {
     if (e.dictTypeName) {
       const { data } = await getDict(e.dictTypeName)
-      e.items = data
+      e.items = ['eduType', 'expType'].indexOf(e.key) !== -1 ? [{ label: '不限', value: -1 }, ...data] : data
     }
   })
 }
@@ -281,10 +281,9 @@ const getQuery = async () => {
     if (e.noParam) return
     if (e.key === 'tagList') {
       obj[e.key] = tag.value.length ? tag.value : []
-    }
+    } else if (['areaId', 'eduType', 'expType'].includes(e.key) && e.value === -1) obj[e.key] = null
     else obj[e.key] = e.value
   })
-  if (obj.areaId === -1) obj.areaId = null
   query = Object.assign(query, obj)
   return query
 }
@@ -302,7 +301,7 @@ watch(
       if (e.key === 'tagList' && val[e.key] && val[e.key].length) {
         tag.value = val[e.key] && val[e.key].length ? val[e.key] : []
       }
-      if (e.key === 'areaId' && !val[e.key]) e.value = -1
+      if (['areaId', 'eduType', 'expType'].includes(e.key) && !val[e.key]) e.value = -1
       if (!val.payFrom && !val.payTo) {
         salary.value = true
         handleChangeSalary(salary.value)

+ 7 - 3
src/views/recruit/personal/companyDetail/components/positions.vue

@@ -206,14 +206,18 @@ const handleSearch = (key, { values = [] }) => {
 const list = ref([])
 // 职位列表
 const getPositionList = async (isSearch) => {
-  query = {
+  const queryParams = {
     ...query,
     ...pageInfo.value,
     enterpriseId: props.info.enterprise.id
   }
-  delete query.key
+  delete queryParams.key
+  for (const key in queryParams) {
+    if (['expType', 'eduType'].includes(key) && queryParams[key] === '9999') delete queryParams[key]
+  }
+
   if (isSearch) query.pageNo = 1
-  const { list: arr, total: number } = await getJobAdvertisedSearch(query)
+  const { list: arr, total: number } = await getJobAdvertisedSearch(queryParams)
   total.value = number
   list.value = arr.map(e => {
     e.active = false

+ 1 - 2
src/views/recruit/personal/position/components/conditionFilter.vue

@@ -11,6 +11,7 @@
           :isSlot="item.isSlot"
           :itemKey="item.itemKey"
           :itemText="item.itemText"
+          :dictData="item.toFilterDictDataList"
           :displayDictName="item.displayDictName"
           :displayApiType="item.displayApiType"
           :provideData="item.provideData || []"
@@ -95,8 +96,6 @@ const assembleList = async ({ key, idsStr }) => {
 watch(
   () => route.query, 
   (newVal = {}, oldVal = {}) => {
-    // console.log('1oldVal', oldVal)
-    // console.log('2newVal', newVal)
     const newKeyList = Object.keys(newVal).length ? [...Object.keys(newVal)] : null
 
     // 回显已选筛选-标签

+ 20 - 11
src/views/recruit/personal/position/components/conditionFilter/commonPath.vue

@@ -9,12 +9,12 @@
     <v-list v-else>
       <v-list-item
         v-for="item in items" :key="item.id" :value="item[itemKey]"
-        :active="selectIdArr.includes(item[itemKey])"
+        :active="selectIdArr.includes(Number(item[itemKey]))"
         color="primary"
         @click="handle(item, item[itemKey])"
       >
-        <template v-if="selectIdArr.includes(item[itemKey])" v-slot:append>
-          <v-icon icon="mdi-check"></v-icon>
+        <template v-if="selectIdArr.includes(Number(item[itemKey]))" v-slot:append>
+          <v-icon color="primary" icon="mdi-check"></v-icon>
         </template>
         <v-list-item-title>{{ item[itemText] }}</v-list-item-title>
       </v-list-item>
@@ -72,6 +72,10 @@ const props = defineProps({
     type: String,
     default: '类型名称'
   },
+  dictData: {
+    type: Array,
+    default: () => []
+  }
 })
 
 const btnTitle = computed(() => {
@@ -83,17 +87,19 @@ let items = ref()
 const selectIdArr = ref([])
 
 const handle = (item, value) => {
-  // const value = item[props.itemKey]
   if (props.isSlot) {
     selectIdArr.value = value
   } else {
     if (selectIdArr.value.includes(value)) {
       selectIdArr.value = selectIdArr.value.filter(i => i !== value)
     } else {
-      // if (props.idName === 'expType') selectIdArr.value = value === '2' ? [value] : (selectIdArr.value.push(value) && selectIdArr.value.filter(i => i !== '2')) // 选中经验不限时清空其它选中项,选中其他的咬去掉经验不限
-      //
-      if (props.isSingle) selectIdArr.value = [value] // 单选
-      else selectIdArr.value.push(value)
+      // 选中经验不限时清空其它选中项,选中其他的咬去掉经验不限
+      if (!props.isSingle && ['expType', 'eduType'].includes(props.idName)) {
+        selectIdArr.value = value === '9999' ? [value] : (selectIdArr.value.push(value) && selectIdArr.value.filter(i => i.toString() !== '9999'))
+      } else {
+        if (props.isSingle) selectIdArr.value = [value] // 单选
+        else selectIdArr.value.push(value)
+      }
     }
   }
   emits('inputChange', {
@@ -112,13 +118,16 @@ else if (props.provideData?.length) { // 自定义下拉数据
   items.value = props.provideData
   show.value = true
 }
-else if (props.displayDictName) {
+else if ((!props.dictData || !props.dictData.length) && props.displayDictName) {
   getDict(props.displayDictName, props.displayParams, props.displayApiType || 'dict').then(({ data }) => {
     data = data?.length && data || []
-    items.value = data
+    items.value = ['expType', 'eduType'].includes(props.idName) ? [{ label: '不限', value: '9999', id: 9999 }, ...data] : data
     show.value = true
   })
-} else console.log('error->字典参数未传递!!')
+} else {
+  items.value = props.dictData || []
+  show.value = true
+}
 
 
 watch(

+ 2 - 11
src/views/recruit/personal/position/components/dict.js

@@ -82,16 +82,7 @@ const dictList = [
     title: '公司规模',
     path: commonPath,
     toFilterDictDataList: []
-  },
-  // {
-  //   displayDictName: 'menduner_financing_status',
-  //   key: 'financingStatus',
-  //   itemKey: 'value',
-  //   itemText: 'label',
-  //   title: '融资情况',
-  //   path: commonPath,
-  //   toFilterDictDataList: []
-  // }
+  }
 ]
 export const filterList = dictList
 
@@ -101,7 +92,7 @@ const getDictList = async () => {
     const toFilterDictName = dictListItem.toFilterDictName || dictListItem.displayDictName
     if (!toFilterDictName) return
     const { data } = await getDict(toFilterDictName, dictListItem.params, dictListItem.toFilterApiType)
-    dictListItem.toFilterDictDataList = data
+    dictListItem.toFilterDictDataList = ['eduType', 'expType'].includes(dictListItem.key) ? [{ label: '不限', value: '9999', id: 9999 }, ...data] : data
   })
 }
 

+ 1 - 1
src/views/recruit/personal/position/index.vue

@@ -79,7 +79,7 @@ const getData = async () => {
         else routerParams[key] = routeQuery[key]
       }
       else if (passingOneId.includes(key)) routerParams[key] = +routeQuery[key] // 传给后端单选且传递整型
-      else routerParams[key] = routeQuery[key].split('_') // 传给后端Arr
+      else routerParams[key] = routeQuery[key].split('_').filter(e => e !== '9999') // 传给后端Arr
     })
   }
   // 没有筛选条件不请求数据