добавление неголосов

This commit is contained in:
Denzel committed 2025-01-22 16:42:10 +03:00
1 parent d8cab54b05
commit e97aa94f97
1 file changed
+28 -15
+28 -15
View File
@@ -1,5 +1,5 @@
<template>
<v-container>
<v-container style="height: 85vh">
<div class="text-end">
<v-btn class="" color="red-darken-1" density="compact" icon="mdi-close-thick" size="small"
@click="$emit('closer')">
@@ -46,7 +46,7 @@
<v-card class="mb-4">
<v-card-title class="text-teal-darken-3">Топ {{ getTopResults(question).length }}</v-card-title>
<v-card-text>
<v-list style="max-height: 40vh; overflow-y: auto;">
<v-list style="max-height: 45vh; overflow-y: auto;">
<v-list-item
v-for="(answer, answerIndex) in getTopResults(question)"
:key="answerIndex"
@@ -88,18 +88,17 @@
</v-col>
</v-row>
</v-tabs-window-item>
<!-- Не голосовали -->
<!-- <v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">-->
<!-- <v-card-title class="text-red-darken-3">Не голосовали:</v-card-title>-->
<!-- <v-list style="max-height: 40vh; overflow-y: auto;">-->
<!-- <v-list-item-->
<!-- v-for="(answer, answerIndex) in getTopResults(question)"-->
<!-- :key="answerIndex"-->
<!-- >-->
<!-- {{answer.employee.fio}}-->
<!-- </v-list-item>-->
<!-- </v-list>-->
<!-- </v-tabs-window-item>-->
<v-tabs-window-item>
<v-card-title class="text-red-darken-3">Не голосовали:</v-card-title>
<v-card-item style="max-height: 60vh; overflow-y: auto;">
<template v-for="(voters, department) in groupedByDepartment" :key="department">
<v-list-item-subtitle>{{ department }}</v-list-item-subtitle>
<v-list-item v-for="(voter, voterIndex) in voters" :key="voterIndex">
{{ voter.fio }}
</v-list-item>
</template>
</v-card-item>
</v-tabs-window-item>
</v-tabs-window>
</v-container>
@@ -154,6 +153,7 @@ export default {
const title = props.data.name;
const description = props.data.description;
const nonVoters = props.data.nonvoting;
const getWinner = (question) => {
return question.answers.reduce(
@@ -196,6 +196,17 @@ export default {
activepick.value = val
}
const groupedByDepartment = computed(() => {
return nonVoters.reduce((groups, voter) => {
const department = voter.department || '';
if (!groups[department]) {
groups[department] = [];
}
groups[department].push(voter);
return groups;
}, {});
});
return {
activepick,
opendialog,
@@ -209,7 +220,9 @@ export default {
voteCount,
title,
description,
getPercentage
getPercentage,
nonVoters,
groupedByDepartment
};
},
};