P-130 Места и не голосовали

This commit is contained in:
Denzel committed 2025-01-23 16:51:39 +03:00
1 parent 2e77a0b215
commit f03af6b262
1 file changed
+10 -7
+10 -7
View File
@@ -60,14 +60,15 @@
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
<v-card class="mb-4"> <v-card class="mb-4">
<v-card-title class="text-teal-darken-3">Топ {{ getTopResults(question).length }}</v-card-title> <v-card-title class="text-teal-darken-3">Распределение голосов:</v-card-title>
<v-card-text> <v-card-text>
<v-list style="max-height: 45vh; overflow-y: auto;"> <v-list style="max-height: 45vh; overflow-y: auto;">
<v-list-item <v-list-item
v-for="(answer, answerIndex) in getTopResults(question)" v-for="(answer, answerIndex) in getTopResults(question).filter(el => el.count > 0)"
:key="answerIndex" :key="answerIndex"
> >
<p> <p>
<strong class="mr-4">{{ answerIndex + 1 }}.</strong>
<v-avatar v-if="answer.file === null && answer.employee" <v-avatar v-if="answer.file === null && answer.employee"
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)" :image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
class="cursor-pointer" class="cursor-pointer"
@@ -105,10 +106,12 @@
</v-row> </v-row>
</v-tabs-window-item> </v-tabs-window-item>
<v-tabs-window-item> <v-tabs-window-item>
<NonVoteSad v-if="Object.keys(groupedByDepartment).length > 0" /> <NonVoteSad v-if="nonVoters.length > 0"/>
<v-card-title v-if="Object.keys(groupedByDepartment).length > 0" class="text-red-darken-3">Не голосовали:</v-card-title> <v-card-title v-if="nonVoters.length > 0" class="text-red-darken-3">Число сотрудников, которые не проголосовали
{{ nonVoters.length }}:
</v-card-title>
<v-card-item style="max-height: 50vh; overflow-y: auto;"> <v-card-item style="max-height: 50vh; overflow-y: auto;">
<NonVoteHappy v-if="Object.keys(groupedByDepartment).length < 1"/> <NonVoteHappy v-if="nonVoters.length < 1"/>
<template v-for="(voters, department) in groupedByDepartment" :key="department"> <template v-for="(voters, department) in groupedByDepartment" :key="department">
<v-list-item-title class="text-teal-darken-4">{{ department }}</v-list-item-title> <v-list-item-title class="text-teal-darken-4">{{ department }}</v-list-item-title>
<v-list-item v-for="(voter, voterIndex) in voters" :key="`${department}-${voterIndex}`"> <v-list-item v-for="(voter, voterIndex) in voters" :key="`${department}-${voterIndex}`">
@@ -119,9 +122,9 @@
@click="userCardIndex = `${department}-${voterIndex}`" @click="userCardIndex = `${department}-${voterIndex}`"
/> />
<InfoUserCard <InfoUserCard
:author="voter"
:opendialog="userCardIndex === `${department}-${voterIndex}`" :opendialog="userCardIndex === `${department}-${voterIndex}`"
@update:opendialog="userCardIndex = $event ? `${department}-${voterIndex}` : null" @update:opendialog="userCardIndex = $event ? `${department}-${voterIndex}` : null"
:author="voter"
/> />
<strong class="ml-4">{{ voter.fio }}</strong> <strong class="ml-4">{{ voter.fio }}</strong>
</p> </p>
@@ -263,7 +266,7 @@ export default {
const getWinnersByDepartment = (question) => { const getWinnersByDepartment = (question) => {
// Группируем ответы по департаментам // Группируем ответы по департаментам
const groupedByDepartment = question.answers.reduce((groups, answer) => { const groupedByDepartment = question.answers.reduce((groups, answer) => {
const department = answer.employee?.department || 'Без отдела'; // Отдел или 'Без отдела' если нет const department = answer.employee?.department;
if (!groups[department]) { if (!groups[department]) {
groups[department] = []; groups[department] = [];
} }