Merge branch 'develop' into Vit
This commit is contained in:
commit
264c532915
4 files changed
+50
-17
No files matched your search
@@ -32,10 +32,9 @@
|
||||
</v-stepper-header>
|
||||
<v-stepper-window class="d-flex flex-column flex-fill">
|
||||
<v-stepper-window-item v-for="(question, index) in data.questions" :key="question.numb"
|
||||
:step="question.numb"
|
||||
class="">
|
||||
<div class="">
|
||||
<h3 class="text-center">{{ question.name }}</h3>
|
||||
:step="question.numb">
|
||||
<div>
|
||||
<h3 class="text-center">{{ question.name }} <span class="text-subtitle-1">(вариантов ответа: {{question.settings.multiChoice}})</span></h3>
|
||||
<v-row>
|
||||
<div class="v-col align-self-start">
|
||||
<v-img :src="question.file"
|
||||
@@ -63,7 +62,6 @@
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
|
||||
</div>
|
||||
</v-row>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-tabs v-model="activeTab" class="mb-4">
|
||||
<v-tab v-for="(question, questionIndex) in questions" :key="questionIndex">
|
||||
Опрос {{ question.numb }}: {{ question.name || 'Без названия' }}
|
||||
<v-tab
|
||||
v-for="(question, questionIndex) in questions"
|
||||
:key="questionIndex"
|
||||
>
|
||||
<template v-if="shouldShowTooltip(question.name || 'Без названия', 10)">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props">
|
||||
{{ truncateText(question.name || 'Без названия', 10) }}
|
||||
</span>
|
||||
</template>
|
||||
<span>{{ question.name || 'Без названия' }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ truncateText(question.name || 'Без названия', 10) }}</span>
|
||||
</template>
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
|
||||
@@ -11,6 +26,7 @@
|
||||
<v-row>
|
||||
<!-- Победитель -->
|
||||
<v-col cols="12">
|
||||
<h3>{{ 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>
|
||||
@@ -19,11 +35,9 @@
|
||||
Количество голосов: {{ getWinner(question)?.count || 0 }}
|
||||
</v-card-subtitle>
|
||||
</v-col>
|
||||
|
||||
<!-- Топ 10 -->
|
||||
<v-col cols="12">
|
||||
<v-card class="mb-4">
|
||||
<v-card-title class="text-teal-darken-3">Топ 10</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
|
||||
@@ -31,11 +45,12 @@
|
||||
:key="answerIndex"
|
||||
>
|
||||
<p>
|
||||
<strong>{{ answer.employee ? answer.employee.fio : answer.name }}</strong>: {{ answer.count }} голосов
|
||||
<strong>{{ answer.employee ? answer.employee.fio : answer.name }}</strong>: {{ answer.count }}
|
||||
{{voteCount(answer.count)}}
|
||||
<template v-if="answer.employee">
|
||||
<br />
|
||||
<br/>
|
||||
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
||||
<br />
|
||||
<br/>
|
||||
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
||||
</template>
|
||||
</p>
|
||||
@@ -51,7 +66,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from 'vue';
|
||||
import {computed, ref} from 'vue';
|
||||
|
||||
export default {
|
||||
name: 'VoteResult',
|
||||
@@ -76,11 +91,32 @@ export default {
|
||||
return [...question.answers].sort((a, b) => b.count - a.count).slice(0, 10);
|
||||
};
|
||||
|
||||
const truncateText = (text, maxLength) => {
|
||||
if (!text) return '';
|
||||
return text.length > maxLength ? text.slice(0, maxLength) + '…' : text;
|
||||
};
|
||||
|
||||
const shouldShowTooltip = (text, maxLength) => {
|
||||
return text && text.length > maxLength;
|
||||
};
|
||||
|
||||
const voteCount = (count) => {
|
||||
let currentVote = '';
|
||||
const lastDigit = count % 10;
|
||||
if (lastDigit === 1) currentVote = 'голос'
|
||||
if (lastDigit > 1) currentVote = 'голоса'
|
||||
if (lastDigit > 4 || count === 0) currentVote = 'голосов'
|
||||
return currentVote
|
||||
}
|
||||
|
||||
return {
|
||||
activeTab,
|
||||
questions,
|
||||
getWinner,
|
||||
getTopResults,
|
||||
truncateText,
|
||||
shouldShowTooltip,
|
||||
voteCount
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
|
||||
<v-dialog v-model="resultsModal" max-width="1200px" @click:outside="closeModal">
|
||||
<v-card>
|
||||
<v-card-title>Результаты голосования: {{ selectedVoting?.title }}</v-card-title>
|
||||
<VoteResult :data="result"/>
|
||||
<v-card-actions>
|
||||
<v-btn @click="closeModal">Закрыть</v-btn>
|
||||
|
||||
Reference in new issue
Block a user