yangg 1 tuần trước cách đây
mục cha
commit
a8b64a9078

+ 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.101: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'

+ 68 - 8
src/views/questionBank/positionList/components/editor.vue

@@ -57,7 +57,7 @@
               :max="100" 
               :step="1" 
               controls-position="right"
-              @change="(value) => handleWeightChange(index, value)"
+              @change="(value: number) => handleWeightChange(index, value)"
             /> %
           </div>
         </div>
@@ -123,7 +123,7 @@
             style="display: flex; align-items: center; margin-bottom: 10px;"
           >
             <el-input 
-              v-model="option.option_text" 
+              v-model="option.text" 
               placeholder="请输入选项内容" 
               style="flex: 1; margin-right: 10px;"
             />
@@ -308,14 +308,15 @@ const fetchQuestionDetail = async (id: string | number) => {
       questionForm.position = questionData.positions || [];
       questionForm.category = questionData.category_id || '';
       questionForm.tags = questionData.tags || [];
-      questionForm.competency_tags = questionData.competency_tags || [];
+      const competencyTags = questionData.competency_tags || [];
+      questionForm.competency_tags = competencyTags;
       questionForm.options = questionData.options || [];
       questionForm.question_form = questionData.question_form;
       questionForm.suggestedDuration = questionData.duration || 0;
       questionForm.scoring_reference = questionData.scoring_reference || '';
       
       // 更新胜任力标签选择
-      competencyTagsValue.value = questionData.competency_tags?.map((tag: any) => tag.id) || [];
+      competencyTagsValue.value = competencyTags.map((tag: any) => tag.id);
     } else {
       ElMessage.warning('未找到问题详情数据');
     }
@@ -331,6 +332,8 @@ watch(() => props.questionId, (newVal) => {
   fetchQuestionDetail(newVal);
 }, { immediate: true });
 
