|
@@ -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>
|
|
|
|