|
@@ -1596,7 +1596,7 @@
|
|
|
<!-- <div class="panel-actions">
|
|
|
<el-button type="primary" size="small" @click="handleSaveFieldConfigToCache">保存到本地</el-button>
|
|
|
<el-button size="small" @click="clearFieldConfigCache">清除缓存</el-button>
|
|
|
- </div> -->
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
<div class="field-config-list">
|
|
|
<!-- 基本信息部分 -->
|
|
@@ -2449,7 +2449,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue';
|
|
|
+import { ref, reactive, onMounted, onUnmounted, computed, watch,nextTick } from 'vue';
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
import { ElMessage, ElMessageBox, ElDrawer } from 'element-plus';
|
|
|
import * as api from '../list/api';
|
|
@@ -2461,7 +2461,7 @@ import { GetCompetencyList,GetQuestionList,GenerateQuestions,
|
|
|
GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj,
|
|
|
GenerateCompetency,SaveCompetency,GetPositionTags,
|
|
|
UpdateQuestion,GetPositionQuestions,CreateCompetency,
|
|
|
- BatchUpdateTags,GetQuestionDetail,GetSelectedApplications} from './api';
|
|
|
+ BatchUpdateTags,GetQuestionDetail,GetSelectedApplications,DeleteSelectedApplications} from './api';
|
|
|
import draggable from 'vuedraggable';
|
|
|
import { updateFieldConfig } from './utils';
|
|
|
import type { ProfileFieldsConfig } from './types';
|
|
@@ -3357,12 +3357,25 @@ const deleteProcessStep = (step: any,index: number) => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- if(step.type=='psychological_problem'){ // 处理综合素质考察删除
|
|
|
+ if(step.type=='psychological_problem'){ // 心理测试
|
|
|
UpdateConfig({
|
|
|
id: getConfigId.value,
|
|
|
- enable_scoring_questions: false // 删除综合素质考察时,将enable_scoring_questions设置为false
|
|
|
+ enable_scoring_questions: false // 删除心理测试时,将enable_scoring_questions设置为false
|
|
|
}).then((res:any) => {
|
|
|
if(res.code == 2000) {
|
|
|
+ // 筛选出心理测试题目的position_id数组
|
|
|
+ const psychologicalTestIds = ApplicationsList.value
|
|
|
+ .filter(el => el.question_form === 4)
|
|
|
+ .map(el => el.question_id)
|
|
|
+ .filter(id => id !== undefined && id !== null); // 过滤无效值
|
|
|
+
|
|
|
+ // 只有当存在心理测试题目时才调用删除接口
|
|
|
+ if (psychologicalTestIds.length > 0) {
|
|
|
+ DeleteSelectedApplications({
|
|
|
+ position_id: route.query.id,
|
|
|
+ question_id: psychologicalTestIds
|
|
|
+ });
|
|
|
+ }
|
|
|
ElMessage.success('删除成功');
|
|
|
} else {
|
|
|
ElMessage.error('删除失败');
|
|
@@ -3379,6 +3392,18 @@ const deleteProcessStep = (step: any,index: number) => {
|
|
|
}).then((res:any) => {
|
|
|
if(res.code == 2000) {
|
|
|
ElMessage.success('删除成功');
|
|
|
+ // 筛选出心理测试题目的position_id数组
|
|
|
+ const psychoTestIds = ApplicationsList.value
|
|
|
+ .filter(el => el.question_form !== 4&&el.question_form !== 0)
|
|
|
+ .map(el => el.question_id)
|
|
|
+ .filter(id => id !== undefined && id !== null); // 过滤无效值
|
|
|
+ // 只有当存在心理测试题目时才调用删除接口
|
|
|
+ if (psychoTestIds.length > 0) {
|
|
|
+ DeleteSelectedApplications({
|
|
|
+ position_id: route.query.id,
|
|
|
+ question_id: psychoTestIds
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
ElMessage.error('删除失败');
|
|
|
}
|
|
@@ -4277,14 +4302,33 @@ const deleteQuestion = (index: number) => {
|
|
|
ElMessage.success('删除成功');
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+const refreshPage = () => {
|
|
|
+ window.location.reload();
|
|
|
+};
|
|
|
// 取消资料收集配置
|
|
|
const cancelDataCollection = () => {
|
|
|
- // 重置为默认配置
|
|
|
+ // 恢复到备份的原始配置,如果没有备份则使用默认配置
|
|
|
+if (originalFieldConfig.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ Object.assign(fieldConfig, originalFieldConfig.value);
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(fieldConfig);
|
|
|
+} else {
|
|
|
+ nextTick(() => {
|
|
|
Object.assign(fieldConfig, JSON.parse(JSON.stringify(defaultConfig)));
|
|
|
+ })
|
|
|
+ console.log('使用默认配置');
|
|
|
+}
|
|
|
+
|
|
|
+// 清理备份并重新启用自动保存
|
|
|
+ originalFieldConfig.value = null;
|
|
|
+ enableAutoSave.value = true;
|
|
|
showDataCollectionDialog.value = false;
|
|
|
+
|
|
|
+ refreshPage()
|
|
|
// 重新获取职位详情数据
|
|
|
- getPositionDetail();
|
|
|
+ /* getPositionDetail(); */
|
|
|
// 重置表单
|
|
|
/* Object.assign(dataCollectionForm, {
|
|
|
isRequired: false,
|
|
@@ -4333,6 +4377,18 @@ const confirmDataCollection = () => {
|
|
|
cancelDataCollection();
|
|
|
};
|
|
|
|
|
|
+const ApplicationsList=ref([])
|
|
|
+const init= async()=>{
|
|
|
+ const response = await GetSelectedApplications({
|
|
|
+ page: 1,
|
|
|
+ limit: 100,
|
|
|
+ job_id: route.query.id });
|
|
|
+ if (response.data && response.data.items) {
|
|
|
+ ApplicationsList.value = response.data.items;
|
|
|
+ }
|
|
|
+ console.log( ApplicationsList.value)
|
|
|
+}
|
|
|
+
|
|
|
// 使用 onMounted 和 onUnmounted 钩子
|
|
|
onMounted(() => {
|
|
|
getPositionDetail();
|
|
@@ -4341,6 +4397,7 @@ onMounted(() => {
|
|
|
getPosList()
|
|
|
// 初始化配置状态
|
|
|
initializeConfigState();
|
|
|
+ init()
|
|
|
});
|
|
|
|
|
|
// 组件销毁时清理轮询
|
|
@@ -5027,6 +5084,9 @@ const saveCompetency = async () => {
|
|
|
const currentEditingStep = ref<AIVideoStep | null>(null);
|
|
|
/* 获取已配置ID */
|
|
|
const getConfigId =ref(0)
|
|
|
+const originalFieldConfig=ref(null)
|
|
|
+// 禁用自动保存,防止修改被写入缓存
|
|
|
+const enableAutoSave= ref(false);
|
|
|
// 编辑AI考察
|
|
|
const editAIVideo = async (step: AIVideoStep) => {
|
|
|
// 添加资料收集类型的处理
|
|
@@ -5034,6 +5094,9 @@ const editAIVideo = async (step: AIVideoStep) => {
|
|
|
const response = await GetConfig(route.query.id);
|
|
|
if (response && response.data) {
|
|
|
getConfigId.value=response.data.id;
|
|
|
+ // 打开对话框前备份当前配置
|
|
|
+ originalFieldConfig.value = JSON.parse(JSON.stringify(fieldConfig));
|
|
|
+ console.log(originalFieldConfig.value);
|
|
|
updateFieldConfig(fieldConfig, response.data.profile_fields_config as ProfileFieldsConfig);
|
|
|
showDataCollectionDialog.value = true;
|
|
|
showOptionsMenu.value = false;
|
|
@@ -6253,7 +6316,6 @@ const getBasicFields = () => {
|
|
|
expected_salary: fieldConfig.expected_salary,
|
|
|
political_status:fieldConfig.political_status
|
|
|
};
|
|
|
- console.log(fieldConfig);
|
|
|
return basicFields;
|
|
|
};
|
|
|
|
|
@@ -6850,6 +6912,10 @@ watch(
|
|
|
watch(
|
|
|
fieldConfig,
|
|
|
(newConfig) => {
|
|
|
+ // 只在启用自动保存时才执行
|
|
|
+ if (!enableAutoSave.value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 防抖处理,避免频繁保存
|
|
|
if (saveConfigTimer.value) {
|
|
|
clearTimeout(saveConfigTimer.value);
|