Selaa lähdekoodia

调试入库接口

lifanagju_citu 2 kuukautta sitten
vanhempi
commit
13553a3541

+ 10 - 0
src/api/menduner/system/talentMap/gather.ts

@@ -36,5 +36,15 @@ export const talentGatherApi = {
 			timeout: 300000,
 			baseURL: import.meta.env.VITE_BASE_URL
 		})
+	},
+
+	// 入库
+	talentsAdd: async (data: any) => {
+		return await request.post({
+			url: '/api/parse/add-parsed-talents',
+			data,
+			timeout: 300000,
+			baseURL: import.meta.env.VITE_BASE_URL
+		})
 	}
 }

+ 7 - 7
src/views/menduner/system/person/details/components/info.vue

@@ -5,7 +5,7 @@
         <el-image v-if="info.avatar" class="h-100px w-100px" :src="info.avatar" fit="contain" hide-on-click-modal :preview-src-list="[info.avatar]"/>
       </el-descriptions-item>
       <el-descriptions-item label="性别">
-        <dict-tag v-if="info.sex !== '0'" :type="DICT_TYPE.MENDUNER_SEX" :value="info.sex" />
+        <dict-tag v-if="info?.sex && info.sex !== '0'" :type="DICT_TYPE.MENDUNER_SEX" :value="info.sex" />
       </el-descriptions-item>
       <el-descriptions-item label="用户名">{{ info.name }}</el-descriptions-item>
       <el-descriptions-item label="英文名">{{ info.foreignName }}</el-descriptions-item>
@@ -14,22 +14,22 @@
       <el-descriptions-item label="出生日期">{{ formatDate(info.birthday, 'YYYY-MM-DD') }}</el-descriptions-item>
       <el-descriptions-item label="首次工作时间">{{ formatDate(info.firstWorkTime, 'YYYY-MM-DD') }}</el-descriptions-item>
       <el-descriptions-item label="婚姻状况">
-        <dict-tag :type="DICT_TYPE.MENDUNER_MARITAL_STATUS" :value="info.maritalStatus" />
+        <dict-tag v-if="info?.maritalStatus" :type="DICT_TYPE.MENDUNER_MARITAL_STATUS" :value="info.maritalStatus" />
       </el-descriptions-item>
       <el-descriptions-item label="学历">
-        <dict-tag :type="DICT_TYPE.MENDUNER_EDUCATION_TYPE" :value="info.eduType" />
+        <dict-tag v-if="info?.eduType" :type="DICT_TYPE.MENDUNER_EDUCATION_TYPE" :value="info.eduType" />
       </el-descriptions-item>
       <el-descriptions-item label="	工作经验">
-        <dict-tag :type="DICT_TYPE.MENDUNER_EXP_TYPE" :value="info.expType" />
+        <dict-tag v-if="info?.expType" :type="DICT_TYPE.MENDUNER_EXP_TYPE" :value="info.expType" />
       </el-descriptions-item>
       <el-descriptions-item label="求职类型">
-        <dict-tag :type="DICT_TYPE.MENDUNER_JOB_TYPE" :value="info.jobType" />
+        <dict-tag v-if="info?.jobType" :type="DICT_TYPE.MENDUNER_JOB_TYPE" :value="info.jobType" />
       </el-descriptions-item>
       <el-descriptions-item label="求职状态">
-        <dict-tag :type="DICT_TYPE.MENDUNER_JOB_SEEK_STATUS" :value="info.jobStatus" />
+        <dict-tag v-if="info?.jobStatus" :type="DICT_TYPE.MENDUNER_JOB_SEEK_STATUS" :value="info.jobStatus" />
       </el-descriptions-item>
       <el-descriptions-item label="账号状态">
-        <dict-tag :type="DICT_TYPE.MENDUNER_STATUS" :value="user.status" />
+        <dict-tag v-if="info?.status" :type="DICT_TYPE.MENDUNER_STATUS" :value="user.status" />
       </el-descriptions-item>
       <el-descriptions-item label="会员套餐">
         {{ user.vipFlag ? packageList.find(e => e.id === Number(user.vipFlag))?.name : '' }}

+ 62 - 35
src/views/menduner/system/talentMap/maintenance/gather/components/store.vue

@@ -80,6 +80,8 @@ import { cloneDeep } from 'lodash-es'
 import { marked } from 'marked'
 import data from './data.js'
 import { timesTampChange, timestampToAge } from '@/utils/transform/date'
