Przeglądaj źródła

人才标注:获取当前人才的标签

Xiao_123 5 dni temu
rodzic
commit
b423f3609b

+ 22 - 12
src/views/recruit/enterprise/newTalentMap/labeling/index.vue

@@ -16,6 +16,12 @@
 				:showFixedLastItem="true"
 				itemKey="id"
 			>
+				<template #title_zh="{ item }">
+          <div v-ellipse-tooltip style="max-width: 250px;">{{ item.title_zh }}</div>
+        </template>
+        <template #hotel_zh="{ item }">
+          <div v-ellipse-tooltip style="max-width: 250px;">{{ item.hotel_zh }}</div>
+        </template>
 				<template #status="{ item }">
 					<v-chip size="small" variant="elevated" :color="item.status === 'active' ? 'primary' : 'error'">{{ item.status === 'active' ? '已启用' : '已禁用' }}</v-chip>
 				</template>
@@ -62,21 +68,23 @@
 						</div>
 						<div class="my-5">
 							<p>人才标签</p>
-							<v-chip
-								v-for="(item, index) in talentSelectedTags" :key="index"
-								class="chip mx-2 mt-4 cursor-pointer"
-								label color="primary"
-							>
-								{{ item.name }}
-								<v-icon size="18" color="primary" style="margin-left: 6px;" @click="closeClick(item)">mdi-close-circle</v-icon>
-							</v-chip>
+							<div v-if="talentSelectedTags?.length" class="mt-4 px-3 pb-3" style="border: 1px dashed #00B760; border-radius: 4px;">
+								<v-chip
+									v-for="(item, index) in talentSelectedTags" :key="index"
+									class="chip mr-3 mt-3 cursor-pointer"
+									label color="primary"
+								>
+									{{ item.name }}
+									<v-icon size="18" color="primary" style="margin-left: 6px;" @click="closeClick(item)">mdi-close-circle</v-icon>
+								</v-chip>
+							</div>
 
 							<div :class="{'mt-5': talentSelectedTags?.length > 0}">
 								<v-chip
 									v-for="(item, index) in tagList" :key="index"
-									class="chip mx-2 mt-4 cursor-pointer"
+									class="chip mr-3 mt-4 cursor-pointer"
 									label color="#248dbb"
-									:disabled="talentSelectedTags.includes(item)"
+									:disabled="talentSelectedTags.find(k => k.name === item.name)"
 									@click="handleAdd(item)"
 								>
 									<v-icon icon="mdi-plus" start></v-icon>
@@ -114,6 +122,7 @@ const loading = ref(false)
 const showDialog = ref(false)
 const items = ref([])
 const headers = [
+  // { title: 'ID', key: 'id', sortable: false },
   { title: '姓名', key: 'name_zh', sortable: false },
   // { title: '英文名', key: 'name_en', sortable: false },
   { title: '职位', key: 'title_zh', sortable: false },
@@ -208,7 +217,6 @@ const showPreview = ref(false)
 const annotationLoading = ref(false)
 const handleAnnotation = async (item) => {
 	if (!item || !item.id) return
-	talentSelectedTags.value = []
 	
 	talentItem.value = item
 	// 获取所有标签列表
@@ -222,7 +230,9 @@ const handleAnnotation = async (item) => {
 
 	// 获取人才标签
 	const tagData = await getTalentTagById(item.id)
-	console.log(tagData, '人才标签')
+	talentSelectedTags.value = tagData ? tagData.map((i) => {
+		return { id: i.talent, name: i.tag }
+	}) : []
 
 	showDialog.value = true
 }