Переглянути джерело

没有职位信息要投递简历时,先选择要投递的岗位

lifanagju_citu 2 місяців тому
батько
коміт
36a4e758b7
1 змінених файлів з 83 додано та 5 видалено
  1. 83 5
      src/views/recruit/components/message/index.vue

+ 83 - 5
src/views/recruit/components/message/index.vue

@@ -156,6 +156,24 @@
   <CtDialog :visible="showSelectPosition" :widthType="2" titleClass="text-h6" title="选择要求简历的职位" @close="showSelectPosition = false" @submit="handleRequestResumeSubmit">
     <CtForm v-if="showSelectPosition" ref="requestFromRef" :items="requestFormItems"></CtForm>
   </CtDialog>
+  <!-- 发送简历-选择要发送的职位 -->
+  <CtDialog :visible="openPositionSelectDialog" :widthType="2" titleClass="text-h6" title="请选择要投递的职位" @close="openPositionSelectDialog = false" @submit="selectPositionSubmit">
+    <div style="position: relative; min-height: 200px">
+      <v-radio-group v-model="selectJobId">
+        <div v-for="val in rightEntPositionList" :key="val.value" class="d-flex align-center radioBox" >
+          <v-radio :label="val.label" :value="val.value"  color="primary"></v-radio>
+          <span class="defaultLink mx-3" style="font-size: 14px;" @click.stop="positionDetail(val)">预览</span>
+        </div>
+      </v-radio-group>
+    </div>
+    <v-btn
+      variant="text"
+      color="primary"
+      @click="changePositionData"
+    >
+      {{ positionListIsEnd ? '没有更多职位了~ 再选一遍' : '换一批'}} <v-icon size="16">mdi-refresh</v-icon>
+    </v-btn>
+  </CtDialog>
 
   <!-- 选择附件简历投递 -->
   <CtDialog :visible="showResume" :widthType="2" titleClass="text-h6" title="发送简历" @close="showResume = false; selectResume = null; enRequestPositionInfo = {}" @submit="handleSubmitResume">
@@ -168,6 +186,7 @@
       </v-radio-group>
     </div>
   </CtDialog>
+	<Loading :visible="pageLoading" />
 </template>
 
 <script setup>
@@ -180,7 +199,7 @@ import { useRoute } from 'vue-router'
 import Chatting from './components/chatting.vue'
 import { initConnect, send, initChart, getMoreMessages, checkConversation } from '@/hooks/web/useIM'
 import { useI18n } from '@/hooks/web/useI18n'
-import { getPositionDetails, jobCvRelCheckSend, jobCvRelSend, jobCvRelHireSend } from '@/api/position'
+import { getPositionDetails, jobCvRelCheckSend, jobCvRelSend, jobCvRelHireSend, getJobAdvertisedSearch } from '@/api/position'
 import { getInterviewInviteListByInviteUserId, getMessageType } from '@/api/common'
 // import { getUserInfo } from '@/api/personal/user'
 import { getBaseInfo } from '@/api/common'
@@ -407,6 +426,7 @@ async function getMessageTypeSync () {
     }
   })
   if (!data.records || !data.records.length) { 
+    positionInfo.value = {}
     return
   }
   const _item = data.records.pop()
@@ -487,10 +507,68 @@ const handleUploadResume = async (url, title, filename) => {
   obj.truthValue = url
 }
 
