Kaynağa Gözat

恢复旧版本

Xiao_123 1 hafta önce
ebeveyn
işleme
31b48512f2

+ 52 - 51
src/views/menduner/system/talentMap/maintenance/gather/index.vue

@@ -71,7 +71,7 @@
     </Dialog>
 
     <!-- 解析文件上传 -->
-    <Dialog :title="radioObject[radioValue]" v-model="dialog_upload" :modalClose="false" :width="DialogWidth" @close="handleCancel">
+    <Dialog :title="radioObject[radioValue]" v-model="dialog_upload" :width="DialogWidth" @close="handleCancel">
       <div>
         <!-- 简历解析 -->
         <template v-if="radioValue === 'file'">
@@ -81,6 +81,7 @@
             :action="uploadUrl"
             :auto-upload="false"
             :data="fileData"
+            :limit="1"
             :on-change="handleChange"
             :on-error="submitFormError"
             :on-exceed="handleExceed"
@@ -88,7 +89,6 @@
             :http-request="httpRequest"
             accept=".pdf, doc, .docx"
             drag
-            multiple
             class="flex-1"
           >
             <i class="el-icon-upload"></i>
@@ -102,26 +102,26 @@
         </template>
         <!-- 名片解析 -->
         <template v-if="radioValue === 'card'">
-          <UploadImgs
+          <UploadImg
             v-model="cardImgUrl"
+            :limit="1"
             :uploadSuccessTip="false"
-            :limit="100"
             @handle-change="cardUploadChange"
-            height="150px" width="150px" style="margin: 20px auto; text-align: center;"
+            height="150px" width="150px" style="margin: 20px auto; width: 150px;"
           >
             <template #tip>{{ cardImgUrl ? '' : '请上传名片' }}</template>
-          </UploadImgs>
+          </UploadImg>
         </template>
         <template v-if="radioValue === 'picture'">
-          <UploadImgs
+          <UploadImg
             v-model="cardImgUrl"
+            :limit="1"
             :uploadSuccessTip="false"
-            :limit="100"
             @handle-change="cardUploadChange"
-            height="150px" width="150px" style="margin: 20px auto; text-align: center;"
+            height="150px" width="150px" style="margin: 20px auto; width: 150px;"
           >
             <template #tip>{{ cardImgUrl ? '' : '请上传图片' }}</template>
-          </UploadImgs>
+          </UploadImg>
         </template>
       </div>
       <template #footer>
@@ -173,7 +173,8 @@
               v-model:file-list="fileList"
               :action="uploadUrl"
               :auto-upload="false"
-              :data="fileData"
+              :data="data"
+              :limit="1"
               :on-change="handleChange"
               :on-error="submitFormError"
               :on-exceed="handleExceed"
@@ -181,7 +182,6 @@
               :http-request="httpRequest"
               accept=".pdf, doc, .docx"
               drag
-              multiple
               class="flex-1"
             >
               <i class="el-icon-upload"></i>
@@ -198,17 +198,18 @@
             <div class="image">
               <el-image v-if="cardImgUrl" class="!w-100%" :src="cardImgUrl" />
               <div v-else>
-                <UploadImgs
+                <UploadImg
                   v-model="cardImgUrl"
+                  :limit="1"
                   :uploadSuccessTip="false"
-                  :limit="100"
-                  drag buttonUpload
+                  drag
+                  buttonUpload
                   @handle-change="cardUploadChange"
                   height="32px" width="104px"
                   style="margin: 0 auto; width: 104px;margin-top: 40%;"
                 >
                   <template #tip>{{ cardImgUrl ? '' : '请上传名片' }}</template>
-                </UploadImgs>
+                </UploadImg>
               </div>
             </div>
           </template>
@@ -535,29 +536,31 @@ const handleAnalysis = async () => {
   formData.value = null
 	const type = radioValue.value
   try {
-    // if (type === 'file') { // 简历解析
-    //   if (!fileUrl.value) return message.warning('获取文件失败,请重新上传!')
-    //   const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
-    //   resumeAnalysisToForm(data) // 简历解析
-    // } else if (type === 'card') { // 名片解析
-    //   if (!cardImgUrl.value) {
-    //     message.warning('请先上传名片!')
-    //     return
-    //   }
-    //   cardFileQuery.value = new FormData()
-    //   cardFileQuery.value.append('image', cardUploadRow.value)
-    //   message.warning('正在解析...')
+    // if (type === 'menduner') { // 门墩儿人才库
+    // } else 
+    if (type === 'file') { // 简历解析
+      if (!fileUrl.value) return message.warning('获取文件失败,请重新上传!')
+      const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
+      resumeAnalysisToForm(data) // 简历解析
+    } else if (type === 'card') { // 名片解析
+      if (!cardImgUrl.value) {
+        message.warning('请先上传名片!')
+        return
+      }
+      cardFileQuery.value = new FormData()
+      cardFileQuery.value.append('image', cardUploadRow.value)
+      message.warning('正在解析...')
   
-    //   const index = createAnalysisNum.value
-    //   const res = await talentLabelingApi.businessCardParse(cardFileQuery.value)
-    //   if (index !== createAnalysisNum.value || !dialog_upload.value) return // 不是最新的名片解析数据(用户在解析完成前已重新上传)或用户已取消解析
-    //   formData.value = res?.data || res
-    //   message.success('名片解析成功')
-    // }
+      const index = createAnalysisNum.value
+      const res = await talentLabelingApi.businessCardParse(cardFileQuery.value)
+      if (index !== createAnalysisNum.value || !dialog_upload.value) return // 不是最新的名片解析数据(用户在解析完成前已重新上传)或用户已取消解析
+      formData.value = res?.data || res
+      message.success('名片解析成功')
+    }
+    // else if (type === 'web') {}
 
     dialog_upload.value = false
-    message.success('上传成功,请等待解析任务完成,解析完成后点击入库即可完成人才入库!')
-    // dialog_analysisInfo.value = true
+    dialog_analysisInfo.value = true
   } catch (error) {
     console.log('解析失败', error)
     cardFileQuery.value = null
@@ -582,19 +585,19 @@ const fileList = ref([])
 const fileData = ref({ path: '' })
 // 文件上传
 const handleChange = async (file) => {
-  // fileData.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
-  // if (dialog_analysisInfo.value) {
-  //   if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(true)
-  //   message.warning('正在解析...')
-  //   const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
-  //   resumeAnalysisToForm(data) // 简历解析
-  //   if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(false)
-  // }
+  fileData.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
+  if (dialog_analysisInfo.value) {
+    if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(true)
+    message.warning('正在解析...')
+    const data = await commonApi.resumeParser({ fileUrl: fileUrl.value })
+    resumeAnalysisToForm(data) // 简历解析
+    if (FormPageRef.value?.changeLoading) FormPageRef.value.changeLoading(false)
+  }
 }
 const submitFormError = () => {
   message.error('上传失败,请您重新上传!')
@@ -681,11 +684,9 @@ const handleSelect = () => {
   openSelect.value = false
   formData.value = null
   showWebAnalysis.value = false
-  DialogWidth.value = '500'
 	const type = radioValue.value
   if (type === 'card') {
     createAnalysisNum.value++
-  DialogWidth.value = '800'
   }
   if (type === 'menduner') {
     openSearch.value = true