|
@@ -37,19 +37,19 @@
|
|
|
<div class="flex-1">
|
|
|
<el-tabs type="border-card">
|
|
|
<el-tab-pane label="已解析人才列表">
|
|
|
- <div class="tagBox mb-10px" v-if="originData?.length">
|
|
|
+ <div class="tagBox mb-10px" v-if="tagList?.length">
|
|
|
<el-tag
|
|
|
:type="index === tagCurrentIndex ? 'primary' : 'info'"
|
|
|
size="large"
|
|
|
effect="plain"
|
|
|
- v-for="(val, index) in originData"
|
|
|
- :key="val.data.name_zh + index"
|
|
|
+ v-for="(val, index) in tagList"
|
|
|
+ :key="val.name + index"
|
|
|
class="mr-10px cursor-pointer"
|
|
|
- @click="handleTagClick(val, index)"
|
|
|
+ @click="handleTagClick(index)"
|
|
|
>
|
|
|
<div class="flex items-center">
|
|
|
<el-checkbox v-model="val.checked" />
|
|
|
- <span class="ml-5px">{{ val.data.name_zh }}</span>
|
|
|
+ <span class="ml-5px">{{ val.name }}</span>
|
|
|
<Icon icon="ep:view" class="ml-5px" />
|
|
|
</div>
|
|
|
</el-tag>
|
|
@@ -92,6 +92,7 @@ const emit = defineEmits(['refresh'])
|
|
|
const dialogVisible = ref(false)
|
|
|
const FormPageRef = ref(null)
|
|
|
const itemData = ref({})
|
|
|
+const tagList = ref([])
|
|
|
const tagCurrentIndex = ref(0)
|
|
|
const source = ref('')
|
|
|
const originData = ref([])
|
|
@@ -195,6 +196,7 @@ const resetData = () => {
|
|
|
fileUrl.value = null
|
|
|
itemData.value = {}
|
|
|
originData.value = []
|
|
|
+ tagList.value = []
|
|
|
}
|
|
|
|
|
|
// 打开弹窗
|
|
@@ -209,18 +211,14 @@ const open = async (task_name) => {
|
|
|
resetData()
|
|
|
source.value = task_type
|
|
|
const dataList = results.map(e => {
|
|
|
- if (source.value === '招聘') {
|
|
|
- return {
|
|
|
- ...e,
|
|
|
- data: e?.data?.normalized_data?.raw_data || {},
|
|
|
- checked: true
|
|
|
- }
|
|
|
- }
|
|
|
- return { ...e, checked: true }
|
|
|
+ if (source.value === '招聘') e.data = e?.data?.normalized_data?.raw_data || {}
|
|
|
+ // 切换标签
|
|
|
+ tagList.value.push({ name: e.data.name_zh, checked: true })
|
|
|
+ return e
|
|
|
})
|
|
|
originData.value = cloneDeep(dataList)
|
|
|
itemData.value = originData.value[0].data
|
|
|
- dealData(source.value, dataList[0]) // 赋值左侧原始文件
|
|
|
+ dealData(source.value, originData.value[0]) // 赋值左侧原始文件
|
|
|
dialogVisible.value = true
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
@@ -228,10 +226,12 @@ const open = async (task_name) => {
|
|
|
}
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
-const handleTagClick = (val, index) => {
|
|
|
+// 当前操作数据
|
|
|
+const handleTagClick = (index) => {
|
|
|
tagCurrentIndex.value = index
|
|
|
- itemData.value = val.data
|
|
|
- dealData(source.value, val)
|
|
|
+ const row = originData.value[tagCurrentIndex.value]
|
|
|
+ itemData.value = row.data
|
|
|
+ dealData(source.value, row)
|
|
|
}
|
|
|
|
|
|
// 监听表单变化,同步更新originData中对应的数据
|
|
@@ -246,7 +246,7 @@ watch(() => FormPageRef.value?.formQuery, (newVal) => {
|
|
|
// 入库
|
|
|
const handleStore = async () => {
|
|
|
// 验证originData数组中每个人才的name_zh字段,并处理mobile字段
|
|
|
- // const list = []
|
|
|
+ const results = [] // 只提交勾选的数据
|
|
|
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]
|
|
@@ -258,10 +258,10 @@ const handleStore = async () => {
|
|
|
if (Array.isArray(talent.data.mobile)) {
|
|
|
talent.data.mobile = talent.data.mobile.filter(i => Boolean(i)).map(j => String(j).replace(/,|,/g, '')).join(',');
|
|
|
}
|
|
|
- // list.push()
|
|
|
+ if (tagList.value[i].checked) results.push(talent) // 只提交勾选的数据
|
|
|
}
|
|
|
}
|
|
|
- console.log(originData.value, 'store')
|
|
|
+ // console.log(originData.value, 'store')
|
|
|
|
|
|
const loading = ElLoading.service({
|
|
|
lock: true,
|
|
@@ -274,7 +274,7 @@ const handleStore = async () => {
|
|
|
message: '处理完成',
|
|
|
data: {
|
|
|
...originParams.value,
|
|
|
- results: originData.value
|
|
|
+ results
|
|
|
},
|
|
|
}
|
|
|
await talentGatherApi.talentsAdd(JSON.stringify(params))
|