Bladeren bron

修改标签

yangg 2 maanden geleden
bovenliggende
commit
383a73737f

+ 1 - 1
.env.development

@@ -6,7 +6,7 @@ ENV = 'development'
 # 本地环境接口地址 121.36.251.245
 
 
-VITE_API_URL = 'https://backend.qicai321.com'
+VITE_API_URL = 'http://192.168.100.187:8083'
 # VITE_API_URL = 'https://backend.qicai321.com'
 VITE_API_WX_URL='https://api.weixin.qq.com/'
 VITE_API_URL_MINLONG='http://117.185.80.170:7861'

+ 2 - 0
src/views/position/Jobcompetency/crud.tsx

@@ -254,6 +254,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					title: '创建时间',
 					type: 'datetime',
 					column: {
+						show:false,
 						minWidth: 160,
 					},
 					form: {
@@ -264,6 +265,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					title: '更新时间',
 					type: 'datetime',
 					column: {
+						show:false,
 						minWidth: 160,
 					},
 					form: {

+ 19 - 0
src/views/position/detail/api.ts

@@ -138,6 +138,25 @@ export function UpdateObj(obj: EditReq) {
 		data: {...obj,tenant_id: '1'},
 	});
 }
+/* 生成胜任力标签 */
+export function GenerateCompetency(obj: AddReq) {
+	return request({
+		url: '/competency/generate_from_position/',
+		method: 'post',
+		data: {...obj,tenant_id:"1"},
+		timeout: 0
+	});
+}
+/* 保存胜任力标签 */
+export function SaveCompetency(obj: AddReq) {
+	return request({
+		url: '/competency/save_position_tags/',
+		method: 'post',
+		data: {...obj,tenant_id:"1"},
+	});
+}
+
+
 export function GetcategoryList(query: UserPageQuery) {
 	return request({
 		url: '/api/system/question_category/list',

+ 10 - 0
src/views/position/detail/index.css

@@ -341,6 +341,16 @@
   height: calc(100% - 120px); /* 减去header和footer高度 */
   overflow-y: auto;
 }
+.ai-video-options-header{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.custom-btn{
+  background-color: #0017ab;
+  color: #fff;
+  border-color: #0017ab;
+}
 
 .drawer-footer {
   padding: 10px 20px;

+ 98 - 23
src/views/position/detail/index.vue

@@ -475,9 +475,17 @@
       </div>
 
       <!-- 步骤1:考察能力 -->
-      <div v-if="currentStep === 1" class="ai-video-content">
+      <div v-if="currentStep === 1" class="ai-video-content" v-loading="competencyLoading" element-loading-text="正在生成能力标签...">
         <div class="ai-video-options">
-          <p class="option-tip">AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</p>
+        <div class="ai-video-options-header">
+          <div class="ai-video-options-header-title">
+            <span>AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</span>
+          </div>
+          <div class="right_btn">
+            <el-button type="primary" class="custom-btn" plain size="small" @click="handleAddCompetency">重新生成</el-button>
+          </div>
+        </div>
+          <!-- <p class="option-tip">AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</p> -->
           
           <!-- <div class="new-feature-tip">
             下面是奇才智能算法推荐的胜任力考核维度,请结合您的需求增删,确认后点击「下一步」出题
@@ -490,7 +498,7 @@
            <!--  <h3>推荐考核维度</h3> -->
             <div class="dimension-grid" >
               <el-checkbox 
-                v-for="item in competencyTags" 
+                v-for="item in competencyTags.slice(0,10)" 
                 :key="item.id" 
                 v-model="item.selected"
                 @change="(val: boolean) => handleCompetencyChange(item, val)"
@@ -508,9 +516,16 @@
           <div class="optional-dimensions">
             <h3 style="color: #808080;">备选考核维度</h3>
             <div class="dimension-grid">
-              <el-checkbox v-model="aiVideoOptions.xxxx" label="XXXX"  class="custom-checkbox">
+              <el-checkbox 
+               v-for="item in competencyTags.slice(10,20)" 
+                :key="item.id" 
+                 v-model="item.selected"
+                 @change="(val: boolean) => handleCompetencyChange(item, val)" 
+                  class="custom-checkbox">
                 <div class="ability-label">
-                  <span>XXXX</span>
+                  <span>{{ item.name }}</span>
+                 
+                  <img src="../../../assets/sheng.png" alt="" class="sheng">
                 <!--   <el-tooltip content="考察候选人的XXXX能力" placement="top">
                     <el-icon><QuestionFilled /></el-icon>
                   </el-tooltip> -->
@@ -1844,7 +1859,7 @@ import { GetList } from '../../questionBank/classList/api';
 import { GetCompetencyList,GetQuestionList,GenerateQuestions,
   GetDraftList,SaveDraft,GetDigitalList,
   CreateConfig,GetConfig,UpdateConfig,AddDocument,
-  GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj } from './api';
+  GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj,GenerateCompetency,SaveCompetency } from './api';
 import draggable from 'vuedraggable';
 import { updateFieldConfig } from './utils';
 import type { ProfileFieldsConfig } from './types';
@@ -1951,6 +1966,23 @@ const processStepOptions = [
   { label: '打字测试', value: 'typing_test' } */
 ];
 
+const handleAddCompetency = () => {
+  competencyLoading.value = true;
+  GenerateCompetency({
+    position_id: positionId.value,
+  }).then((res:any) => {
+    res.data.forEach((item:any) => {
+          item.selected = false;
+        });
+    competencyTags.value = res.data;
+    console.log('res', res);
+    competencyLoading.value = false;
+  }).catch((err:any) => {
+    console.log('err', err);
+    competencyLoading.value = false;
+  })
+};
+
 /* 工作地点 */
 // 工作地点选项
 const locationOptions = getPCAData();
@@ -2613,19 +2645,41 @@ const nextStep = async () => {
     // 如果从第一步进入第二步,更新已选维度到 selectedAbilities
     if (currentStep.value === 1) {
       // 校验是否选择了胜任力标签
-      if (selectedDimensions.value.length === 0) {
+      const selectedTags = competencyTags.value.filter(tag => tag.selected);
+      if (selectedTags.length === 0) {
         ElMessage.warning('请至少选择一个胜任力考核维度');
         return; // 阻止进入下一步
       }
-      
-      selectedAbilities.value = selectedDimensions.value.map(dimension => ({
-        label: dimension.name,
-        value: dimension.name.toLowerCase().replace(/\s+/g, '_'),
-        description: dimension.description,
-        level: 'CC', // 默认等级
-        expanded: false,
-        isNew: true
-      }));
+
+      try {
+        // 准备要保存的标签数据
+        const tagsToSave = selectedTags.map(tag => ({
+          name: tag.name,
+          description: tag.description, // 如果有描述字段可以添加
+          importance: tag.importance // 默认重要性
+        }));
+
+        // 调用保存接口
+        await SaveCompetency({
+          position_id: route.query.id,
+          tenant_id: "1",
+          tags: tagsToSave
+        });
+        
+        selectedAbilities.value = selectedTags.map(tag => ({
+          label: tag.name,
+          value: tag.name.toLowerCase().replace(/\s+/g, '_'),
+          description: tag.description, // 如果有描述字段可以添加
+          level: 'CC', // 默认等级
+          expanded: false,
+          isNew: true
+        }));
+
+      } catch (error) {
+        console.error('保存胜任力标签失败:', error);
+        ElMessage.error('保存胜任力标签失败');
+        return; // 如果保存失败,不进入下一步
+      }
     }
     // 如果从第二步进入第三步,分别处理AI生成和自定义选择的题目
     if (currentStep.value === 2) {
@@ -3573,10 +3627,10 @@ const getCompetencyList = async () => {
     const response = await GetCompetencyList({page:1,pageSize:1000});
     if (response && response.data) {
       // 为每个标签添加选中状态属性
-      competencyTags.value = response.data.items.map((item:any) => ({
+     /*  competencyTags.value = response.data.items.map((item:any) => ({
         ...item,
         selected: false
-      }));
+      })); */
     }
   } catch (error) {
     console.error('获取能力标签列表失败:', error);
@@ -3639,12 +3693,30 @@ const editAIVideo = async (step: AIVideoStep) => {
 
   if (step.name === 'AI视频') {
     const response = await GetConfig(route.query.id);
-    if (response && response.data) {
-      getConfigId.value=response.data.id;
+    competencyLoading.value = true;
+     currentEditingStep.value = step;
+        showAIVideoDialog.value = true;
+        currentStep.value = 1;
+    try {
+      const response2 = await GenerateCompetency({position_id:route.query.id});
+      console.log('response2', response2);
+      if (response && response.data) {
+        getConfigId.value=response.data.id;
+       
+      }
+      if(response2 && response2.data){
+        response2.data.forEach((item:any) => {
+          item.selected = false;
+        });
+        competencyTags.value = response2.data;
+      }
+    } catch (error) {
+      console.error('生成能力标签失败:', error);
+      ElMessage.error('生成能力标签失败');
+    } finally {
+      competencyLoading.value = false;
     }
-    currentEditingStep.value = step;
-    showAIVideoDialog.value = true;
-    currentStep.value = 1;
+    
     // 重置选项
     (Object.keys(aiVideoOptions) as Array<keyof typeof aiVideoOptions>).forEach(key => {
       aiVideoOptions[key] = false;
@@ -4867,6 +4939,9 @@ const handleQuestionTypeChange = (value: string) => {
   }
 };
 
+// 添加状态变量
+const competencyLoading = ref(false);
+
 </script>
 
 <style scoped>