Xiao_123 hai 2 meses
pai
achega
c75228353b

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

@@ -33,6 +33,7 @@ export const talentGatherApi = {
 		return await request.post({
 			url: '/api/parse/execute_parse_task',
 			data,
+			timeout: 300000,
 			baseURL: import.meta.env.VITE_BASE_URL
 		})
 	}

+ 57 - 17
src/views/menduner/system/talentMap/maintenance/gather/components/store.vue

@@ -43,13 +43,13 @@
                 size="large"
                 effect="plain"
                 v-for="(val, index) in tagList"
-                :key="val.name_zh + index"
+                :key="val.data.name_zh + index"
                 class="mr-10px cursor-pointer"
                 @click="handleTagClick(val, index)"
               >
                 <div class="flex items-center">
                   <el-checkbox v-model="val.checked" />
-                  <span class="ml-5px">{{ val.name_zh }}</span>
+                  <span class="ml-5px">{{ val.data.name_zh }}</span>
                   <Icon icon="ep:view" class="ml-5px" /> 
                 </div>
               </el-tag>
@@ -88,6 +88,7 @@ import { timesTampChange, timestampToAge } from '@/utils/transform/date'
 //   sanitize: false   // 不转义 HTML(如果需要渲染 HTML 标签)
 // })
 
+const emit = defineEmits(['refresh'])
 const dialogVisible = ref(false)
 const FormPageRef = ref(null)
 const itemData = ref({})
@@ -142,9 +143,9 @@ const showPage = (html) => {
 
 const dealData = async (type, data) => {
   if (['名片', '杂项'].includes(type)) {
-    imgUrl.value = data.pic_url
+    imgUrl.value = data.minio_path
   }
-  if (type === '简历') fileUrl.value = data.pic_url
+  if (type === '简历') fileUrl.value = data.minio_path
   
   if (type === '招聘') { // 门墩儿招聘-人员信息在组件中通过id和userId获取
     personId.value = data?.id || ''
@@ -199,12 +200,16 @@ const resetData = () => {
 }
 
 // 打开弹窗
-const open = async (type) => {
+const open = async (type, list) => {
   resetData()
   source.value = type
-  originData.value = TestData[type]
-  tagList.value = cloneDeep(originData.value)
-	itemData.value = originData.value[0]
+
+  const dataList = list.map(e => {
+    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
 }
@@ -212,21 +217,56 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 
 const handleTagClick = (val, index) => {
 	tagCurrentIndex.value = index
-	itemData.value = val
+	itemData.value = val.data
   dealData(source.value, val)
 }
 
 // 监听表单变化,同步更新originData中对应的数据
-// watch(() => FormPageRef.value?.formQuery, (newVal) => {
-//   if (tagCurrentIndex.value !== null && originData.value && originData.value.length > tagCurrentIndex.value) {
-//     // 保留原始pic_url
-//     const { pic_url } = originData.value[tagCurrentIndex.value]
-//     originData.value[tagCurrentIndex.value] = { ...newVal, pic_url }
-//   }
-// }, { deep: true })
+watch(() => FormPageRef.value?.formQuery, (newVal) => {
+  if (tagCurrentIndex.value !== null && originData.value && originData.value.length > tagCurrentIndex.value) {
+    // 保留原始pic_url
+    const { pic_url } = originData.value[tagCurrentIndex.value]
+    originData.value[tagCurrentIndex.value] = { ...newVal }
+  }
+}, { deep: true })
 
+// 入库
 const handleStore = async () => {
-	console.log(originData.value, 'store')
+  // 验证originData数组中每个人才的name_zh字段,并处理mobile字段
+  if (originData.value && Array.isArray(originData.value) && originData.value.length > 0) {
+    for (let i = 0; i < originData.value.length; i++) {
+      const talent = originData.value[i]
+      if (!talent.name_zh || talent.name_zh.trim() === '') {
+        return message.warning(`第${i + 1}个人才中的中文姓名未填写,请完善后再进行保存`)
+      }
+      
+      // 处理mobile字段,如果是数组则转换为字符串
+      if (Array.isArray(talent.mobile)) {
+        talent.mobile = talent.mobile.filter(i => Boolean(i)).map(j => String(j).replace(/,|,/g, '')).join(',');
+      }
+    }
+  }
+  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
+      
+  //     await message.confirm('发现与当前名片的疑似重复数据,去处理')
+  //     mergeFormRef.value.open(result.data?.main_card?.id)
+  //   }
+  // } finally {
+  //   loading.close()
+  // }
 }
 </script>
 

+ 21 - 6
src/views/menduner/system/talentMap/maintenance/gather/index.vue

@@ -49,12 +49,13 @@
       <el-table-column label="操作" align="center" fixed="right" min-width="110">
         <template #default="scope">
           <el-button
+            v-if="scope.row.task_status === '待解析'"
             link
             type="success"
-            :disabled="scope.row.task_status !== '待解析'"
             @click="handleAnalysis(scope.row)"
           >解析</el-button>
           <el-button
+            v-if="scope.row.task_status === '成功' && scope.row.parse_result"
             link
             type="primary"
             @click="handleStore(scope.row)"
@@ -243,15 +244,28 @@ const handleWebAnalysis = (list) => {
 
 // 入库
 const StorePageRef = ref(null)
-const handleStore = async ({ task_type, task_name }) => {
-  StorePageRef.value.open(task_type)
-  // const data = await talentGatherApi.getTaskDetail(row.task_name)
+const handleStore = async ({ task_type, task_name, parse_result }) => {
+  // console.log(parse_result, 'parse_result')
+  // const data = await talentGatherApi.getTaskDetail(task_name)
   // console.log(data, '任务详情')
+
+  const { results } = parse_result
+  if (!results || !results.length) return message.warning('该任务无解析数据,无法入库')
+
+  StorePageRef.value.open(task_type, results)
 }
 
 // 任务解析
 const handleAnalysis = async ({ task_type, id, task_source }) => {
   if (!id) return
+  await message.confirm('是否解析当前任务?')
+
+  const loading = ElLoading.service({
+    lock: true,
+    text: '提交解析任务中...',
+    background: 'rgba(0, 0, 0, 0.7)',
+  })
+
   const params = {
     task_type,
     id,
@@ -260,11 +274,12 @@ const handleAnalysis = async ({ task_type, id, task_source }) => {
   if (task_type === '杂项') params.process_type = 'table'
   if (task_type === '新任命') params.publish_time = '2025-07-17'
   try {
-    await message.confirm('是否解析当前任务?')
     await talentGatherApi.taskAnalysis(params)
     message.success('操作成功,任务解析中')
     getList()
-  } finally {}
+  } finally {
+    loading.close()
+  }
 }
 
 // 关闭上传弹窗