|
@@ -272,7 +272,8 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
{ value: 0, label: '开放问题' },
|
|
{ value: 0, label: '开放问题' },
|
|
{ value: 1, label: '单选题' },
|
|
{ value: 1, label: '单选题' },
|
|
{ value: 2, label: '多选题' },
|
|
{ value: 2, label: '多选题' },
|
|
- { value: 3, label: '色盲题' }
|
|
|
|
|
|
+ { value: 3, label: '色盲题' },
|
|
|
|
+ { value: 4, label: '得分题' }
|
|
]
|
|
]
|
|
}),
|
|
}),
|
|
form: {
|
|
form: {
|
|
@@ -287,13 +288,26 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
} else if (form.question_form === 2) {
|
|
} else if (form.question_form === 2) {
|
|
// 多选题
|
|
// 多选题
|
|
form.options = [{ option_text: '', is_correct: false, sort: 1 }, { option_text: '', is_correct: false, sort: 2 }];
|
|
form.options = [{ option_text: '', is_correct: false, sort: 1 }, { option_text: '', is_correct: false, sort: 2 }];
|
|
|
|
+ } else if (form.question_form === 4) {
|
|
|
|
+ // 心理评估题 - 初始化五个评分选项
|
|
|
|
+ form.options = [
|
|
|
|
+ { option_text: '无', score: 0, sort: 1 },
|
|
|
|
+ { option_text: '轻度', score: 1, sort: 2 },
|
|
|
|
+ { option_text: '中度', score: 2, sort: 3 },
|
|
|
|
+ { option_text: '偏重', score: 3, sort: 4 },
|
|
|
|
+ { option_text: '严重', score: 4, sort: 5 }
|
|
|
|
+ ];
|
|
|
|
+ // 初始化评分说明
|
|
|
|
+ if (!form.scoring_reference) {
|
|
|
|
+ form.scoring_reference = '该评分反映了症状表现的频率与严重程度。';
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
// 开放问题
|
|
// 开放问题
|
|
form.options = [];
|
|
form.options = [];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- helper: '选择题目的形式:开放问题、单选题或多选题',
|
|
|
|
|
|
+ helper: '选择题目的形式:开放问题、单选题、多选题、色盲题或心理评估题',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
position_types: {
|
|
position_types: {
|
|
@@ -573,7 +587,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
column: { show: false },
|
|
column: { show: false },
|
|
form: {
|
|
form: {
|
|
show: compute(({ form }) => {
|
|
show: compute(({ form }) => {
|
|
- return form && (form.question_form === 1 || form.question_form === 2);
|
|
|
|
|
|
+ return form && (form.question_form === 1 || form.question_form === 2 || form.question_form === 4);
|
|
}),
|
|
}),
|
|
component: {
|
|
component: {
|
|
name: 'el-card',
|
|
name: 'el-card',
|
|
@@ -584,6 +598,61 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
form.options = [];
|
|
form.options = [];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 心理评估题的选项渲染
|
|
|
|
+ if (form.question_form === 4) {
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <div class="option-header" style="display: flex; margin-bottom: 10px; font-weight: bold;">
|
|
|
|
+ <span style="flex: 1;">选项内容</span>
|
|
|
|
+ <span style="width: 120px; text-align: center;">分值</span>
|
|
|
|
+ </div>
|
|
|
|
+ {form.options.map((option: any, index: number) => (
|
|
|
|
+ <div class="option-item" key={index} style="display: flex; align-items: center; margin-bottom: 10px;">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model={option.option_text}
|
|
|
|
+ placeholder="请输入选项内容"
|
|
|
|
+ style="flex: 1; margin-right: 10px;"
|
|
|
|
+ />
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model={option.score}
|
|
|
|
+ min={0}
|
|
|
|
+ max={10}
|
|
|
|
+ style="width: 120px;"
|
|
|
|
+ placeholder="分值"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ ))}
|
|
|
|
+ <div style="display: flex; justify-content: space-between; margin-top: 10px;">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ if (!form.options) {
|
|
|
|
+ form.options = [];
|
|
|
|
+ }
|
|
|
|
+ const sort = form.options.length > 0 ?
|
|
|
|
+ Math.max(...form.options.map((o: any) => o.sort || 0)) + 1 : 1;
|
|
|
|
+ form.options.push({ option_text: '', score: 0, sort });
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ 添加选项
|
|
|
|
+ </el-button>
|
|
|
|
+
|
|
|
|
+ {form.options.length > 2 && (
|
|
|
|
+ <el-button
|
|
|
|
+ type="danger"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ form.options.pop();
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ 删除最后一项
|
|
|
|
+ </el-button>
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 单选题和多选题的选项渲染(原有逻辑)
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<div class="option-header" style="display: flex; margin-bottom: 10px; font-weight: bold;">
|
|
<div class="option-header" style="display: flex; margin-bottom: 10px; font-weight: bold;">
|
|
@@ -670,12 +739,14 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
return '添加单选题的选项,并标记正确答案(只能有一个正确答案)';
|
|
return '添加单选题的选项,并标记正确答案(只能有一个正确答案)';
|
|
} else if (form.question_form === 2) {
|
|
} else if (form.question_form === 2) {
|
|
return '添加多选题的选项,并标记正确答案(可以有多个正确答案)';
|
|
return '添加多选题的选项,并标记正确答案(可以有多个正确答案)';
|
|
|
|
+ } else if (form.question_form === 4) {
|
|
|
|
+ return '添加心理评估题的选项,并设置每个选项的分值';
|
|
}
|
|
}
|
|
return '';
|
|
return '';
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- scoring_reference : {
|
|
|
|
|
|
+ scoring_reference: {
|
|
title: '备注',
|
|
title: '备注',
|
|
search: { show: false },
|
|
search: { show: false },
|
|
column: { show: false },
|
|
column: { show: false },
|
|
@@ -684,8 +755,19 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
name: 'el-input',
|
|
name: 'el-input',
|
|
type: 'textarea',
|
|
type: 'textarea',
|
|
rows: 4,
|
|
rows: 4,
|
|
- placeholder: '请输入答案解析'
|
|
|
|
|
|
+ placeholder: compute(({ form }) => {
|
|
|
|
+ if (form && form.question_form === 4) {
|
|
|
|
+ return '请输入评分标准说明';
|
|
|
|
+ }
|
|
|
|
+ return '请输入答案解析';
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
+ helper: compute(({ form }) => {
|
|
|
|
+ if (form && form.question_form === 4) {
|
|
|
|
+ return '评分标准说明,例如:该评分反映了症状表现的频率与严重程度。';
|
|
|
|
+ }
|
|
|
|
+ return '题目的答案解析或备注信息';
|
|
|
|
+ })
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
|