Xiao_123 1 gadu atpakaļ
vecāks
revīzija
887e23ac90

+ 58 - 34
src/components/Enterprise/components/positions.vue

@@ -8,19 +8,25 @@
           v-for="k in positionCategory" 
           :key="k.id"
           @click="handleClickCategory(k)"
-        >{{ k.id === '-1' ? `${k.label}` : `${k.label} (${k.number})` }}</span>
+        >{{ k.id === -1 ? `${k.label}` : `${k.label} (${k.number})` }}</span>
       </div>
     </div>
     <div class="d-flex mt-3">
-      <areaType v-if="areaList.length" :list="areaList"></areaType>
-      <expType></expType>
+      <areaType v-if="areaList.length" :list="areaList" @inputChange="val => handleSearch('areaIds', val)"></areaType>
+      <expType :isSingle="true" @inputChange="val => handleSearch('expType', val)"></expType>
       <educationType></educationType>
       <payScope></payScope>
-      <div style="width: 200px;">
-        <v-text-field  variant="outlined" placeholder="请输入职位名称" hide-details>
-          <template #append-inner>
-            <v-btn color="primary" size="x-small" @click="getPositionList">搜索</v-btn>
-          </template>
+      <div style="width: 300px;">
+        <v-text-field
+          v-model="query.content"
+          variant="outlined" 
+          label="查找职位中的关键字"
+          hide-details
+          color="primary"
+          append-inner-icon="mdi-magnify"
+          @click:append-inner="handleSearch(query.content, 'content')"
+          @keyup.enter="handleSearch(query.content, 'content')"
+        >
         </v-text-field>
       </div>
     </div>
@@ -58,8 +64,8 @@
     </div>
     <MPagination
       :total="total"
-      :page="pageInfo.current"
-      :limit="pageInfo.size"
+      :page="pageInfo.pageNo"
+      :limit="pageInfo.pageSize"
       @handleChange="handleChangePage"
     ></MPagination>
   </div>
@@ -67,7 +73,8 @@
 
 <script setup>
 defineOptions({ name: 'recruitment-positions'})
-import { ref } from 'vue'
+import { reactive, ref, provide } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
 import { timesTampChange } from '@/utils/date'
 import { getDict } from '@/hooks/web/useDictionaries'
 import { dealDictData } from '@/views/recruit/position/components/dict'
@@ -87,10 +94,14 @@ const props = defineProps({
 
 const total = ref(0)
 const pageInfo = ref({
-  size: 10,
-  current: 1
+  pageSize: 10,
+  pageNo: 1
 })
+const route = useRoute(); const router = useRouter()
+const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
+provide('routeQuery', routeQuery)
 
+// 职位详情
 const handlePosition = (val) => {
   window.open(`/recruit/position/details/${val.job.positionId}`)
 }
@@ -113,7 +124,7 @@ const getData = async () => {
     const value = industryList.value.find(e => Number(e.id) === Number(val.key))
     return { id: value.id, label: value.nameCn, number: val.value, active: false }
   })
-  positionCategory.value = [{ id: '-1', label: '全部', active: true }, ...list]
+  positionCategory.value = [{ id: -1, label: '全部', active: true }, ...list]
 }
 getData()
 
@@ -121,37 +132,50 @@ getData()
 const handleClickCategory = (k) => {
   positionCategory.value.map(e => e.active = false)
   k.active = !k.active
+  handleSearch(k.id, 'positionId')
+}
+
+const dealRouteQuery = () => {
+  const arr = Object.keys(query).map((e, i) => {
+    return `${i ? '&' : ''}${e}=${query[e]}`
+  })
+  const str = arr.join()
+  if (str) router.push(`${route.path}?${str}`)
+}
+
+const handleSearch = (key, { values }) => {
+  console.log(values, key, 'handle-search')
+  if (values === -1 || !values || values[0] === -1) delete query[key]
+  else query[key] = values
+  dealRouteQuery()
+  query.pageNo = 1
+  // getPositionList()
 }
 
 // 职位列表
 const list = ref([])