+import { talentGatherApi } from '@/api/menduner/system/talentMap/gather'
+const message = useMessage() // 消息弹窗
 
 // 配置 marked
 // marked.setOptions({
@@ -200,24 +202,37 @@ const resetData = () => {
 }
 
 // 打开弹窗
-const open = async (type, list) => {
-  resetData()
-  source.value = type
-  const dataList = list.map(e => {
-    if (source.value === '招聘') {
-      return {
-        ...e,
-        data: e?.data?.normalized_data?.raw_data || {},
-        checked: true
+const originParams = ref(null)
+const resultsParams = ref({})
+const open = async (task_name) => {
+  try {
+    const res = await talentGatherApi.getTaskDetail(task_name)
+    const { task_type, parse_result } = res
+    const { results, summary, processed_time } = parse_result
+    originParams.value = { summary, processed_time }
+
+    resetData()
+    source.value = task_type
+    const dataList = results.map(e => {
+      if (source.value === '招聘') {
+        return {
+          ...e,
+          data: e?.data?.normalized_data?.raw_data || {},
+          checked: true
+        }
       }
-    }
-    return { ...e, checked: true }
-  })
-  originData.value = dataList
-  tagList.value = cloneDeep(dataList)
-	itemData.value = originData.value[0].data
-  dealData(type, originData.value[0]) // 赋值左侧原始文件
-  dialogVisible.value = true
+      return { ...e, checked: true }
+    })
+    
+    originData.value = dataList
+    resultsParams.value = {...dataList[0], data: null}
+    tagList.value = cloneDeep(dataList)
+    itemData.value = originData.value[0].data
+    dealData(source.value, originData.value[0]) // 赋值左侧原始文件
+    dialogVisible.value = true
+  } catch (error) {
+    console.log(error)
+  }
 }
 defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 
@@ -254,25 +269,37 @@ const handleStore = async () => {
   }
   console.log(originData.value, 'store')
 
-  // const loading = ElLoading.service({
-  //   lock: true,
-  //   text: '正在保存中...',
-  //   background: 'rgba(0, 0, 0, 0.7)',
-  // })
-  // try {
-  //   message.success('新增成功')
-  //   dialogVisible.value = false
-  //   // 刷新列表
-  //   emit('refresh')
-  //   if (result.code === 202 || result.message.includes('疑似重复')) {
-  //     if (!result.data?.main_card?.id) return
+  const loading = ElLoading.service({
+    lock: true,
+    text: '正在保存中...',
+    background: 'rgba(0, 0, 0, 0.7)',
+  })
+  try {
+    const params = {
+      success: true,
+      message: '处理完成',
+      data: {
+        ...originParams.value,
+        results: [{
+          ...resultsParams.value,
+          data: { ...itemData.value }
+        }]
+      },
+    }
+    await talentGatherApi.talentsAdd(JSON.stringify(params))
+    message.success('入库成功!')
+    dialogVisible.value = false
+    // 刷新列表
+    emit('refresh')
+    // 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)
-  //   }
-  // } finally {
-  //   loading.close()
-  // }
+    //   await message.confirm('发现与当前名片的疑似重复数据,去处理')
+    //   mergeFormRef.value.open(result.data?.main_card?.id)
+    // }
+  } finally {
+    loading.close()
+  }
 }
 </script>
 

+ 8 - 4
src/views/menduner/system/talentMap/maintenance/gather/index.vue

@@ -244,11 +244,15 @@ const handleWebAnalysis = (list) => {
 
 // 入库
 const StorePageRef = ref(null)
-const handleStore = async ({ task_type, task_name, parse_result }) => {
-  const { results } = parse_result
-  if (!results || !results.length) return message.warning('该任务无解析数据,无法入库')
+const handleStore = async (row) => {
+  // const { task_type, task_name, parse_result, summary, processed_time } = row
+  // const { results } = parse_result
+  // if (!results || !results.length) return message.warning('该任务无解析数据,无法入库')
 
-  StorePageRef.value.open(task_type, results)
+  // StorePageRef.value.open(task_type, results, { summary, processed_time })
+
+  if (!row?.task_name) return message.warning('该任务无解析数据,无法入库')
+  StorePageRef.value.open(row.task_name)
 }
 
 // 任务解析