Merge branch 'dev-denzel' into develop
This commit is contained in:
commit
68dbc1938b
2 files changed
+52
-7
No files matched your search
@@ -110,7 +110,7 @@
|
||||
:list-props="{density:'compact'}"
|
||||
item-title="name" item-value="choice" label="" hide-details variant="outlined"></v-select>
|
||||
<!-- choice -->
|
||||
|
||||
|
||||
</v-col>
|
||||
<v-spacer/>
|
||||
<v-col cols="auto" class="align-self-center font-weight-bold">
|
||||
@@ -121,7 +121,7 @@
|
||||
:rules="[rules.required && question.settings.multiChoice > 0]" hide-details type="number"
|
||||
min="1" variant="outlined">
|
||||
<template v-slot:prepend>
|
||||
|
||||
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-col>
|
||||
@@ -143,7 +143,7 @@
|
||||
</div>
|
||||
|
||||
</transition-group>
|
||||
|
||||
|
||||
<div class="d-flex justify-start">
|
||||
<v-btn size="small" color="teal-darken-4" @click="addAnswer(index)">Добавить ответ</v-btn>
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@
|
||||
|
||||
<v-card flat class="fill-height d-flex flex-column">
|
||||
<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">
|
||||
{{ errorMessage }}
|
||||
</v-alert>
|
||||
|
||||
@@ -30,8 +30,24 @@
|
||||
</v-tabs>
|
||||
<v-tabs-window v-model="activeTab">
|
||||
<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">
|
||||
<h3 class="text-center">{{ question.name }}</h3>
|
||||
<v-card-title class="d-flex ga-2 align-center">
|
||||
@@ -242,7 +258,36 @@ export default {
|
||||
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 {
|
||||
getWinnersByDepartment,
|
||||
userCardIndex,
|
||||
activepick,
|
||||
opendialog,
|
||||
|
||||
Reference in new issue
Block a user