fix(Design): 修复矩阵组件逻辑

- 修复矩阵组件中行和列索引的默认值设置
- 优化矩阵组件中行和列选项的获取逻辑- 添加 QuestionBefore 组件的立即验证功能
- 优化题前题后逻辑组件的显示控制
This commit is contained in:
陈昱达
2025-03-22 19:43:33 +08:00
parent d6a8c01d2d
commit 99b47e1862
5 changed files with 12 additions and 8 deletions

View File

@@ -133,6 +133,7 @@
<!-- 题前 题后逻辑 本来打算拆成两个 但是 只有最后的处理不一样-->
<div class="before-or-after">
<question-before
v-if="questionBeforeShow"
:skipType="skipType"
:activeQuestion="activeQuestion"
:questionsInfo="questionsInfo"

View File

@@ -19,7 +19,7 @@
v-model="logic.cell_index"
:options="getOptions('col')"
class="ml10"
@change="changeHanlde('col', getOptions('row'), $event)"
@change="changeHanlde('col', getOptions('col'), $event)"
></yl-select>
<yl-select v-model="logic.is_select" class="ml10" :options="chooseOptions"></yl-select>
@@ -42,11 +42,11 @@ const changeHanlde = (type, options, value) => {
return item.option_index === value;
});
if (type === 'row') {
logic.value.row_index = optionInfo?.option_index || 0;
logic.value.row_index = optionInfo?.option_index || null;
logic.value.relation_question_row_index = optionInfo?.parent_question_index || 0;
logic.value.row_type = optionInfo?.type || 0;
} else if (type === 'col') {
logic.value.cell_index = optionInfo?.option_index || 0;
logic.value.cell_index = optionInfo?.option_index || null;
logic.value.relation_question_cell_index = optionInfo?.parent_question_index || 0;
logic.value.cell_type = optionInfo?.type || 0;
}

View File

@@ -11,7 +11,7 @@
v-model="logic.cell_index"
:options="getOptions('col')"
class="ml10"
@change="changeHanlde('col', getOptions('row'), $event)"
@change="changeHanlde('col', getOptions('col'), $event)"
></yl-select>
<!--是否被选中-->
@@ -65,11 +65,11 @@ const changeHanlde = (type, options, value) => {
return item.option_index === value;
});
if (type === 'row') {
logic.value.row_index = optionInfo?.option_index || 0;
logic.value.row_index = optionInfo?.option_index || null;
logic.value.relation_question_row_index = optionInfo?.parent_question_index || 0;
logic.value.row_type = optionInfo?.type || 0;
} else if (type === 'col') {
logic.value.cell_index = optionInfo?.option_index || 0;
logic.value.cell_index = optionInfo?.option_index || null;
logic.value.relation_question_cell_index = optionInfo?.parent_question_index || 0;
logic.value.cell_type = optionInfo?.type || 0;
}

View File

@@ -49,11 +49,11 @@ const changeHanlde = (type, options, value) => {
return item.option_index === value;
});
if (type === 'row') {
logic.value.row_index = optionInfo?.option_index || 0;
logic.value.row_index = optionInfo?.option_index || null;
logic.value.relation_question_row_index = optionInfo?.parent_question_index || 0;
logic.value.row_type = optionInfo?.type || 0;
} else if (type === 'col') {
logic.value.cell_index = optionInfo?.option_index || 0;
logic.value.cell_index = optionInfo?.option_index || null;
logic.value.relation_question_cell_index = optionInfo?.parent_question_index || 0;
logic.value.cell_type = optionInfo?.type || 0;
}

View File

@@ -241,6 +241,9 @@ watch(
});
}
}
},
{
immediate: true
}
);