Xiao_123 7 місяців тому
батько
коміт
e6fc5fa9f3

+ 4 - 5
src/config/axios/service.js

@@ -10,7 +10,7 @@ import { enterpriseRefreshToken, userRefreshToken } from '@/api/common'
 import { getToken, getRefreshToken, setToken, setRefreshToken, getIsEnterprise } from '@/utils/auth'
 import { rewardEventTrackClick } from '@/api/integral'
 import errorCode from './errorCode'
-// import router from '@/router'
+import router from '@/router'
 
 import { useI18n } from '@/hooks/web/useI18n'
 
@@ -248,13 +248,12 @@ const handleAuthorized = () => {
   const user = useUserStore()
   user.handleClearStorage() // 清除缓存
 
-  // const path = router.currentRoute.value.fullPath
-  // const hasRecommendedPath = path.includes('/recruit/enterprise/talentRecommendation')
-  // console.log(hasRecommendedPath, router.currentRoute.value, '登录过期')
+  const path = router.currentRoute.value.fullPath
+  const hasRecommendedPath = path.includes('/recruit/enterprise/talentRecommendation')
 
   if (!isReLogin.show) {
     // 人才推荐页面不需要弹窗提示
-    // if (hasRecommendedPath) return
+    if (hasRecommendedPath) return
     // 如果已经到重新登录页面则不进行弹窗提示
     if (window.location.href.includes('login?redirect=')) {
       return

+ 16 - 5
src/views/recruit/enterprise/search/components/common.vue

@@ -9,24 +9,35 @@
 
 <script setup>
 defineOptions({ name: 'search-common'})
-import { ref } from 'vue'
+import { ref, watch } from 'vue'
 import { getDict } from '@/hooks/web/useDictionaries'
 
-const emit = defineEmits(['select'])
+const emit = defineEmits(['select', 'clear'])
 const props = defineProps({
   dictType: String,
-  title: String
+  title: String,
+  isClear: Boolean
 })
 
-const select = ref(-1)
+const select = ref('')
 const items = ref([])
 getDict(props.dictType).then(({ data }) => {
-  items.value = [{ value: -1, label: '不限' }, ...data] || []
+  items.value = data || []
 })
 
 const handleSelect = (val) => {
   emit('select', val)
 }
+
+watch(
+  () => props.isClear, 
+  (newVal) => {
+    if (!newVal) return
+    // 清空筛选条件时默认选中不限
+    select.value = ''
+    emit('clear')
+  }
+)
 </script>
 
 <style scoped lang="scss">

+ 2 - 1
src/views/recruit/enterprise/search/recommend/index.vue

@@ -56,7 +56,7 @@ const query = ref({
 const selectItems = ref({
   label: '已发布职位',
   placeholder: '请选择已发布职位',
-  clearable: true,
+  clearable: false,
   width: 600,
   items: []
 })
@@ -107,6 +107,7 @@ const getData = async () => {
 
 // 推荐
 const handleChange = () => {
+  if (!query.value.jobId) return
   query.value.pageNo = 1
   getData()
 }

+ 15 - 2
src/views/recruit/enterprise/search/retrieval/components/area.vue

@@ -15,9 +15,12 @@
 
 <script setup>
 defineOptions({ name: 'search-retrieval-area' })
-import { ref } from 'vue'
+import { ref, watch } from 'vue'
 
-const emit = defineEmits(['select'])
+const emit = defineEmits(['select', 'clear'])
+const props = defineProps({
+  isClear: Boolean
+})
 const select = ref([])
 const areaSelect = ref([])
 
@@ -33,6 +36,16 @@ const handleAreaClear = (k) => {
   if (index !== -1) areaSelect.value.splice(index, 1)
   emit('select', select.value)
 }
+
+watch(
+  () => props.isClear,
+  (val) => {
+    if (!val) return
+    select.value = []
+    areaSelect.value = []
+    emit('clear')
+  }
+)
 </script>
 
 <style scoped lang="scss">

+ 14 - 2
src/views/recruit/enterprise/search/retrieval/components/position.vue

@@ -18,12 +18,13 @@ defineOptions({ name: 'search-screen-industry'})
 import { ref, watch } from 'vue'
 import { getDict } from '@/hooks/web/useDictionaries'
 
-const emit = defineEmits(['select'])
+const emit = defineEmits(['select', 'clear'])
 const props = defineProps({
   selectData: {
     type: Array,
     default: () => []
-  }
+  },
+  isClear: Boolean
 })
 
 const items = ref([])
@@ -58,6 +59,17 @@ const handleSecond = (val) => {
   } else select.value.push(val)
   emit('select', select.value)
 }
+
+watch(
+  () => props.isClear,
+  (val) => {
+    if (!val) return
+    select.value = []
+    children.value = []
+    items.value.forEach(e => e.active = false)
+    emit('clear')
+  }
+)
 </script>
 
 <style scoped lang="scss">

+ 37 - 33
src/views/recruit/enterprise/search/retrieval/index.vue

@@ -1,20 +1,19 @@
 <template>
   <div class="mt-4">
     <div class="d-flex justify-center">
-      <TextInput v-model="query.content" :item="textItem" @enter="handleConfirm" @appendInnerClick="handleConfirm"></TextInput>
+      <TextInput v-model="queryParams.content" :item="textItem" @enter="handleConfirm" @appendInnerClick="handleConfirm"></TextInput>
     </div>
-    <!-- <div style="margin: auto; text-align: center; width: 70%"> -->
     <div>
-      <Position :selectData="position" @select="val => position = val"></Position>
-      <Area @select="val => handleSearch('areaIds', val)"></Area>
-      <CommonPage class="my-3" dictType="menduner_education_type" title="最高学历" @select="val => handleSearch('eduType', val)"></CommonPage>
-      <CommonPage dictType="menduner_exp_type" title="工作经验" @select="val => handleSearch('expType', val)"></CommonPage>
+      <Position :isClear="clear" @clear="clear = false" :selectData="position" @select="val => position = val"></Position>
+      <Area :isClear="clear" @clear="clear = false" @select="val => handleSearch('areaIds', val)"></Area>
+      <CommonPage :isClear="clear" @clear="clear = false" class="my-3" dictType="menduner_education_type" title="最高学历" @select="val => handleSearch('eduType', val)"></CommonPage>
+      <CommonPage :isClear="clear" @clear="clear = false" dictType="menduner_exp_type" title="工作经验" @select="val => handleSearch('expType', val)"></CommonPage>
       <v-divider class="mt-1 mb-3"></v-divider>
       <div>
         <div>
           <v-chip v-for="k in position" :key="k.id" label class="mr-3" closable @click:close="handleClose(k)">{{ k.nameCn }}</v-chip>
         </div>
-        <div v-if="position.length" class="text-end font-size-15 color-999 cursor-pointer color-primary" @click="handleClear">清除选择</div>
+        <div class="text-end font-size-15 color-999 cursor-pointer color-999 clear" @click="handleClear">清空筛选条件</div>
       </div>
       <div class="text-center mt-3">
         <v-btn class="half-button" color="primary" @click="handleConfirm">搜 索</v-btn>
@@ -50,9 +49,6 @@
           <span class="defaultLink ml-3 mt-2">{{ item?.name }}</span>
         </div>
       </template>
-      <!-- <template #actions="{ item }">
-        <v-btn color="primary" variant="text" @click="handleCommunicate(item)">立即沟通</v-btn>
-      </template> -->
     </CtTable>
   </div>
 </template>
@@ -67,10 +63,8 @@ import { getPersonSearchPage } from '@/api/enterprise.js'
 import { dealDictArrayData } from '@/utils/position'
 import { timesTampChange } from '@/utils/date'
 import { getUserAvatar } from '@/utils/avatar'
-// import { talkToUser, defaultTextEnt } from '@/hooks/web/useIM'
-// import { useRouter } from 'vue-router'
+import Snackbar from '@/plugins/snackbar'
 
-// const router = useRouter()
 const textItem = ref({
   type: 'text',
   width: 600,
@@ -81,7 +75,9 @@ const textItem = ref({
 })
 const query = ref({
   pageNo: 1,
-  pageSize: 10,
+  pageSize: 10
+})
+const queryParams = ref({
   content: null,
   positionIds: [],
   areaIds: [],
@@ -100,16 +96,13 @@ const headers = ref([
   { title: '所在城市', key: 'areaName', sortable: false },
   { title: '户籍地', key: 'regName', sortable: false },
   { title: '婚姻状况', key: 'maritalStatusName', sortable: false },
-  { title: '首次工作时间', key: 'firstWorkTime', sortable: false, value: item => timesTampChange(item.firstWorkTime, 'Y-M-D') },
-  // { title: '联系电话', key: 'phone', sortable: false },
-  // { title: '常用邮箱', key: 'email', sortable: false },
-  // { title: '操作', key: 'actions', sortable: false }
+  { title: '首次工作时间', key: 'firstWorkTime', sortable: false, value: item => timesTampChange(item.firstWorkTime, 'Y-M-D') }
 ])
 
 const getData = async () => {
   loading.value = true
   try {
-    const res = await getPersonSearchPage(query.value)
+    const res = await getPersonSearchPage(Object.assign(queryParams.value, query.value))
     if (!res.list.length) {
       items.value = []
       total.value = 0
@@ -131,32 +124,40 @@ const handleChangePage = (e) =>{
 const position = ref([])
 const handleSearch = (key, value) => {
   query.value.pageNo = 1
-  if (value === -1) query.value[key] = null
-  else query.value[key] = value
+  queryParams.value[key] = value
+}
+
+const checkValue = (obj) => {
+  return Object.values(obj).some(value => {  
+    return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
+  })
 }
 
 const handleConfirm = () => {
   const positionIds = position.value.map(k => k.id)
-  query.value.positionIds = positionIds || []
+  queryParams.value.positionIds = positionIds || []
   query.value.pageNo = 1
+  if (!checkValue(queryParams.value)) return Snackbar.warning('至少选择一个条件进行搜索')
   getData()
 }
 
-const handleClose = (item) => {
-  position.value = position.value.filter(k => k.id !== item.id)
-}
-
+// 清空筛选条件
+const clear = ref(false)
 const handleClear = () => {
   position.value = []
+  queryParams.value = {
+    content: null,
+    positionIds: [],
+    areaIds: [],
+    expType: '',
+    eduType: ''
+  }
+  clear.value = true
 }
 
-// 立即沟通
-// const handleCommunicate = async (item) => {
-//   const userId = item.userId
-//   await talkToUser({userId, text: defaultTextEnt})
-//   let url = `/recruit/enterprise/chatTools?id=${userId}`
-//   router.push(url)
-// }
+const handleClose = (item) => {
+  position.value = position.value.filter(k => k.id !== item.id)
+}
 
 // 人才详情
 const handleToPersonDetail = ({ userId, id }) => {
@@ -173,4 +174,7 @@ const badgeIcon = computed(() => (item) => {
 </script>
 
 <style scoped lang="scss">
+.clear:hover {
+  color: var(--v-primary-base);
+}
 </style>

+ 1 - 1
src/views/recruit/enterprise/systemManagement/userManagement/index.vue

@@ -14,7 +14,7 @@
       no-data-text="暂无数据"
     >
       <template #bottom></template>
-      <template v-slot:item.actions="{ item }">
+      <template v-slot:[`item.actions`]="{ item }">
         <!-- <v-btn color="primary" variant="text" @click="handleBinding(item)">{{ $t('enterprise.userManagement.jobBinding') }}</v-btn> -->
         <v-btn v-if="item.status === '1' && item.userType !== '1'" color="primary" variant="text" @click="handleAction('', 0, item)">{{ $t('enterprise.userManagement.enable') }}</v-btn>
         <v-btn v-if="item.status === '0' && item.userType !== '1'" color="primary" variant="text" @click="handleAction('', 1, item)">{{ $t('enterprise.userManagement.disable') }}</v-btn>

+ 16 - 7
src/views/recruit/enterprise/talentRecommendation/components/filter.vue

@@ -46,7 +46,7 @@
     <div class="white-bgc pb-5" style="position: sticky; bottom: 0;">
       <v-divider class="mb-5"></v-divider>
       <div class="d-flex align-center">
-        <v-btn color="primary" variant="outlined" style="width: 100px;" @click="handleReset">重 置</v-btn>
+        <v-btn color="primary" variant="outlined" style="width: 130px;" @click="handleReset">清空筛选条件</v-btn>
         <v-btn class="ml-5" color="primary" style="flex: 1;" @click="handleConfirm">确 定</v-btn>
       </div>
     </div>
@@ -57,6 +57,7 @@
 defineOptions({ name: 'filterPage'})
 import { ref } from 'vue'
 import { getDict } from '@/hooks/web/useDictionaries'
+import Snackbar from '@/plugins/snackbar'
 
 const emit = defineEmits(['close', 'search'])
 const textItem = ref({
@@ -79,20 +80,20 @@ const list = ref([
     title: '最高学历',
     dictTypeName: 'menduner_education_type',
     items: [],
-    value: -1,
+    value: '',
     key: 'eduType'
   },
   {
     title: '工作经验',
     dictTypeName: 'menduner_exp_type',
     items: [],
-    value: -1,
+    value: '',
     key: 'expType'
   }
 ])
 list.value.forEach(e => {
   getDict(e.dictTypeName).then(({ data }) => {
-    e.items = [{ value: -1, label: '不限' }, ...data] || []
+    e.items = data || []
   })
 })
 
@@ -127,7 +128,6 @@ const handleSecond = (val) => {
   if (index !== -1) {
     select.value.splice(index, 1)
   } else select.value.push(val)
-  console.log(select.value, 'select')
   // emit('select', select.value)
 }
 
@@ -144,7 +144,7 @@ const handleSecond = (val) => {
 //   if (index !== -1) areaSelect.value.splice(index, 1)
 // }
 
-// 重置
+// 清空
 const handleReset = () => {
   query.value = {
     content: '',
@@ -158,13 +158,22 @@ const handleReset = () => {
   select.value = []
   list.value.forEach(e => e.value = -1)
   items.value.forEach(e => e.active = false)
-  emit('search', query.value)
 }
+
+const checkValue = (obj) => {
+  return Object.values(obj).some(value => {  
+    return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
+  })
+}
+
 const handleConfirm = () => {
   query.value.content = textItem.value.value
   // query.value.areaIds = areaSelectData.value
   query.value.positionIds = select.value.map(e => e.id)
   list.value.forEach(e => query.value[e.key] = e.value === -1 ? '' : e.value)
+
+  // 判断是否至少有选择一个条件
+  if (!checkValue(query.value)) return Snackbar.warning('至少选择一个条件进行搜索')
   emit('search', query.value)
 }
 </script>