Merge branch 'dev-denzel' into develop
This commit is contained in:
commit
68dbc1938b
2 files changed
+47
-2
No files matched your search
@@ -271,7 +271,7 @@
|
|||||||
|
|
||||||
<v-card flat class="fill-height d-flex flex-column">
|
<v-card flat class="fill-height d-flex flex-column">
|
||||||
<v-card-title>Подтверждение</v-card-title>
|
<v-card-title>Подтверждение</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text style="max-height: 62vh; overflow-y: auto;">
|
||||||
<v-alert v-if="errorMessage" class="mb-4 " type="error">
|
<v-alert v-if="errorMessage" class="mb-4 " type="error">
|
||||||
{{ errorMessage }}
|
{{ errorMessage }}
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
|||||||
@@ -31,7 +31,23 @@
|
|||||||
<v-tabs-window v-model="activeTab">
|
<v-tabs-window v-model="activeTab">
|
||||||
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
|
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
|
||||||
|
|
||||||
<v-row>
|
<v-row v-if="question.settings.onlyDep">
|
||||||
|
<v-col v-for="(winner, department) in getWinnersByDepartment(question)" :key="department">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>
|
||||||
|
<strong class="text-teal-darken-4">{{ department }}</strong>
|
||||||
|
</v-card-title>
|
||||||
|
<v-card-subtitle>
|
||||||
|
Победитель: {{ winner.employee.fio || winner.name }} 🏆
|
||||||
|
</v-card-subtitle>
|
||||||
|
<v-card-text>
|
||||||
|
Количество голосов: {{ winner.count }}
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row v-else>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<h3 class="text-center">{{ question.name }}</h3>
|
<h3 class="text-center">{{ question.name }}</h3>
|
||||||
<v-card-title class="d-flex ga-2 align-center">
|
<v-card-title class="d-flex ga-2 align-center">
|
||||||
@@ -242,7 +258,36 @@ export default {
|
|||||||
return sortedGroupedByDepartment;
|
return sortedGroupedByDepartment;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// const groupedByDepartment = {};
|
||||||
|
|
||||||
|
const getWinnersByDepartment = (question) => {
|
||||||
|
// Группируем ответы по департаментам
|
||||||
|
const groupedByDepartment = question.answers.reduce((groups, answer) => {
|
||||||
|
const department = answer.employee?.department || 'Без отдела'; // Отдел или 'Без отдела' если нет
|
||||||
|
if (!groups[department]) {
|
||||||
|
groups[department] = [];
|
||||||
|
}
|
||||||
|
groups[department].push(answer);
|
||||||
|
return groups;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
// Для каждого департамента находим победителя
|
||||||
|
const winnersByDepartment = {};
|
||||||
|
for (const department in groupedByDepartment) {
|
||||||
|
const answers = groupedByDepartment[department];
|
||||||
|
const winner = answers.reduce(
|
||||||
|
(max, answer) => (answer.count > max.count ? answer : max),
|
||||||
|
{count: 0, employee: {fio: '', department: '', post: ''}, name: ''}
|
||||||
|
);
|
||||||
|
winnersByDepartment[department] = winner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return winnersByDepartment;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
getWinnersByDepartment,
|
||||||
userCardIndex,
|
userCardIndex,
|
||||||
activepick,
|
activepick,
|
||||||
opendialog,
|
opendialog,
|
||||||
|
|||||||
Reference in new issue
Block a user