浏览代码

解析简历

lifanagju_citu 7 月之前
父节点
当前提交
926174996a

+ 7 - 4
src/api/menduner/common/index.ts

@@ -2,9 +2,12 @@ import request from '@/config/axios'
 
 // 
 export const commonApi = {
-  // 上传文件 // import.meta.env.VITE_UPLOAD_URL
+  // 上传文件
   uploadFile: async (data: any) => {
-    // return await request.upload({ url: '/menduner/system/file/upload', data })
-    return await request.upload({ url: import.meta.env.VITE_UPLOAD_URL, data })
-  }
+    return await request.upload({ url: '/infra/file/upload', data })
+  },
+  // 附件简历解析
+  resumeParser: async (params: any) => {
+    return await request.get({ url: `/menduner/system/online/resume/parser`, params })
+  },
 }

+ 1 - 1
src/components/Upload/file.vue

@@ -60,7 +60,7 @@ const handleUploadFile = async (e) => {
 
   const formData = new FormData()
   formData.append(props.customName || 'file', file)
-  formData.append('path', props.path)
+  // formData.append('path', props.path)
   if (props.custom) return emits('success', formData)
   const { data } = await commonApi.uploadFile(formData)
   if (!data) return

+ 9 - 4
src/components/UploadFile/src/UploadFile.vue

@@ -11,6 +11,7 @@
       :http-request="httpRequest"
       :limit="props.limit"
       :multiple="props.limit > 1"
+      :accept="props.accept"
       :on-error="excelUploadError"
       :on-exceed="handleExceed"
       :on-preview="handlePreview"
@@ -20,9 +21,9 @@
       class="upload-file-uploader"
       name="file"
     >
-      <el-button v-if="!disabled" type="primary">
+      <el-button v-if="!disabled" :type="props.butType" :plain="props.plain">
         <Icon icon="ep:upload-filled" />
-        选取文件
+        {{ props.txt }}
       </el-button>
       <template v-if="isShowTip && !disabled" #tip>
         <div style="font-size: 12px">
@@ -49,12 +50,16 @@ const emit = defineEmits(['update:modelValue'])
 
 const props = defineProps({
   modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
+  accept: propTypes.string.def('.xlsx, .xls, .ppt, .pdf, .txt, .doc'), // 文件类型, 例如['png', 'jpg', 'jpeg']
   fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // 文件类型, 例如['png', 'jpg', 'jpeg']
   fileSize: propTypes.number.def(5), // 大小限制(MB)
   limit: propTypes.number.def(5), // 数量限制
   autoUpload: propTypes.bool.def(true), // 自动上传
   drag: propTypes.bool.def(false), // 拖拽上传
-  isShowTip: propTypes.bool.def(true), // 是否显示提示
+  isShowTip: propTypes.bool.def(true), // 
+  txt: propTypes.string.def('选取文件'), // 
+  butType: propTypes.any.def('primary'), // 
+  plain: propTypes.bool.def(false), // 
   disabled: propTypes.bool.def(false) // 是否禁用上传组件 ==> 非必传(默认为 false)
 })
 
@@ -167,7 +172,7 @@ const emitUpdateModelValue = () => {
 </script>
 <style lang="scss" scoped>
 .upload-file-uploader {
-  margin-bottom: 5px;
+  // margin-bottom: 5px;
 }
 
 :deep(.upload-file-list .el-upload-list__item) {

+ 15 - 6
src/views/menduner/system/talentMap/details/components/attachment.vue

@@ -23,10 +23,6 @@
 defineOptions({ name: 'PersonAttachment' })
 import { PersonInfoApi } from '@/api/menduner/system/person'
 
-const props = defineProps({
-  userId: String
-})
-
 const loading = ref(false)
 const tableData = ref([])
 const tableDataTest = [
@@ -49,7 +45,6 @@ const total = ref(0)
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 5,
-  userId: props.userId
 })
 
 const getList = async () => {
@@ -68,5 +63,19 @@ const getList = async () => {
     loading.value = false
   }
 }
-getList()
+
+const { currentRoute } = useRouter() // 路由
+const route = useRoute()
+const { id, userId } = route.query
+if (id) getList()
+else {
+  const data = localStorage.getItem('resumeParserData') ? JSON.parse(localStorage.getItem('resumeParserData')) : null
+  if (data) {
+    tableData.value = [{
+      id: data.id, 
+      url: data.url, 
+      title: data.filename, 
+    }]
+  }
+}
 </script>

+ 17 - 2
src/views/menduner/system/talentMap/index.vue

@@ -103,6 +103,7 @@
 import download from '@/utils/download'
 // import { HuntApi, HuntVO } from '@/api/menduner/system/hunt'
 // import TalentForm from './talentForm.vue'
+import { commonApi } from '@/api/menduner/common'
 import File from '@/components/Upload/file.vue'
 
 /** 猎寻服务 列表 */
@@ -198,9 +199,23 @@ const handleImportAttachment = () => {
 }
 
 // 上传附件
-const fileUrl = ref('')
+// const fileUrl = ref('')
+// const resumeParserData = ref({})
 const handleUploadResume = async (url, title, filename) => {
-  fileUrl.value = url
+  if (url) {
+    const res = await commonApi.resumeParser({ fileUrl: url })
+    if (res?.data?.status?.code === 200) {
+      localStorage.setItem('resumeParserData', JSON.stringify({
+        data: res.data,
+        url: url,
+        filename: filename,
+        id: Date.now() + 'resumeParserData'
+      }))
+      // 路由跳转
+      // talentMap/talentMap/detail
+      push({ name: 'TalentMapDetail' })
+    }
+  }
 }
 
 /** 初始化 **/