This commit is contained in:
Denzel committed 2025-01-21 14:26:10 +03:00
1 parent 3f0a64bd47
commit 5578062bc8
1 file changed
+12 -5
+12 -5
View File
@@ -1,5 +1,7 @@
<template>
<v-container>
<v-card-title class="text-subtitle-1">Результат голосования: {{ title }}</v-card-title>
<v-card-subtitle class="text-subtitle-2">{{ description }}</v-card-subtitle>
<v-tabs v-model="activeTab" class="mb-4">
<v-tab
v-for="(question, questionIndex) in questions"
@@ -26,7 +28,7 @@
<v-row>
<!-- Победитель -->
<v-col cols="12">
<h3>{{ question.name }}</h3>
<h3 class="text-center">{{ question.name }}</h3>
<v-card-title class="d-flex ga-2 align-center">
<h4 class="text-teal-darken-4">Победитель:</h4>
<h3>{{ getWinner(question).employee?.fio || getWinner(question).name }} 🏆</h3>
@@ -37,7 +39,7 @@
</v-col>
<v-col cols="12">
<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">Топ {{ getTopResults(question).length }}</v-card-title>
<v-card-text>
<v-list style="max-height: 40vh; overflow-y: auto;">
<v-list-item
@@ -46,7 +48,7 @@
>
<p>
<strong>{{ answer.employee ? answer.employee.fio : answer.name }}</strong>: {{ answer.count }}
{{voteCount(answer.count)}}
{{ voteCount(answer.count) }}
<template v-if="answer.employee">
<br/>
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
@@ -80,6 +82,9 @@ export default {
const activeTab = ref(0);
const questions = computed(() => props.data.questions || []);
const title = props.data.name;
const description = props.data.description;
const getWinner = (question) => {
return question.answers.reduce(
(max, answer) => (answer.count > max.count ? answer : max),
@@ -105,7 +110,7 @@ export default {
const lastDigit = count % 10;
if (lastDigit === 1) currentVote = 'голос'
if (lastDigit > 1) currentVote = 'голоса'
if (lastDigit > 4 || count === 0) currentVote = 'голосов'
if (lastDigit > 4 || count === 0 || count === 11 || count === 12 || count === 13 || count === 14) currentVote = 'голосов'
return currentVote
}
@@ -116,7 +121,9 @@ export default {
getTopResults,
truncateText,
shouldShowTooltip,
voteCount
voteCount,
title,
description
};
},
};