|
@@ -1,276 +0,0 @@
|
|
-<template>
|
|
|
|
- <div v-loading="saveLoading">
|
|
|
|
- <el-row :gutter="10">
|
|
|
|
- <el-col :span="12">
|
|
|
|
- <el-tabs v-model="activeName" type="border-card">
|
|
|
|
- <el-tab-pane label="简历解析" v-loading="loading" name="resumeAnalysis">
|
|
|
|
- <div v-if="fileUrl">
|
|
|
|
- <div class="text-right m-b-10px">
|
|
|
|
- <el-button v-if="!isEdit" @click="handleText">查看文本信息</el-button>
|
|
|
|
- <el-button type="primary" @click="handleResetUpload">重新上传简历</el-button>
|
|
|
|
- </div>
|
|
|
|
- <IFrame :src="fileUrl" />
|
|
|
|
- <el-drawer
|
|
|
|
- v-model="drawer"
|
|
|
|
- modal-class="drawer"
|
|
|
|
- size="75%"
|
|
|
|
- direction="ltr"
|
|
|
|
- title="简历解析(可复制文本使用)"
|
|
|
|
- >
|
|
|
|
- <p v-for="(text, index) in resumeTxt" :key="text + index">{{ text }}</p>
|
|
|
|
- </el-drawer>
|
|
|
|
- </div>
|
|
|
|
- <el-upload
|
|
|
|
- v-else
|
|
|
|
- ref="uploadRef"
|
|
|
|
- v-model:file-list="fileList"
|
|
|
|
- :action="uploadUrl"
|
|
|
|
- :auto-upload="false"
|
|
|
|
- :data="data"
|
|
|
|
- :limit="1"
|
|
|
|
- :on-change="handleChange"
|
|
|
|
- :on-error="submitFormError"
|
|
|
|
- :on-exceed="handleExceed"
|
|
|
|
- :on-success="submitFormSuccess"
|
|
|
|
- :http-request="httpRequest"
|
|
|
|
- accept=".pdf, doc, .docx"
|
|
|
|
- drag
|
|
|
|
- class="flex-1"
|
|
|
|
- >
|
|
|
|
- <i class="el-icon-upload"></i>
|
|
|
|
- <div class="el-upload__text">上传附件, 将文件拖到此处,或 <em>点击上传</em></div>
|
|
|
|
- <template #tip>
|
|
|
|
- <div class="el-upload__tip color-red">
|
|
|
|
- 提示:仅允许导入 pdf、doc、docx 格式文件!
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </el-upload>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- <el-tab-pane label="人员搜索" name="personnelSearch">
|
|
|
|
- <Search @detail="handleDetail" :searchName="formData?.name_zh || formData?.name_en || ''" />
|
|
|
|
- </el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
- </el-col>
|
|
|
|
-
|
|
|
|
- <el-col :span="12">
|
|
|
|
- <div ref="content" :style="{'height': height, 'overflow-y': 'auto'}">
|
|
|
|
- <el-tabs type="border-card">
|
|
|
|
- <el-tab-pane label="简历解析内容">
|
|
|
|
- <FormPage ref="FormPageRef" :formType="isEdit ? 'edit' : 'create'" :itemData="formData" />
|
|
|
|
- <div class="text-center m-t-30px">
|
|
|
|
- <el-affix position="bottom" :offset="20">
|
|
|
|
- <el-button type="primary" @click="handleSave" size="large" class="!w-120px">保 存</el-button>
|
|
|
|
- </el-affix>
|
|
|
|
- </div>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- <el-tab-pane label="标签">
|
|
|
|
- <el-card shadow="never">
|
|
|
|
- <template #header>
|
|
|
|
- <CardTitle title="已有标签" />
|
|
|
|
- </template>
|
|
|
|
- <m-tags v-if="formData && Object.keys(formData).length" :data="formData?.skillsObjs" />
|
|
|
|
- </el-card>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
- </div>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </div>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script setup>
|
|
|
|
-defineOptions({ name: 'TalentMapDetail'})
|
|
|
|
-import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
|
-import { TalentMap } from '@/api/menduner/system/talentMap'
|
|
|
|
-import { useUpload } from '@/components/UploadFile/src/useUpload'
|
|
|
|
-import { commonApi } from '@/api/menduner/common'
|
|
|
|
-import { Base64 } from 'js-base64'
|
|
|
|
-import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
|
-import MTags from './components/tags.vue'
|
|
|
|
-// import DefaultData from './defaultData'
|
|
|
|
-import { cloneDeep } from 'lodash-es';
|
|
|
|
-import { timesTampChange, timestampToAge } from '@/utils/transform/date'
|
|
|
|
-import FormPage from '@/views/menduner/system/talentMap/components/FormPage.vue'
|
|
|
|
-import Search from './components/search.vue'
|
|
|
|
-import { talentLabelingApi } from '@/api/menduner/system/talentMap/labeling'
|
|
|
|
-
|
|
|
|
-const { back } = useRouter()
|
|
|
|
-const loading = ref(false)
|
|
|
|
-const activeName = ref('resumeAnalysis')
|
|
|
|
-const saveLoading = ref(false)
|
|
|
|
-const fileUrl = ref('') // https://minio.menduner.com/dev/person/229988673960153088/attachment/ee3eb21f45e13ede3557a03d18585ed80c5b4212ac5634e3436e309afaa8fe6a.pdf
|
|
|
|
-const uploadRef = ref()
|
|
|
|
-const fileList = ref([])
|
|
|
|
-const data = ref({ path: '' })
|
|
|
|
-const { uploadUrl, httpRequest } = useUpload()
|
|
|
|
-
|
|
|
|
-/** 初始化 */
|
|
|
|
-// const InfoRef = ref()
|
|
|
|
-const content = ref()
|
|
|
|
-const message = useMessage() // 消息弹窗
|
|
|
|
-const height = ref(0)
|
|
|
|
-const { currentRoute } = useRouter() // 路由
|
|
|
|
-const route = useRoute()
|
|
|
|
-const { id } = route.params
|
|
|
|
-const baseUrl = import.meta.env.VITE_PREVIEW_URL
|
|
|
|
-const isEdit = ref(false)
|
|
|
|
-
|
|
|
|
-const drawer = ref(false)
|
|
|
|
-
|
|
|
|
-const resumeTxt = ref([])
|
|
|
|
-const formData = ref({})
|
|
|
|
-const FormPageRef = ref(null)
|
|
|
|
-
|
|
|
|
-// 获取人才详情
|
|
|
|
-const getTalentMap = async () => {
|
|
|
|
- loading.value = true
|
|
|
|
- try {
|
|
|
|
- const data = await TalentMap.getTalentMapDetails(id)
|
|
|
|
- if (!data || !Object.keys(data).length) return
|
|
|
|
- if (data.person?.resumeUrl) {
|
|
|
|
- fileUrl.value = !data.person?.resumeUrl.includes('.pdf') ? `${baseUrl}/onlinePreview?url=${encodeURIComponent(Base64.encode(data.person?.resumeUrl))}` : data.person?.resumeUrl
|
|
|
|
- } else activeName.value = 'personnelSearch'
|
|
|
|
- setItemDataValue(data)
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log(error)
|
|
|
|
- } finally {
|
|
|
|
- loading.value = false
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-onMounted(async () => {
|
|
|
|
- height.value = document.documentElement.clientHeight + 'px'
|
|
|
|
- if (id && id !== 'add') {
|
|
|
|
- isEdit.value = true
|
|
|
|
- await getTalentMap()
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
-
|
|
|
|
-// 简历解析
|
|
|
|
-const getResumeParser = async (url) => {
|
|
|
|
- loading.value = true
|
|
|
|
- try {
|
|
|
|
- const data = await commonApi.resumeParser({ fileUrl: url })
|
|
|
|
- setItemDataValue(data)
|
|
|
|
- } finally {
|
|
|
|
- loading.value = false
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 文件上传
|
|
|
|
-const handleChange = async (file) => {
|
|
|
|
- data.value.path = file.name
|
|
|
|
- unref(uploadRef)?.submit()
|
|
|
|
- if (!fileList.value.length) return
|
|
|
|
-
|
|
|
|
- const url = fileList.value[0].response.data
|
|
|
|
- fileUrl.value = !url.includes('.pdf') ? `${baseUrl}/onlinePreview?url=${encodeURIComponent(Base64.encode(url))}` : url
|
|
|
|
- await getResumeParser(url)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/** 上传错误提示 */
|
|
|
|
-const submitFormError = () => {
|
|
|
|
- message.error('上传失败,请您重新上传!')
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/** 文件数超出提示 */
|
|
|
|
-const handleExceed = () => {
|
|
|
|
- message.error('最多只能上传一个文件!')
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const submitFormSuccess = () => {
|
|
|
|
- // 清理
|
|
|
|
- unref(uploadRef)?.clearFiles()
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 查看文本信息
|
|
|
|
-const handleText = () => {
|
|
|
|
- drawer.value = true
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 重新上传简历
|
|
|
|
-const handleResetUpload = async () => {
|
|
|
|
- await message.confirm('是否确定重新上传简历?确定后将清空当前信息')
|
|
|
|
- fileUrl.value = ''
|
|
|
|
- data.value.path = ''
|
|
|
|
- fileList.value = []
|
|
|
|
- setItemDataValue()
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const setItemDataValue = (data) => {
|
|
|
|
- formData.value = {
|
|
|
|
- name_zh: data?.person?.name || '',
|
|
|
|
- email: data?.person?.email || '',
|
|
|
|
- mobile: data?.person?.phone || '',
|
|
|
|
- birthday: data?.person?.birthday ? timesTampChange(data.person.birthday, 'Y-M-D') : '',
|
|
|
|
- age: data?.person?.birthday ? timestampToAge(data.person.birthday) : null,
|
|
|
|
- career_path: data?.workList ? data.workList.map(e => {
|
|
|
|
- return {
|
|
|
|
- hotel_zh: e?.enterpriseName || null,
|
|
|
|
- title_zh: e?.positionName || null,
|
|
|
|
- date: e?.startTime ? timesTampChange(e.startTime, 'Y-M-D') : null
|
|
|
|
- }
|
|
|
|
- }) : [],
|
|
|
|
- created_at: data?.person?.createTime ? timesTampChange(data.person.createTime, 'Y-M-D') : null,
|
|
|
|
- updated_at: data?.person?.updateTime ? timesTampChange(data.person.updateTime, 'Y-M-D') : null,
|
|
|
|
- }
|
|
|
|
- resumeTxt.value = data?.resume?.rawText?.split('\n') || ''
|
|
|
|
- if (FormPageRef.value?.setFormData) FormPageRef.value.setFormData(formData.value)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 搜索-查看详情
|
|
|
|
-const handleDetail = async (userId) => {
|
|
|
|
- if (!userId) return message.warning('请先选择人才!')
|
|
|
|
- try {
|
|
|
|
- const data = await TalentMap.getTalentMapDetail(userId)
|
|
|
|
- // 去除id
|
|
|
|
- setItemDataValue(data, true)
|
|
|
|
- } catch {}
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 新增人才
|
|
|
|
-const formLoading = ref(false)
|
|
|
|
-const uploadFile = ref(null)
|
|
|
|
-const handleSave = async () => {
|
|
|
|
- const params = { ...FormPageRef.value.formQuery }
|
|
|
|
- if (!params.name_zh) return message.warning('请填写姓名!')
|
|
|
|
-
|
|
|
|
- // 数组转为字符串保存
|
|
|
|
- if (Array.isArray(params?.mobile)) {
|
|
|
|
- params.mobile = params.mobile.filter(i => Boolean(i)).map(j => String(j).replace(/,|,/g, '')).join(',');
|
|
|
|
- }
|
|
|
|
- console.log(params, 'handleSubmit')
|
|
|
|
- try {
|
|
|
|
- formLoading.value = true
|
|
|
|
- let result = {}
|
|
|
|
- if (!id || id === 'add') { // 新增
|
|
|
|
- // uploadFile.value.append('card_data', JSON.stringify(params))
|
|
|
|
- result = await talentLabelingApi.createBusinessCardPost(params)
|
|
|
|
- message.success('新增成功')
|
|
|
|
- back()
|
|
|
|
-
|
|
|
|
- if (result.code === 202 || result.message.includes('疑似重复')) {
|
|
|
|
- if (!result.data?.main_card?.id) return
|
|
|
|
-
|
|
|
|
- await message.confirm('发现与当前名片的疑似重复数据,去处理')
|
|
|
|
- mergeFormRef.value.open(result.data?.main_card?.id)
|
|
|
|
- }
|
|
|
|
- } else { // 编辑
|
|
|
|
- await talentLabelingApi.updateBusinessCard(params, id)
|
|
|
|
- message.success('更新成功')
|
|
|
|
- back()
|
|
|
|
- }
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log('更新失败', error)
|
|
|
|
- } finally {
|
|
|
|
- uploadFile.value = null
|
|
|
|
- formLoading.value = false
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-</script>
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
-:deep(.drawer) {
|
|
|
|
- position: absolute;
|
|
|
|
-}
|
|
|
|
-</style>
|
|
|