Browse Source

求职类型传值及回显

lifanagju_citu 11 tháng trước cách đây
mục cha
commit
779e476ea5

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

@@ -2,7 +2,7 @@
   <div class="d-flex">
     <companyIndustry @inputChange="val => inputChange('industryIds', val)"></companyIndustry>
     <positionType @inputChange="val => inputChange('positionId', val)"></positionType>
-    <JobType @inputChange="val => inputChange('jobType', val)"></JobType>
+    <JobType @inputChange="val => emits('change', 'jobType', val)"></JobType>
     <expType :isSingle="false" @inputChange="val => inputChange('expType', val)"></expType>
     <payScope @inputChange="val => inputChange('payType', val)"></payScope>
     <educationType :isSingle="false" @inputChange="val => inputChange('eduType', val)"></educationType>
@@ -22,7 +22,7 @@ import financingStatus from './conditionFilter/financingStatus.vue'
 import { reactive, defineExpose } from 'vue'
 import { useRoute } from 'vue-router'
 defineOptions({name: 'retrieval-components-conditionFilter'})
-const emits = defineEmits(['conditionFilterChange'])
+const emits = defineEmits(['change'])
 const route = useRoute()
 
 const removeEmptyStringsAndReturnNew = (obj) => {
@@ -40,14 +40,14 @@ let query = reactive({})
 
 if (route.query?.content) {
   query['content'] = route.query.content
-  emits('conditionFilterChange')
+  emits('change')
 }
 
-const inputChange = (key, { values, isEmit}) => {
+const inputChange = (key, { values }) => {
   params[key] = values
   query[key] = Array.isArray(values) ? values.join('_') : values
   query = removeEmptyStringsAndReturnNew(query)
-  if (isEmit) emits('conditionFilterChange', query.value)
+  emits('change', query.value)
 }
 const getQuery = () => {
   return query

+ 7 - 6
src/views/recruit/position/components/conditionFilter/JobType.vue

@@ -2,9 +2,9 @@
   <commonStyle :btnTitle="title" :close-on-content-click="false" v-if="show">
     <v-list>
       <v-list-item
-        color="primary"
-        :active="selectedItems.includes(item.value)"
         v-for="item in items" :key="item.id" :value="item.value"
+        :active="selectedItems.includes(item.value)"
+        color="primary"
         @click="handle(item.value)"
       >
         <template v-if="selectedItems.includes(item.value)" v-slot:append>
@@ -36,22 +36,23 @@ getDict('menduner_job_type').then(({ data }) => {
     const str = query.jobType.split(',')[0]
     const arr = str.split('_')
     if (arr?.length) {
-      title.value = `求职类型(${arr.length})`
       selectedItems.value = arr
-      emits('inputChange', { values: selectedItems.value, isEmit: true })
+      title.value = selectedItems.value.length ? `求职类型(${selectedItems.value.length})` : '求职类型'
     }
   }
   show.value = true
 })
 const handle = (val) => {
+  title.value = '求职类型'
   if (selectedItems.value.includes(val)) {
-    title.value = '求职类型'
     selectedItems.value = selectedItems.value.filter(i => i !== val)
   } else {
     title.value = '求职类型(1)'
     selectedItems.value.push(val)
   }
-  emits('inputChange', { values: selectedItems.value, isEmit: true })
+  title.value = selectedItems.value.length ? `求职类型(${selectedItems.value.length})` : '求职类型'
+  const str = selectedItems.value.length ? selectedItems.value.join('_') : ''
+  emits('inputChange', str)
 }
 </script>
 <style lang="scss" scoped>