yangg 2 kuukautta sitten
vanhempi
sitoutus
05eea93d45

+ 87 - 5
src/views/questionBank/list/crud.tsx

@@ -272,7 +272,8 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 							{ value: 0, label: '开放问题' },
 							{ value: 1, label: '单选题' },
 							{ value: 2, label: '多选题' },
-							{ value: 3, label: '色盲题' }
+							{ value: 3, label: '色盲题' },
+							{ value: 4, label: '得分题' }
 						]
 					}),
 					form: {
@@ -287,13 +288,26 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 								} else if (form.question_form === 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 {
 									// 开放问题
 									form.options = [];
 								}
 							}
 						},
-						helper: '选择题目的形式:开放问题、单选题或多选题',
+						helper: '选择题目的形式:开放问题、单选题、多选题、色盲题或心理评估题',
 					},
 				},
 				position_types: {
@@ -573,7 +587,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 					column: { show: false },
 					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: {
 							name: 'el-card',
@@ -584,6 +598,61 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 										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 (
 										<div>
 											<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 '添加单选题的选项,并标记正确答案(只能有一个正确答案)';
 							} else if (form.question_form === 2) {
 								return '添加多选题的选项,并标记正确答案(可以有多个正确答案)';
+							} else if (form.question_form === 4) {
+								return '添加心理评估题的选项,并设置每个选项的分值';
 							}
 							return '';
 						})
 					}
 				},
-				scoring_reference : {
+				scoring_reference: {
 					title: '备注',
 					search: { show: false },
 					column: { show: false },
@@ -684,8 +755,19 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 							name: 'el-input',
 							type: 'textarea',
 							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 '题目的答案解析或备注信息';
+						})
 					},
 				},
 				

+ 4 - 3
src/views/questionBank/positionList/crud.tsx

@@ -216,7 +216,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						show: false
 					},
 				},
-				question_type: {
+				/* question_type: {
 					title: '问题类型',
 					search: { show: true },
 					type: 'dict-select',
@@ -238,7 +238,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						helper: '选择问题的类型分类',
 						show: false
 					},
-				},
+				}, */
 				question_form: {
 					title: '题目形式',
 					search: { show: true },
@@ -251,7 +251,8 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 							{ value: 0, label: '开放问题' },
 							{ value: 1, label: '单选题' },
 							{ value: 2, label: '多选题' },
-							{ value: 3, label:"色盲题"}
+							{ value: 3, label:"色盲题"},
+							{ value:4,label:"得分题"}
 						]
 					}),
 					form: {