fix [P-274]: В голосованиях связать клик по чекбоксу с ответом
This commit is contained in:
1 parent
2001c03820
commit
e9f36aa490
1 file changed
+16
-1
@@ -64,7 +64,7 @@
|
|||||||
{{ answer.employee?.fio || answer.name }}
|
{{ answer.employee?.fio || answer.name }}
|
||||||
|
|
||||||
<template v-slot:prepend="{ isSelected }">
|
<template v-slot:prepend="{ isSelected }">
|
||||||
<v-list-item-action start>
|
<v-list-item-action start @click.stop="toggleAnswer(question.id, answer.id)">
|
||||||
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
||||||
</v-list-item-action>
|
</v-list-item-action>
|
||||||
</template>
|
</template>
|
||||||
@@ -197,6 +197,20 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleAnswer = (questionId, answerId) => {
|
||||||
|
const currentAnswers = result.value[questionId];
|
||||||
|
const index = currentAnswers.indexOf(answerId);
|
||||||
|
|
||||||
|
if (index === -1) {
|
||||||
|
const question = props.data.questions.find(q => q.id === questionId);
|
||||||
|
if (currentAnswers.length < question.settings.multiChoice) {
|
||||||
|
currentAnswers.push(answerId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentAnswers.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const submitVote = () => {
|
const submitVote = () => {
|
||||||
let voteData = []
|
let voteData = []
|
||||||
for (let val of Object.values(result.value)) {
|
for (let val of Object.values(result.value)) {
|
||||||
@@ -263,6 +277,7 @@ export default {
|
|||||||
isCurrentQuestionAnswered,
|
isCurrentQuestionAnswered,
|
||||||
nextStep,
|
nextStep,
|
||||||
prevStep,
|
prevStep,
|
||||||
|
toggleAnswer,
|
||||||
submitVote,
|
submitVote,
|
||||||
isVoteSubmitted,
|
isVoteSubmitted,
|
||||||
result
|
result
|
||||||
|
|||||||
Reference in new issue
Block a user