+const query = reactive({
+  // content: '',
+  // areaIds: [],
+  // expType: 0,
+  // eduType: 0,
+  // payType: 0,
+  // positionId: 0,
+})
+// 职位列表
 const getPositionList = async () => {
-  const pageReqVO = {
-    ...pageInfo.value,
-    // content: '',
-    // areaIds: [],
-    // expType: 0,
-    // eduType: 0,
-    // payType: 0,
-    // jobType: 0,
-    // positionId: 0,
-    // enterpriseType: 0,
-    // industryIds: [],
-    // scale: 0,
-    // financingStatus: 0,
-    enterpriseId: props.info.enterprise.id
-  }
-  const { list: arr, total: number } = await getJobAdvertisedSearch({ ...pageReqVO })
+  const { list: arr, total: number } = await getJobAdvertisedSearch(Object.assign(query, pageInfo.value, { enterpriseId: props.info.enterprise.id }))
   total.value = number
   list.value = arr.map(e => {
+    e.active = false
     e.job = { ...e.job, ...dealDictData({}, e.job) }
     return e
   })
 }
-getPositionList()
+// getPositionList()
 
 const handleChangePage = (index) => {
-  pageInfo.value.current = index
+  pageInfo.value.pageNo = index
   getPositionList()
 }
 
@@ -210,10 +234,10 @@ const desc = [
   flex: 1;
 }
 .category-item {
+  display: inline-block;
   margin-right: 20px;
   font-size: 15px;
-  color: #888;
-  font-weight: 600;
+  color: #666;
   cursor: pointer;
   &:hover {
     color: var(--v-primary-base);

+ 2 - 2
src/components/jobTypeCard/index.vue

@@ -59,7 +59,7 @@
 </template>
 
 <script setup>
-// import { getPositionTreeClick } from '@/api/common/index'
+import { getPositionTreeClick } from '@/api/common/index'
 import { getDict } from '@/hooks/web/useDictionaries'
 import { reactive, ref, defineEmits } from 'vue';
 import { useRoute, useRouter } from 'vue-router'
@@ -82,11 +82,11 @@ const isPage = props.page
 
 // 职位点击
 const handleJobClick = async (val) => {
+  await getPositionTreeClick({ id: val.id })
   if (props.isCustomer) return emits('handleJobClick', val)
   const path = '/recruit/position'
   if (path === route.path) emits('jobClick', val)
   else router.push({ path, query: { ...val, jumpType: 1 } })
-  // await getPositionTreeClick({ id: val.id })
 }
 
 // 翻页数据

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

@@ -3,7 +3,7 @@
     <companyIndustry @inputChange="val => inputChange('industryIds', val)"></companyIndustry>
     <positionType @inputChange="val => inputChange('positionId', val)"></positionType>
     <JobType @inputChange="val => inputChange('jobType', val)"></JobType>
-    <expType @inputChange="val => inputChange('expType', val)"></expType>
+    <expType :isSingle="false" @inputChange="val => inputChange('expType', val)"></expType>
     <payScope @inputChange="val => inputChange('payScope', val)"></payScope>
     <educationType @inputChange="val => inputChange('educationType', val)"></educationType>
     <scale @inputChange="val => inputChange('scale', val)"></scale>

+ 16 - 5
src/views/recruit/position/components/conditionFilter/areaType.vue

@@ -1,5 +1,5 @@
 <template>
-  <commonStyle :btnTitle="title">
+  <commonStyle :btnTitle="title" v-if="show">
     <v-list :items="items">
       <v-list-item
         color="primary"
@@ -19,14 +19,16 @@
 <script setup>
 import commonStyle from './commonStyle.vue'
 import { getDict } from '@/hooks/web/useDictionaries'
-import { ref, defineEmits } from 'vue';
+import { ref, defineEmits, inject } from 'vue';
 
 defineOptions({name: 'conditionFilter-area-type'})
-const emits = defineEmits(['selectedItems'])
+const emits = defineEmits(['inputChange'])
 const props = defineProps({
   list: Array
 })
 
+const show = ref(false)
+const query = inject('routeQuery')
 const title = ref('工作地点')
 let items = ref()
 let selectedItems = ref([])
@@ -37,13 +39,22 @@ getDict('menduner_area_type', {}, 'areaList').then(({ data }) => {
     return { id, label, number: e.value, parentId, type }
   })
   items.value = [{ id: -1, label: '全部' }, ...arr]
+  if (query && query.areaIds) {
+    if (query?.areaIds) {
+      selectedItems.value = [Number(query.areaIds)]
+      emits('inputChange', { values: selectedItems.value })
+    }
+  }
+  show.value = true
 })
