|
@@ -416,7 +416,9 @@ import { Document, Delete, View, Printer, Search, Link } from '@element-plus/ico
|
|
import { successNotification } from '/@/utils/message';
|
|
import { successNotification } from '/@/utils/message';
|
|
import DocumentTreeCom from './components/DocumentTreeCom/index.vue';
|
|
import DocumentTreeCom from './components/DocumentTreeCom/index.vue';
|
|
import DocumentFormCom from './components/DocumentFormCom/index.vue';
|
|
import DocumentFormCom from './components/DocumentFormCom/index.vue';
|
|
-import { GetDocumentTree, DeleteDocumentCategory, UpdateDocument ,UpdateSequence, GetInterviewQuestions,AddDocument } from './api';
|
|
|
|
|
|
+import { GetDocumentTree, DeleteDocumentCategory, UpdateDocument ,UpdateSequence, GetInterviewQuestions,AddDocument,
|
|
|
|
+ GetCategoryList, GetTagList
|
|
|
|
+ } from './api';
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
/* import { print } from '/@/utils/print'; */
|
|
/* import { print } from '/@/utils/print'; */
|
|
|
|
|
|
@@ -809,6 +811,13 @@ const getTreeData = () => {
|
|
GetDocumentTree({}).then((ret: any) => {
|
|
GetDocumentTree({}).then((ret: any) => {
|
|
console.log('ret', ret);
|
|
console.log('ret', ret);
|
|
const responseData = ret.data;
|
|
const responseData = ret.data;
|
|
|
|
+ GetCategoryList({}).then((res: any) => {
|
|
|
|
+ console.log('res', res);
|
|
|
|
+ const categoryList = res.data.items;
|
|
|
|
+ GetTagList({}).then((res: any) => {
|
|
|
|
+ console.log('res', res);
|
|
|
|
+ const tagList = res.data.items;
|
|
|
|
+
|
|
// 创建根节点
|
|
// 创建根节点
|
|
const rootNode = [
|
|
const rootNode = [
|
|
{
|
|
{
|
|
@@ -816,7 +825,9 @@ const getTreeData = () => {
|
|
title: '职位开放题',
|
|
title: '职位开放题',
|
|
children: responseData.map((item: any) => ({
|
|
children: responseData.map((item: any) => ({
|
|
...item,
|
|
...item,
|
|
- title: item.name || item.title // 确保显示正确的标题
|
|
|
|
|
|
+ id: `open_${item.id}`, // 为职位开放题添加特定前缀
|
|
|
|
+ title: item.name || item.title,
|
|
|
|
+ question_type: 'open' // 添加类型标识
|
|
}))
|
|
}))
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -824,12 +835,22 @@ const getTreeData = () => {
|
|
title: '专业考察题库',
|
|
title: '专业考察题库',
|
|
children: responseData.map((item: any) => ({
|
|
children: responseData.map((item: any) => ({
|
|
...item,
|
|
...item,
|
|
- title: item.name || item.title // 确保显示正确的标题
|
|
|
|
|
|
+ id: `prof_${item.id}`, // 为专业考察题添加特定前缀
|
|
|
|
+ title: item.name || item.title,
|
|
|
|
+ question_type: 'professional' // 添加类型标识
|
|
}))
|
|
}))
|
|
},
|
|
},
|
|
- {
|
|
|
|
- id: 'common_questions',
|
|
|
|
- title: '常识题库',
|
|
|
|
|
|
+ ...categoryList.map((item: any) => ({
|
|
|
|
+ id: `category_${item.id}`,
|
|
|
|
+ title: item.name,
|
|
|
|
+ children: tagList.filter((tag: any) => tag.category_id === item.id).map((tag: any) => ({
|
|
|
|
+ id: `tag_${tag.id}`,
|
|
|
|
+ title: tag.name
|
|
|
|
+ }))
|
|
|
|
+ }))
|
|
|
|
+ /* {
|
|
|
|
+ id: categoryList.find((item: any) => item.name === '基本常识')?.id || '7',
|
|
|
|
+ title: categoryList.find((item: any) => item.name === '基本常识')?.name || '基本常识',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
id: 'psychology_questions',
|
|
id: 'psychology_questions',
|
|
@@ -848,9 +869,11 @@ const getTreeData = () => {
|
|
title: '明尼苏达多相人格测验',
|
|
title: '明尼苏达多相人格测验',
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ } */
|
|
]
|
|
]
|
|
documentTreeData.value = rootNode
|
|
documentTreeData.value = rootNode
|
|
|
|
+ });
|
|
|
|
+ })
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
@@ -858,25 +881,34 @@ const getTreeData = () => {
|
|
const handleTreeClick = (record: any) => {
|
|
const handleTreeClick = (record: any) => {
|
|
console.log('record', record);
|
|
console.log('record', record);
|
|
|
|
|
|
|
|
+ // 获取当前节点ID并处理前缀
|
|
|
|
+ const currentNodeId = record?.currentNode?.id || '';
|
|
|
|
+ const originalId = currentNodeId.replace(/^(open_|prof_|category_|tag_)/, '');
|
|
|
|
+
|
|
// 保存当前选中的分类ID,如果ID不是数字则使用默认值1
|
|
// 保存当前选中的分类ID,如果ID不是数字则使用默认值1
|
|
- const currentNodeId = record?.currentNode?.id;
|
|
|
|
- selectedCategoryId.value = (!isNaN(Number(currentNodeId)) && currentNodeId !== null) ? currentNodeId : 1;
|
|
|
|
|
|
+ selectedCategoryId.value = (!isNaN(Number(originalId)) && originalId !== null) ? originalId : 1;
|
|
|
|
|
|
// 根据不同的问题类型设置question_form
|
|
// 根据不同的问题类型设置question_form
|
|
let question_form;
|
|
let question_form;
|
|
const firstLevelId = record?.firstLevel?.id;
|
|
const firstLevelId = record?.firstLevel?.id;
|
|
|
|
+ const nodeType = currentNodeId.startsWith('open_') ? 'open' :
|
|
|
|
+ currentNodeId.startsWith('prof_') ? 'professional' :
|
|
|
|
+ currentNodeId.startsWith('category_') ? 'category' :
|
|
|
|
+ currentNodeId.startsWith('tag_') ? 'tag' :
|
|
|
|
+ firstLevelId;
|
|
|
|
+
|
|
|
|
|
|
- if (firstLevelId === 'root') {
|
|
|
|
|
|
+ if (nodeType === 'open' || firstLevelId === 'root') {
|
|
question_form = '0'; // 职位开放题
|
|
question_form = '0'; // 职位开放题
|
|
} else if (firstLevelId === 'psychology_questions') {
|
|
} else if (firstLevelId === 'psychology_questions') {
|
|
question_form = '4'; // 心理题库
|
|
question_form = '4'; // 心理题库
|
|
} else if (firstLevelId === 'common_questions') {
|
|
} else if (firstLevelId === 'common_questions') {
|
|
question_form = '1'; // 常识题库
|
|
question_form = '1'; // 常识题库
|
|
- } else if (firstLevelId === 'professional_questions') {
|
|
|
|
- question_form = '2'; // 专业考察题库
|
|
|
|
- } else {
|
|
|
|
|
|
+ } else if (nodeType === 'professional' || firstLevelId === 'professional_questions') {
|
|
|
|
+ question_form = '1,2,3,4,6'; // 专业考察题库
|
|
|
|
+ } /* else {
|
|
question_form = '0'; // 默认为职位开放题
|
|
question_form = '0'; // 默认为职位开放题
|
|
- }
|
|
|
|
|
|
+ } */
|
|
|
|
|
|
// 重置上传文件状态
|
|
// 重置上传文件状态
|
|
uploadedFile.value = null;
|
|
uploadedFile.value = null;
|
|
@@ -886,7 +918,9 @@ const handleTreeClick = (record: any) => {
|
|
form: {
|
|
form: {
|
|
limit: 100,
|
|
limit: 100,
|
|
job_id: selectedCategoryId.value,
|
|
job_id: selectedCategoryId.value,
|
|
- question_form: question_form
|
|
|
|
|
|
+ question_form: question_form,
|
|
|
|
+ ...(nodeType === 'category' ? { category: originalId } : {}),
|
|
|
|
+ ...(nodeType === 'tag' ? { tag: originalId } : {})
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1556,6 +1590,7 @@ const bindParentQuestion = (row: any) => {
|
|
position: relative;
|
|
position: relative;
|
|
border-radius: 0 8px 8px 0;
|
|
border-radius: 0 8px 8px 0;
|
|
margin-right: 10px;
|
|
margin-right: 10px;
|
|
|
|
+ overflow-y: auto;
|
|
}
|
|
}
|
|
|
|
|
|
.document-right-box {
|
|
.document-right-box {
|