浏览代码

在职职位、意向职位及企业解析快速填写

lifanagju_citu 4 月之前
父节点
当前提交
346998a417
共有 2 个文件被更改,包括 16 次插入13 次删除
  1. 11 2
      src/components/FormUI/combobox/index.vue
  2. 5 11
      src/plugins/dialogExtend/components/infoForm.vue

+ 11 - 2
src/components/FormUI/combobox/index.vue

@@ -23,7 +23,7 @@
 </template>
 <script setup>
 import { debounce } from 'lodash'
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
 defineOptions({ name:'FormUI-v-combobox'})
 
 const props = defineProps({item: Object, modelValue: [String, Number]})
@@ -31,7 +31,16 @@ const emit = defineEmits(['update:modelValue', 'change', 'search'])
 const item = props.item
 const searchDebouncedTime = item.searchDebouncedTime === 0 ? 0 : 500
 
-const value = ref(props.modelValue)
+const value = ref()
+watch(
+  () => props.modelValue,
+  (newVal) => {
+    value.value = newVal
+  },
+  { immediate: true },
+  { deep: true }
+)
+
 const modelValueUpDate = (val) => {
   value.value = val
   emit('update:modelValue', value.value)

+ 5 - 11
src/plugins/dialogExtend/components/infoForm.vue

@@ -62,7 +62,7 @@ import { uploadFile } from '@/api/common'
 import Snackbar from '@/plugins/snackbar'
 import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
 import uploadForm from './upload.vue'
-import { analyzeTestData } from './analyzeTestData.js'
+// import { analyzeTestData } from './analyzeTestData.js'
 
 
 const props = defineProps({
@@ -77,12 +77,10 @@ let query = reactive({})
 
 // 企业名称下拉列表
 let enterpriseName = null
-// const enterpriseNameInput = ref('')
 const getEnterpriseData = async (name) => {
   const item = items.value.options.find(e => e.key === 'enterpriseId')
   if (!item) return
   if (item.items?.length && (enterpriseName === name)) return // 防抖
-  // item[item.itemTextName] = 
   enterpriseName = name
   if (name === null || name === '') { item.items = [] }
   else {
@@ -288,7 +286,6 @@ const openFileInput = () => {
 // 上传头像
 const accept = ['jpg', 'png', 'jpeg']
 const handleUploadFile = async (e) => {
-  console.log('handleUploadFile:', e)
   const file = e.target.files[0]
   if (!file) return
 
@@ -333,7 +330,6 @@ const getDictData = async (dictTypeName, key) => {
     const apiType = dictTypeName === 'positionSecondData' ? 'positionSecondData' : 'dict'
     const { data } = await getDict(dictTypeName, apiType === 'dict' ? null : {}, apiType)
     item.items = data
-    // console.log(dictTypeName, '字典内容', data)
   }
 }
 
@@ -341,8 +337,8 @@ const userInfo = ref(localStorage.getItem('userInfo') ? JSON.parse(localStorage.
 const baseInfo = ref(localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')) : {})
 items.value.options.forEach((e) => {
   if (e.dictTypeName) getDictData(e.dictTypeName, e.key) // 查字典set options
-  if (baseInfo.value && baseInfo.value[e.key]) e.value = baseInfo.value[e.key] // 人才信息回显
   if (userInfo.value && userInfo.value[e.key]) e.value = userInfo.value[e.key] // 人才信息回显
+  if (baseInfo.value && baseInfo.value[e.key]) e.value = baseInfo.value[e.key] // 人才信息回显
   if (e.key === 'sex' && e.value === '0') e.value = e.default
   if (setInfo.value[e.key]) e.value = setInfo.value[e.key]
 })
@@ -389,17 +385,15 @@ const getQuery = async () => {
 
 // 填充
 const handleAnalyzeFill = (data) => {
-  const person = data?.person || null
-  if (!person && !Object.keys(person).length) return Snackbar.warning('无可用内容!')
+  const person = data?.person || {}
+  if (!Object.keys(person).length) return Snackbar.warning('无可用内容!')
   if (data.lastEmployed) {
     if (data.lastEmployed.enterpriseName) person.enterpriseId = person.enterpriseName = data.lastEmployed.enterpriseName
     if (data.lastEmployed.positionName) person.positionId = person.positionName = positionName = data.lastEmployed.positionName
-    // console.log('person', person)
   }
   if (data.lastPositionId) person.interestedPositionList = [data.lastPositionId]
   items.value.options.forEach((e) => {
-    console.log(e.key, person[e.key])
-    if (person[e.key]) e.value = person[e.key]
+    if (e.key && person[e.key]) e.value = person[e.key]
   })
 }