+
+
 // 加载初始数据
 onMounted(async () => {
   try {
@@ -398,6 +401,31 @@ const questionForm = reactive<QuestionForm>({
 const competencyTagsValue = ref<number[]>([])
 const competencyTagOptions = ref<CompetencyTag[]>([])
 
+// 监听胜任力标签选择变化
+watch(() => competencyTagsValue.value, (newVal) => {
+  if (!newVal) return;
+  
+  // 根据选中的ID更新competency_tags
+  questionForm.competency_tags = newVal.map(id => {
+    const tag = competencyTagOptions.value.find(t => t.id === id);
+    return {
+      id: tag?.id || 0,
+      name: tag?.name || '',
+      weight: tag?.weight || 0
+    };
+  });
+
+  // 如果有标签,自动平均分配权重
+  if (questionForm.competency_tags.length > 0) {
+    const averageWeight = Math.floor(100 / questionForm.competency_tags.length);
+    const remainder = 100 - (averageWeight * questionForm.competency_tags.length);
+    
+    questionForm.competency_tags.forEach((tag, index) => {
+      tag.weight = averageWeight + (index === 0 ? remainder : 0);
+    });
+  }
+});
+
 // 职位选项
 interface PositionOption {
   value: string
@@ -425,7 +453,38 @@ const getTotalWeight = () => {
 }
 
 const handleWeightChange = (index: number, value: number): void => {
-  // 实现权重调整逻辑
+  const tags = questionForm.competency_tags;
+  if (!tags || tags.length <= 1) return;
+
+  const oldWeight = tags[index].weight;
+  const weightDiff = value - oldWeight;
+  
+  // 如果权重差为0,不需要调整
+  if (weightDiff === 0) return;
+
+  // 计算其他标签的总权重
+  const otherTotalWeight = tags.reduce((sum, tag, i) => i !== index ? sum + tag.weight : sum, 0);
+  
+  // 如果其他标签总权重为0,平均分配剩余权重
+  if (otherTotalWeight === 0) {
+    const remainingWeight = 100 - value;
+    const averageWeight = Math.floor(remainingWeight / (tags.length - 1));
+    const remainder = remainingWeight - (averageWeight * (tags.length - 1));
+    
+    tags.forEach((tag, i) => {
+      if (i !== index) {
+        tag.weight = averageWeight + (i === 0 ? remainder : 0);
+      }
+    });
+  } else {
+    // 按比例调整其他标签的权重
+    tags.forEach((tag, i) => {
+      if (i !== index) {
+        const proportion = tag.weight / otherTotalWeight;
+        tag.weight = Math.max(0, Math.round(tag.weight - (weightDiff * proportion)));
+      }
+    });
+  }
 }
 
 const handleQuestionTypeChange = (value: string) => {
@@ -494,12 +553,13 @@ const confirmAddQuestion = async () => {
       positions: questionForm.position,
       category_id: questionForm.category,
       tags: questionForm.tags,
-      competency_tags: questionForm.competency_tags,
+      competency_tag_info: questionForm.competency_tags,
       options: questionForm.options,
-      duration: questionForm.suggestedDuration,
+      recommended_duration: questionForm.suggestedDuration,
       scoring_reference: questionForm.scoring_reference
     };
-
+/*     console.log(questionForm)
+return */
     // 发送请求
     try {
       const response = await api.UpdateObj(requestData);

+ 1 - 1
src/views/questionBank/positionList/crud.tsx

@@ -105,7 +105,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 			actionbar: {
 				buttons: {
 					add: {
-						show: true,
+						show: false,
 						text: '新增职位问题',
 						icon: 'Plus',
 						size: 'small',

+ 4 - 4
src/views/system/home/index.vue

@@ -57,11 +57,11 @@
 								style="margin-right: 5px; width: 120px;"
 								@change="handleFilterChange"
 							>
-								<el-option label="全部状态" value="" />
-								<el-option label="待面试" value="0" />
+								<!-- <el-option label="全部状态" value="" />
+								<el-option label="待面试" value="0" /> -->
 								<el-option label="已面试" value="2" />
 								<el-option label="已录用" value="3" />
-								<el-option label="已拒绝" value="4" />
+								<!-- <el-option label="已拒绝" value="4" /> -->
 							</el-select>
 							<el-select 
 								v-model="selectedPosition" 
@@ -131,7 +131,7 @@
 						<p style="margin-top: 20px; font-size: 12px;  color:#808080;">通过情况概览</p>
 						<div class="demo-collapse">
 							<el-collapse v-model="activeCollapse">
-								<el-collapse-item :title="`在此期间共计${Math.min(filteredCandidates.filter(c => Number(c.comprehensive_score) > 60).length, 5)} 位候选人通过面试`" name="1">
+								<el-collapse-item :title="`在此期间共计${Math.min(filteredCandidates.filter(c => Number(c.comprehensive_score) > 60).length, 5)} 位候选人${selectedStatus==2?'通过面试':'被录用'}`" name="1">
 									<div class="score-list">
 										<div class="score-item clickable-item" v-for="item in filteredCandidates.filter(c => Number(c.comprehensive_score) > 60).slice(0, 5)" :key="item.id" @click="handleCandidateClick(item)">
 											<div class="score-name">{{ item.applicant_name || item.name }}</div>

+ 3 - 1
src/views/system/personal/api.ts

@@ -1,6 +1,7 @@
 import { request } from '/@/utils/service';
 import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
 import { apiPrefix } from '/@/views/system/messageCenter/api';
+import { Session } from '/@/utils/storage';
 export function GetUserInfo(query: PageQuery) {
 	return request({
 		url: '/api/system/user/user_info/',
@@ -53,11 +54,12 @@ export function UpdatePassword(data: EditReq) {
  */
 export function uploadAvatar(data: AddReq) {
 	return request({
-		url: 'api/system/file/',
+		url: 'api/system/admin_upload/',
 		method: 'post',
 		data: data,
 		headers: {
 			'Content-Type': 'multipart/form-data',
+			'authorization':`JWT ${Session.get('token')}`
 		},
 	});
 }

+ 3 - 3
src/views/system/personal/index.vue

@@ -356,11 +356,11 @@ const settingPassword = () => {
 const uploadImg = (data: any) => {
 	let formdata = new FormData();
 	formdata.append('file', data);
+	formdata.append('tenant_id', Session.get('tenant_id'));
 	api.uploadAvatar(formdata).then((res: any) => {
-		if (res.code === 2000) {
 			selectImgVisible.value = false;
 			// state.personalForm.avatar = getBaseURL() + res.data.url;
-			state.personalForm.avatar = res.data.url;
+			state.personalForm.avatar = res.url;
 			api.updateUserInfo(state.personalForm).then((res: any) => {
 				successMessage('更新成功');
 				getUserInfo();
@@ -368,7 +368,7 @@ const uploadImg = (data: any) => {
 				// @ts-ignore
 				avatarSelectorRef.value.updateAvatar(state.personalForm.avatar);
 			});
-		}
+		
 	});
 };
 </script>