|
@@ -250,19 +250,18 @@ const fetchQuestionDetail = async (id: string | number) => {
|
|
|
questionForm.tags = questionData.tags || [];
|
|
|
const competencyTags = questionData.competency_tags || [];
|
|
|
questionForm.competency_tags = competencyTags;
|
|
|
- questionForm.options = questionData.options.map((el: any) => {
|
|
|
- if (el) { // 检查 el 是否存在
|
|
|
- el.text = el.option_text;
|
|
|
- }
|
|
|
- return el; // 确保返回元素
|
|
|
- })|| []; // 可选:过滤掉 undefined/null
|
|
|
questionForm.question_form = questionData.question_form;
|
|
|
questionForm.suggestedDuration = questionData.recommended_duration || 0;
|
|
|
questionForm.scoring_reference = questionData.scoring_reference || '';
|
|
|
questionForm.is_required_correct = questionData.is_required_correct
|
|
|
-
|
|
|
// 更新胜任力标签选择
|
|
|
competencyTagsValue.value = competencyTags.map((tag: any) => tag.id);
|
|
|
+ questionForm.options = questionData.options?.map((el: any) => {
|
|
|
+ if (el) { // 检查 el 是否存在
|
|
|
+ el.text = el.option_text;
|
|
|
+ }
|
|
|
+ return el; // 确保返回元素
|
|
|
+ })|| []; // 可选:过滤掉 undefined/null
|
|
|
} else {
|
|
|
ElMessage.warning('未找到问题详情数据');
|
|
|
}
|
|
@@ -508,15 +507,15 @@ const confirmAddQuestion = async () => {
|
|
|
category_id: questionForm.category,
|
|
|
tags: questionForm.tags,
|
|
|
competency_tags: questionForm.competency_tags,
|
|
|
- options: questionForm.options.map((el: any) => {
|
|
|
+ recommended_duration: questionForm.suggestedDuration,
|
|
|
+ scoring_reference: questionForm.scoring_reference,
|
|
|
+ is_required_correct: questionForm.is_required_correct,
|
|
|
+ options: questionForm.options?.map((el: any) => {
|
|
|
if (el) { // 检查 el 是否存在
|
|
|
el.option_text = el.text;
|
|
|
}
|
|
|
return el; // 确保返回元素
|
|
|
}),
|
|
|
- recommended_duration: questionForm.suggestedDuration,
|
|
|
- scoring_reference: questionForm.scoring_reference,
|
|
|
- is_required_correct: questionForm.is_required_correct
|
|
|
};
|
|
|
/* console.log(questionForm)
|
|
|
return */
|