+const changePositionData = () => {
+  positionListParams.value.pageNo = positionListIsEnd.value ? 1 : positionListParams.value.pageNo + 1
+  getRecruitPositionList()
+}
+
+const positionDetail = (val) => {
+  const id = val.value
+  if (!id) return
+  window.open(`/recruit/personal/position/details/${id}`)
+}
+
+// 选中职位并投递
+const selectJobId = ref('')
+const selectPositionSubmit = async () => {
+  // 投递
+  openPositionSelectDialog.value = false
+  handleSendResume(handleSendResumeItem)
+}
+
+const rightEntPositionTotal = ref(0)
+const rightEntPositionList = ref([])
+const positionListParams = ref({ pageNo: 1, pageSize: 5 })
+const openPositionSelectDialog = ref(false)
+const pageLoading = ref(false)
+const positionListIsEnd = computed(() => positionListParams.value.pageNo * positionListParams.value.pageSize >=  rightEntPositionTotal.value)
+// 职位列表
+const getRecruitPositionList = async () => {
+  const enterpriseId = info.value?.enterpriseId || null
+  if (!enterpriseId) return Snackbar.warning('访问企业错误!')
+
+  pageLoading.value = true
+  const { list, total: number } = await getJobAdvertisedSearch({ ...positionListParams.value, enterpriseId })
+  if (!list.length) return Snackbar.warning('企业暂无招聘中的职位,无法进行投递!')
+
+  rightEntPositionTotal.value = number
+  rightEntPositionList.value = list.map(j => {
+    const e = j?.job || null
+    if (!e) return e
+    const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
+    return {
+      label: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
+      value: e.id,
+      data: e
+    }
+  }).filter(Boolean)
+  
+  setTimeout(() => { pageLoading.value = false }, 300)
+}
+
 // 获取简历
 const showUploadDialog = ref(false)
 const enRequestPositionInfo = ref({}) // 企业求简历时选中的职位信息
+let handleSendResumeItem = null
 async function handleSendResume (item) {
+  const jobId = enRequestPositionInfo.value && enRequestPositionInfo.value?.id ? enRequestPositionInfo.value?.id : positionInfo.value.id
+  if (!jobId && !selectJobId.value && import.meta.env.VITE_NODE_ENV !== 'production') {
+    // 没有基于职位接收到的沟通,弹出职位列表让求职者选择。否则无法投递简历。
+    handleSendResumeItem = item
+    await getRecruitPositionList()
+    if (rightEntPositionTotal.value) openPositionSelectDialog.value = true
+    return
+  }
   try {
     item.loading = true
     // 获取简历列表
@@ -561,12 +639,12 @@ const handleSubmitAttachment = async () => {
   // 简历投递至简历库
   if (isEmployment.value !== '-1') {
     await jobCvRelHireSend({
-      jobId: positionInfo.value.id,
+      jobId: positionInfo.value.id || selectJobId.value,
       url: obj.url,
       recommendUserId: isEmployment.value
     })
   } else {
-    const jobId = enRequestPositionInfo.value && enRequestPositionInfo.value?.id ? enRequestPositionInfo.value?.id : positionInfo.value.id
+    const jobId = enRequestPositionInfo.value && enRequestPositionInfo.value?.id ? enRequestPositionInfo.value?.id : positionInfo.value.id || selectJobId.value
     const type = (enRequestPositionInfo.value && Object.keys(enRequestPositionInfo.value).length ? enRequestPositionInfo.value.hire : positionInfo.value.hire) ? 1 : 0
     await jobCvRelSend({
       jobId,
@@ -601,12 +679,12 @@ async function handleSubmitResume () {
   // 简历投递至简历库
   if (isEmployment.value !== '-1') {
     await jobCvRelHireSend({
-      jobId: positionInfo.value.id,
+      jobId: positionInfo.value.id || selectJobId.value,
       url: _info.url,
       recommendUserId: isEmployment.value
     })
   } else {
-    const jobId = enRequestPositionInfo.value && enRequestPositionInfo.value?.id ? enRequestPositionInfo.value?.id : positionInfo.value.id
+    const jobId = enRequestPositionInfo.value && enRequestPositionInfo.value?.id ? enRequestPositionInfo.value?.id : positionInfo.value.id || selectJobId.value
     const type = (enRequestPositionInfo.value && Object.keys(enRequestPositionInfo.value).length ? enRequestPositionInfo.value.hire : positionInfo.value.hire) ? 1 : 0
     await jobCvRelSend({
       jobId,