lifanagju_citu 2 днів тому
батько
коміт
a9443cad90

+ 1 - 1
src/views/menduner/system/talentMap/maintenance/gather/components/webAnalysis.vue

@@ -10,7 +10,7 @@
 			<el-form-item label="url抓取数据" prop="urls">
 				<el-input
 					v-model="queryParams.urls"
-					class="!w-60vw"
+					class="!w-420px"
 					type="textarea"
 					:rows="1"
 					placeholder="请输入需要爬取的页面,多个页面请用 ',' 隔开"

+ 33 - 27
src/views/menduner/system/talentMap/maintenance/gather/index.vue

@@ -125,7 +125,7 @@
         <div class="analysisFile">
           <!-- 门墩儿人才库 -->
           <template v-if="radioValue === 'menduner'">
-            <Search @detail="handleDetail" detailButTxt="应用" :searchName="formData?.name_zh || formData?.name_en || ''" />
+            <Search @detail="handleDetail" :detailButTxt="detailButTxt" :searchName="formData?.name_zh || formData?.name_en || ''" />
           </template>
           <!-- 简历解析 -->
           <template v-if="radioValue === 'file'">
@@ -284,20 +284,20 @@ const handleDelete = async (id) => {
 const { push } = useRouter()
 const handleEdit = async (item) => {
   analysisType.value = 'edit'
-  // dealData(item)
   formData.value = item
-  cardUploadRow.value = null
-  cardImgUrl.value = null
+  radioValue.value = item.type || 'card' // menduner
   try {
-    if (!item?.image_path) {
-      dialog_analysisInfo.value = true
-      return
+    if (radioValue.value === 'card') {
+      if (!item?.image_path) {
+        cardUploadRow.value = null
+        cardImgUrl.value = null
+        dialog_analysisInfo.value = true
+        return
+      }
+      const data = await talentLabelingApi.getBusinessCardImage(item.image_path)
+      cardUploadRow.value = data?.type ? new File([data], item.image_path, { type: data.type }) : null
+      cardImgUrl.value = data?.type ? URL.createObjectURL(data) : null
     }
-    const data = await talentLabelingApi.getBusinessCardImage(item.image_path)
-    if (!data?.type) return
-
-    cardUploadRow.value = new File([data], item.image_path, { type: data.type })
-    cardImgUrl.value = URL.createObjectURL(data)
   } catch (error) {
     console.log('打印->getBusinessCardImage', error)
   } finally {
@@ -331,7 +331,7 @@ const analysisType = ref('')
 const FormPageRef = ref(null)
 const mergeFormRef = ref() // 合并表单 Ref
 const handleSave = async () => {
-  const params = { ...FormPageRef.value.formQuery }
+  const params = { ...FormPageRef.value.formQuery, type: radioValue.value }
   if (!params.name_zh) return message.warning('请填写姓名!')
   
   // 数组转为字符串保存
@@ -385,6 +385,7 @@ const handleAnalysis = async () => {
   // 开始解析
   analysisLoading.value = true
   cardFileQuery.value = null
+  formData.value = null
 	const type = radioValue.value
   try {
     // if (type === 'menduner') { // 门墩儿人才库
@@ -392,7 +393,7 @@ const handleAnalysis = async () => {
     if (type === 'file') { // 简历解析
       if (!fileUrl.value) return message.warning('获取文件失败,请重新上传!')
       const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
-      setItemDataValue(data)
+      resumeAnalysisToForm(data) // 简历解析
     } else if (type === 'card') { // 名片解析
       if (!cardImgUrl.value) {
         message.warning('请先上传名片!')
@@ -437,7 +438,7 @@ const handleChange = async (file) => {
     if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(true)
     message.warning('正在解析...')
     const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
-    setItemDataValue(data)
+    resumeAnalysisToForm(data) // 简历解析
     if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(false)
   }
 }
@@ -464,30 +465,25 @@ const handleResetUpload = async () => {
   fileUrl.value = ''
   data.value.path = ''
   fileList.value = []
-  setItemDataValue('reset')
-}
-
-// 名片解析 
-const createAnalysisNum = ref(0)
-const cardFileQuery = ref(null)
-const cardUploadRow = ref(null)
-const cardImgUrl = ref(null)
-const cardUploadChange = (raw) => {
-  cardUploadRow.value = raw
+  resumeAnalysisToForm('reset') // 简历解析
 }
 
+const detailButTxt = '应用'
 // 搜索-查看详情
 const handleDetail = async (userId) => {
   if (!userId) return message.warning('请先选择人才!')
   try {
     const data = await TalentMap.getTalentMapDetail(userId)
     // 去除id
-    setItemDataValue(data)
+    resumeAnalysisToForm(data) // 简历解析
+    message.success(`${detailButTxt}成功`)
   } catch {}
 }
 
-const setItemDataValue = (data) => {
+// 简历解析数据解构赋值
+const resumeAnalysisToForm = (data) => {
   if (data === 'reset') {
+    // 重置表单
     resumeTxt.value = ''
     if (FormPageRef.value?.resetFormData) FormPageRef.value.resetFormData()
   }
@@ -511,11 +507,21 @@ const setItemDataValue = (data) => {
   if (FormPageRef.value?.setFormData) FormPageRef.value.setFormData(formData.value)
 }
 
+// 名片解析 
+const createAnalysisNum = ref(0)
+const cardFileQuery = ref(null)
+const cardUploadRow = ref(null)
+const cardImgUrl = ref(null)
+const cardUploadChange = (raw) => {
+  cardUploadRow.value = raw
+}
+
 const DialogWidth = ref('500')
 const showWebAnalysis = ref(false)
 // 选择解析方式
 const handleSelect = () => {
   openSelect.value = false
+  formData.value = null
   showWebAnalysis.value = false
 	const type = radioValue.value
   if (type === 'card') {