123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <template>
- <div>
- <CtTable
- class="mt-3"
- :items="items"
- :headers="headers"
- :loading="false"
- :elevation="0"
- height="60vh"
- :disableSort="true"
- :isTools="false"
- :showPage="true"
- :total="total"
- :page-info="pageInfo"
- itemKey="id"
- @pageHandleChange="e => emit('page', e)"
- >
- <template #name="{ item }">
- <div class="d-flex align-center cursor-pointer" @click="handleToPersonDetail(item)">
- <v-badge
- v-if="item?.person?.sex === '1' || item?.person?.sex === '2'"
- bordered
- offset-y="6"
- :color="badgeColor(item)"
- :icon="badgeIcon(item)">
- <v-avatar size="40" :image="getUserAvatar(item.person.avatar, item.person.sex)"></v-avatar>
- </v-badge>
- <v-avatar v-else size="40" :image="getUserAvatar(item.person.avatar, item.person.sex)"></v-avatar>
- <span class="defaultLink ml-3">{{ item?.person?.name }}</span>
- </div>
- </template>
- <template #status="{ item }">
- <span v-if="tab === 0">{{ item.status && item.status === '0' ? '未查看' : '已查看' }}</span>
- <span v-else>{{ item.status ? props.statusList.find(i => i.value === item.status)?.label : '' }}</span>
- </template>
- <template #actions="{ item }">
- <v-btn v-if="tab === 0" color="primary" variant="text" @click="handlePreviewResume(item)">查看附件</v-btn>
- <v-btn v-if="tab === 0" :color="item.jobClosed ? 'grey' : 'primary'" variant="text" @click="handleInterviewInvite(item)">邀请面试<v-tooltip v-if="item.jobClosed" activator="parent" location="top">职位已关闭</v-tooltip></v-btn>
- <v-btn v-if="tab === 0" :color="item.jobClosed ? 'grey' : 'primary'" variant="text" @click="handleToCommunicate(item)">立即沟通<v-tooltip v-if="item.jobClosed" activator="parent" location="top">职位已关闭</v-tooltip></v-btn>
- <v-btn v-if="tab === 0 || tab === 1" color="primary" variant="text" @click="handleEliminate(item)">不合适</v-btn>
- <v-btn v-if="!item.inTalentPool && (tab === 1 || tab === 2 || tab === 3)" color="primary" variant="text" @click="handleJoinToTalentPool(item)">加入储备</v-btn>
- <v-btn v-if="tab === 1 && (item.status === '3' || item.status === '4')" color="primary" variant="text" @click="handleEnterByEnterprise(item)">入职</v-btn>
- <v-btn v-if="tab === 4" color="primary" variant="text" @click="handleCancelEliminate(item)">取消不合适</v-btn>
- <v-btn v-if="tab === 2 && item?.job?.hire" color="primary" variant="text" @click="handleSettlement(item)">结算</v-btn>
- </template>
- </CtTable>
- <!-- 邀请面试 -->
- <CtDialog :visible="showInvite" :widthType="4" titleClass="text-h6" title="面试信息" @close="handleEditClose" @submit="handleEditSubmit">
- <InvitePage v-if="showInvite" ref="inviteRef" :itemData="itemData"></InvitePage>
- </CtDialog>
- <TipDialog :visible="showTip" icon="mdi-check-circle-outline" message="面试邀请发送成功" @close="showTip = false">
- <div class="color-primary text-decoration-underline cursor-pointer" @click="handleToInterviewManagement">点击到面试中查看。</div>
- </TipDialog>
- </div>
- </template>
- <script setup>
- defineOptions({ name: 'table-page'})
- import { ref, computed, watch } from 'vue'
- import { previewFile } from '@/utils'
- import { personJobCvLook, joinEliminate, personEntryByEnterprise, personCvUnfitCancel, joinToTalentPool } from '@/api/recruit/enterprise/personnel'
- import { saveInterviewInvite } from '@/api/recruit/enterprise/interview'
- import { hireJobCvRelSettlement } from '@/api/recruit/public/delivery'
- import { useI18n } from '@/hooks/web/useI18n'
- import { useUserStore } from '@/store/user'
- import Snackbar from '@/plugins/snackbar'
- import InvitePage from './invite.vue'
- import { getUserAvatar } from '@/utils/avatar'
- import { talkToUser, defaultTextEnt } from '@/hooks/web/useIM'
- import { useRouter } from 'vue-router'; const router = useRouter()
- const showTip = ref(false)
- const { t } = useI18n()
- const emit = defineEmits(['refresh'])
- const props = defineProps({
- tab: Number,
- items: Array,
- statusList: Array,
- pageInfo: Object,
- total: Number
- })
- const badgeColor = computed(() => (item) => {
- return (item.person && item.person.sex) ? (item.person.sex === '1' ? '#1867c0' : 'error') : 'error'
- })
- const badgeIcon = computed(() => (item) => {
- return (item.person && item.person.sex) ? (item.person.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
- })
- const userStore = useUserStore()
- const inviteRef = ref()
- const showInvite = ref(false)
- const headers = ref([
- { title: '姓名', value: 'name', sortable: false },
- { title: '应聘职位', value: 'job.name', sortable: false },
- { title: '求职状态', key: 'person.jobStatusName', sortable: false },
- { title: '工作经验', key: 'person.expName', sortable: false },
- { title: '最高学历', key: 'person.eduName', sortable: false },
- { title: '岗位薪资', key: 'job', value: item => item.job.payFrom && item.job.payTo ? `${item.job.payFrom ? item.job.payFrom + '-' : ''}${item.job.payTo}${item.job.payName ? '/' + item.job.payName : ''}` : '面议', sortable: false },
- { title: '状态', key: 'status', sortable: false },
- { title: '操作', value: 'actions', sortable: false }
- ])
- const unfit = { title: '类型', key: 'unfitType', sortable: false, value: item => item.type && item.type === '0' ? '简历不适合' : '面试不适合' }
- const delivery = { title: '类型', key: 'deliveryType', sortable: false, value: item => item?.job?.hire ? '赏金职位' : '普通职位' }
- watch(
- () => props.tab,
- (val) => {
- const obj = val !== 4 ? delivery : unfit
- const index = headers.value.indexOf(obj)
- if (index === -1) headers.value.splice(-1, 0, obj)
- else headers.value.splice(index, 1)
- // 不合适不需要展示状态
- if (val === 4) {
- const obj = headers.value.find(e => e.key === 'status')
- const i = headers.value.indexOf(obj)
- if (i !== -1) headers.value.splice(i, 1)
- }
- },
- { immediate: true }
- )
- // 人才详情
- const handleToPersonDetail = ({ userId, id }) => {
- if (!userId || !id) return
- window.open(`/recruit/enterprise/talentPool/details/${userId}?id=${id}`)
- }
- // 加入人才库
- const handleJoinToTalentPool = async (item) => {
- if (!item.userId) return Snackbar.warning('数据异常')
- await joinToTalentPool(item.userId)
- Snackbar.success(t('common.operationSuccessful'))
- emit('refresh')
- }
- // 入职
- const handleEnterByEnterprise = async (item) => {
- if (!item.id) return
- await personEntryByEnterprise(item.id)
- Snackbar.success(t('common.operationSuccessful'))
- emit('refresh')
- }
- // 不合适
- const handleEliminate = async (item) => {
- if (!item.id || !item?.job?.id) return
- const query = {
- bizId: item.id,
- jobId: item.job.id,
- userId: item.userId,
- type: props.tab === 0 ? '0' : '1' // 投递简历0 已邀约1
- }
- await joinEliminate(query)
- Snackbar.success(t('common.operationSuccessful'))
- emit('refresh')
- }
- // 取消不合适
- const handleCancelEliminate = async (item) => {
- if (!item.id) return
- await personCvUnfitCancel(item.id)
- Snackbar.success(t('common.operationSuccessful'))
- emit('refresh')
- }
- // 查看简历
- const handlePreviewResume = async ({ url, id }) => {
- if (!url || !id) return
- try {
- const res = await personJobCvLook(id)
- if (res) {
- emit('refresh')
- previewFile(url)
- }
- } catch (err) {
- console.log(err)
- }
- }
- // 邀请面试
- const itemData = ref({})
- // const inviteType = ref(false)
- const handleInterviewInvite = (item) => {
- if (item?.jobClosed) return // 职位已关闭
- // if (item?.job?.hire) inviteType.value = true
- itemData.value = item
- showInvite.value = true
- }
- const handleToCommunicate = async (item) => {
- if (item?.jobClosed) return // 职位已关闭
- const userId = item.userId
- // const textObj = { text: defaultTextEnt }
- await talkToUser({userId, text: defaultTextEnt})
- let url = `/recruit/enterprise/chatTools?id=${userId}`
- router.push(url)
- }
- const handleEditClose = () => {
- showInvite.value = false
- // inviteType.value = false
- itemData.value = {}
- }
- const handleEditSubmit = async () => {
- const { valid } = await inviteRef.value.CtFormRef.formRef.validate()
- if (!valid) return
- const query = inviteRef.value.getQuery()
- if (!query?.time) return Snackbar.warning('请选择面试时间')
- await saveInterviewInvite(query)
- showTip.value = true
- handleEditClose()
- emit('refresh')
- }
- // 结算
- const handleSettlement = async (item) => {
- if (!item.id) return
- await hireJobCvRelSettlement(item.id)
- Snackbar.success(t('common.operationSuccessful'))
- emit('refresh')
- // 更新账户信息
- setTimeout(async () => {
- await userStore.getEnterpriseUserAccountInfo()
- }, 2000)
- }
- const handleToInterviewManagement = () => {
- router.push('/recruit/enterprise/interviewManagement')
- }
- </script>
- <style scoped lang="scss">
- :deep(.v-table > .v-table__wrapper > table > thead) {
- background-color: #f7f8fa !important;
- }
- :deep(.v-selection-control__input) {
- color: var(--v-primary-base) !important;
- }
- </style>
|