+
 const handle = (val) => {
   const obj = selectedItems.value.find(e => e === val.id)
-  title.value = obj ? '工作地点' : '工作地点(1)'
+  title.value = val.id === -1 ? '工作地点' : '工作地点(1)'
   selectedItems.value = obj ? [] : [val.id]
-  emits('selectedItems', selectedItems.value)
+  emits('inputChange', { values: selectedItems.value })
 }
 </script>
+
 <style lang="scss" scoped>
 </style>

+ 14 - 1
src/views/recruit/position/components/conditionFilter/commonStyle.vue

@@ -1,5 +1,13 @@
 <template>
-  <v-menu open-on-hover :close-delay="1" :open-delay="0" v-bind="$attrs">
+  <v-menu 
+    open-on-hover 
+    :close-delay="1" 
+    :open-delay="0" 
+    v-bind="$attrs" 
+    location="bottom" 
+    max-height="400"
+    :close-on-content-click="closeOnContentClick"
+  >
     <template v-slot:activator="{ isActive, props }">
       <v-btn
         class="mr-3"
@@ -22,8 +30,13 @@ const defineProps = defineProps({
   btnTitle: {
     type: String,
     default: 'Text'
+  },
+  closeOnContentClick: {
+    type: Boolean,
+    default: true
   }
 })
 </script>
+
 <style lang="scss" scoped>
 </style>

+ 45 - 6
src/views/recruit/position/components/conditionFilter/expType.vue

@@ -1,5 +1,5 @@
 <template>
-  <commonStyle btnTitle="工作经验" :close-on-content-click="false">
+  <commonStyle v-if="show" :btnTitle="title" :closeOnContentClick="isSingle">
     <v-list>
       <v-list-item
         color="primary"
@@ -7,6 +7,9 @@
         v-for="item in items" :key="item.id" :value="item.value"
         @click="handle(item.value)"
       >
+        <template v-if="selectedItems.includes(item.value)" v-slot:append>
+          <v-icon icon="mdi-check"></v-icon>
+        </template>
         <v-list-item-title>{{ item.label }}</v-list-item-title>
       </v-list-item>
     </v-list>
@@ -15,21 +18,57 @@
 <script setup>
 import commonStyle from './commonStyle.vue'
 import { getDict } from '@/hooks/web/useDictionaries'
-import { ref, defineEmits } from 'vue';
+import { ref, defineEmits, inject } from 'vue';
 
 defineOptions({name: 'conditionFilter-expType'})
-const emits = defineEmits(['selectedItems'])
+const props = defineProps({
+  isSingle: {
+    type: Boolean,
+    default: false
+  }
+})
+
+const show = ref(false)
+const query = inject('routeQuery')
+const title = ref('工作经验')
+const emits = defineEmits(['inputChange'])
 let items = ref()
 const selectedItems = ref([])
 getDict('menduner_exp_type').then(({ data }) => {
   data = data?.length && data || []
   items.value = data
+  if (query && query.expType) {
+    const str = query.expType.split(',')[0]
+    const arr = str.split('_')
+    if (arr?.length) {
+      selectedItems.value = arr
+      emits('inputChange', { values: selectedItems.value, isEmit: false })
+    }
+  }
+  show.value = true
 })
 const handle = (val) => {
-  if (selectedItems.value.includes(val)) selectedItems.value = selectedItems.value.filter(i => i !== val)
-  else selectedItems.value.push(val)
-  emits('selectedItems', selectedItems.value)
+  const obj = selectedItems.value.find(e => e === val)
+  if (props.isSingle) {
+    // 单选
+    selectedItems.value = obj ? [] : [val]
+  } else {
+    // 多选 
+    if (obj) {
+      // 已存在的再次选中就取消掉
+      selectedItems.value = selectedItems.value.filter(i => i !== val)
+    } else {
+      // 不存在
+      if (val === '2') selectedItems.value = [val] // 选中经验不限时清空其它选中项
+      else selectedItems.value.push(val)
+      // 当经验不限已存在时还选中其它项,把经验不限给清掉
+      if (val !== '2' && selectedItems.value.find(k => k === '2')) selectedItems.value = selectedItems.value.filter(i => i !== '2')
+    }
+  }
+  title.value = val === '2' ? '工作经验' : (props.isSingle ? '工作经验(1)' : `工作经验(${selectedItems.value.length})`)
+  emits('inputChange', { values: selectedItems.value, isEmit: true })
 }
 </script>
+
 <style lang="scss" scoped>
 </style>