Переглянути джерело

修改候选人管理搜索

yangg 1 день тому
батько
коміт
26cab186e7

+ 1 - 1
src/views/JobApplication/list/api.ts

@@ -6,7 +6,7 @@ export function GetList(query: any) {
 	return request({
 		url: apiPrefix,
 		method: 'get',
-		params: {...query,tenant_id:1},
+		params: {...query ,pageSize:query.limit,tenant_id:1},
 	});
 }
 export function GetObj(id: InfoReq) {

+ 16 - 1
src/views/position/detail/api.ts

@@ -182,7 +182,22 @@ export function GetPositionQuestions(obj: AddReq) {
 		params: {...obj,tenant_id:1},
 	});
 }
-
+/* 创建胜任力标签 */
+export function CreateCompetency(obj: AddReq) {
+	return request({
+		url: '/api/system/competency/create',
+		method: 'post',
+		data: {...obj,tenant_id:1},
+	});
+}
+/* 绑定当前胜任力标签 */
+export function BatchUpdateTags(data: any) {
+	return request({
+		url: '/api/system/competency/batch_bind',
+		method: 'post',
+		data: {...data,tenant_id:1}
+	});
+}
 export function GetcategoryList(query: UserPageQuery) {
 	return request({
 		url: '/api/system/question_category/list',

+ 28 - 12
src/views/position/detail/index.vue

@@ -536,7 +536,7 @@
           </div>
             <div class="dimension-grid">
               <el-checkbox 
-               v-for="item in competencyTags.slice(10,20)" 
+               v-for="item in competencyTags.slice(10,50)" 
                 :key="item.id" 
                  v-model="item.selected"
                  @change="(val: boolean) => handleCompetencyChange(item, val)" 
@@ -2247,7 +2247,8 @@ import { GetCompetencyList,GetQuestionList,GenerateQuestions,
   CreateConfig,GetConfig,UpdateConfig,AddDocument,
   GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj,
   GenerateCompetency,SaveCompetency,GetPositionTags,
-  UpdateQuestion,GetPositionQuestions } from './api';
+  UpdateQuestion,GetPositionQuestions,CreateCompetency,
+  BatchUpdateTags} from './api';
 import draggable from 'vuedraggable';
 import { updateFieldConfig } from './utils';
 import type { ProfileFieldsConfig } from './types';
@@ -2316,7 +2317,7 @@ interface AIVideoStep {
 
 const router = useRouter();
 const route = useRoute();
-const positionId = ref(route.params.id as string);
+const positionId = ref(route.query.id as string);
 const positionStatus = ref(false);
 const drag = ref(false); // 添加拖拽状态变量
 
@@ -4539,7 +4540,7 @@ const editAIVideo = async (step: AIVideoStep) => {
     
     try {
       // 首先尝试获取已有的职位标签
-      const existingTags = await GetPositionTags({position_id:route.query.id,page:1,limit:20});
+      const existingTags = await GetPositionTags({position_id:route.query.id,page:1,limit:50});
       console.log('existingTags', existingTags);
       if (existingTags && existingTags.data && existingTags.data.items.length > 0) {
         // 如果存在已有标签,直接使用
@@ -4651,11 +4652,6 @@ const addDimension = async () => {
     return;
   }
   
- /*  if (!customDescription.value.trim()) {
-    ElMessage.warning('请输入特征描述');
-    return;
-  }
-   */
   // 检查维度名称是否已存在
   const existingDimension = competencyTags.value.find(tag => tag.name === customDimension.value.trim());
   if (existingDimension) {
@@ -4664,9 +4660,29 @@ const addDimension = async () => {
   }
   
   try {
+    // 1. 首先调用创建标签接口
+    const createResponse = await CreateCompetency({
+      name: customDimension.value.trim(),
+      description: customDescription.value.trim(),
+      importance: 1,
+      weight: 0
+    });
+
+    if (!createResponse.data) {
+      throw new Error('创建标签失败');
+    }
+
+    const newTagId = createResponse.data.id;
+
+    // 2. 调用绑定接口,将新创建的标签绑定到当前职位
+    await BatchUpdateTags({
+      tag_ids: [newTagId],
+      position_ids: [positionId.value]
+    });
+
     // 创建新的维度对象
     const newDimension = {
-      id: Date.now(), // 临时ID,实际应该从API返回
+      id: newTagId, // 使用API返回的真实ID
       name: customDimension.value.trim(),
       description: customDescription.value.trim(),
       selected: false,
@@ -4678,7 +4694,7 @@ const addDimension = async () => {
     // 将新维度添加到competencyTags数组中(添加到备选维度区域)
     competencyTags.value.push(newDimension);
     
-    ElMessage.success(`自定义维度"${newDimension.name}"已添加到备选维度列表`);
+   /*  ElMessage.success(`自定义维度"${newDimension.name}"已添加并绑定到当前职位`); */
     
     // 如果不是继续新增,则重置表单
     if (!continueAdd.value) {
@@ -4697,7 +4713,7 @@ const addDimension = async () => {
     console.error('添加自定义维度失败:', error);
     ElMessage.error('添加自定义维度失败,请重试');
   }
-};
+}
 
 // 删除自定义维度
 const deleteCustomDimension = (dimension: any) => {