Merge branch 'develop' into test
This commit is contained in:
commit
e621259b38
6 files changed
+221
-41
No files matched your search
@@ -10,26 +10,35 @@
|
||||
<v-card-title>Процент проголосовавших</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
88
|
||||
<v-card-text class="perc-voted">
|
||||
{{ perc_bst }}%
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="mb-2">
|
||||
<v-card-title>Лидер номинации</v-card-title>
|
||||
</v-card>
|
||||
<v-card class="scroll-leaders" elevation="0">
|
||||
<v-card v-for="(employees, department) in max_bst" :key="department" elevation="0">
|
||||
<v-card-title>{{ department }}</v-card-title>
|
||||
<div v-for="employee in employees" :key="employee.name">
|
||||
{{ employee.name }}
|
||||
</div>
|
||||
</v-card>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="ma-2">
|
||||
<v-card-title>ФИО не участвовавших в голосовании</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
ФИО
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="ma-2">
|
||||
<v-card-title>Лидер номинации</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
ФИО
|
||||
</v-card-text>
|
||||
<v-card class="scroll-window" elevation="0">
|
||||
<v-card v-for="[key, val] of Object.entries(result_bst)">
|
||||
<v-card-title>{{ key }}</v-card-title>
|
||||
<div v-for="item_fio in val">
|
||||
{{ item_fio.fio }}
|
||||
</div>
|
||||
</v-card>
|
||||
</v-card>
|
||||
</v-card>
|
||||
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col justify="center" align="center">
|
||||
@@ -42,36 +51,142 @@
|
||||
<v-card-title>Процент проголосовавших</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
88
|
||||
<v-card-text class="perc-voted">
|
||||
<perc-thn />
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="mb-2">
|
||||
<v-card-title>Лидер номинации</v-card-title>
|
||||
</v-card>
|
||||
<v-card class="scroll-leaders pt-4" elevation="0">
|
||||
<div v-for="leader in max_thn">
|
||||
{{ leader }}
|
||||
</div>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="ma-2">
|
||||
<v-card-title>ФИО не участвовавших в голосовании</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
ФИО
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card color="teal-darken-1" class="ma-2">
|
||||
<v-card-title>Лидер номинации</v-card-title>
|
||||
</v-card>
|
||||
<v-card elevation="0">
|
||||
<v-card-text>
|
||||
ФИО
|
||||
</v-card-text>
|
||||
<v-card class="scroll-window" elevation="0">
|
||||
<v-card v-for="[key, val] of Object.entries(result_thn)">
|
||||
<v-card-title>{{ key }}</v-card-title>
|
||||
<div v-for="item_fio in val">
|
||||
{{ item_fio.fio }}
|
||||
</div>
|
||||
</v-card>
|
||||
</v-card>
|
||||
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import { objectToString } from "@vue/shared";
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import PercThn from '@/components/vote/PercThn.vue';
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PercThn,
|
||||
},
|
||||
setup() {
|
||||
let account_login = useAccountStore().user.login;
|
||||
let result_thn = ref([]);
|
||||
let result_bst = ref([]);
|
||||
let all_voted_bst = ref([]);
|
||||
let all_voted_thn = ref([]);
|
||||
let max_thn = ref();
|
||||
let max_bst = ref({});
|
||||
let all_cod = ref([]);
|
||||
let perc_bst = ref();
|
||||
|
||||
const getNotVoted = () => {
|
||||
clearAxios.get(`/api/vote/getnotvotethn/`).then((data) => {
|
||||
let not_voted_thn = data.data;
|
||||
result_thn.value = Object.groupBy(not_voted_thn, ({ department }) => department);
|
||||
});
|
||||
clearAxios.get(`/api/vote/getnotvotebst/`).then((data) => {
|
||||
let not_voted_bst = data.data;
|
||||
result_bst.value = Object.groupBy(not_voted_bst, ({ department }) => department);
|
||||
});
|
||||
};
|
||||
|
||||
const getPercAndWin = () => {
|
||||
clearAxios.get(`/api/vote/getthanks/`).then((data) => {
|
||||
all_voted_thn = data.data;
|
||||
let max_total = Math.max(...all_voted_thn.map(item => item.total));
|
||||
max_thn.value = all_voted_thn.filter(item => item.total === max_total).map(item => item.cand_name)
|
||||
});
|
||||
|
||||
clearAxios.get(`api/vote/get_for_thn/?login=${account_login}`).then((data) => {
|
||||
all_cod.value = data.data;
|
||||
});
|
||||
|
||||
clearAxios.get(`/api/vote/getbest/`).then((data) => {
|
||||
all_voted_bst.value = data.data;
|
||||
// Групировка по департаметам
|
||||
const groupedEmployees = {}
|
||||
all_voted_bst.value.forEach(item => {
|
||||
const { department_user, cand_name, total } = item;
|
||||
if (!groupedEmployees[department_user]) {
|
||||
groupedEmployees[department_user] = [];
|
||||
}
|
||||
groupedEmployees[department_user].push({ name: cand_name, total });
|
||||
});
|
||||
// Нахождение лучших сотрудников в каждом департаменте
|
||||
for (const department in groupedEmployees) {
|
||||
const employees = groupedEmployees[department];
|
||||
// Поиск максимального количества голосов
|
||||
const maxTotal = Math.max(...employees.map(emp => emp.total));
|
||||
|
||||
// Фильтрация сотрудников с максимальным количетсвом голосов
|
||||
max_bst.value[department] = employees.filter(emp => emp.total === maxTotal);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
console.log(max_bst);
|
||||
|
||||
|
||||
};
|
||||
|
||||
perc_bst = computed(() => Math.round(all_voted_bst.value.length / all_cod.value.length * 100))
|
||||
|
||||
getPercAndWin();
|
||||
getNotVoted();
|
||||
return {
|
||||
max_thn,
|
||||
max_bst,
|
||||
perc_bst,
|
||||
result_thn,
|
||||
result_bst,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.admin-vote {
|
||||
margin-left: 10%;
|
||||
}
|
||||
|
||||
.scroll-leaders {
|
||||
overflow-y: scroll;
|
||||
height: 95px;
|
||||
}
|
||||
|
||||
.scroll-window {
|
||||
overflow-y: scroll;
|
||||
height: 378px;
|
||||
}
|
||||
|
||||
.perc-voted {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<v-form @submit="voteSend">
|
||||
<v-card height="520" variant="none">
|
||||
<v-card id="scroll-window-chekbox" height="520" elevation="0">
|
||||
<!-- Форма голосования -->
|
||||
<v-virtual-scroll :items="vote_data" :height="500" :item-height="40">
|
||||
<v-virtual-scroll :items="vote_data" :item-height="40">
|
||||
<template v-slot:default="{ item }">
|
||||
<v-checkbox v-model="vote" :id="item.fio" :value="item.fio" :label="item.fio" />
|
||||
</template>
|
||||
@@ -104,4 +104,9 @@ export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
<style>
|
||||
#scroll-window-chekbox {
|
||||
overflow-y: scroll !important;
|
||||
height: 400px;
|
||||
}
|
||||
</style>
|
||||
@@ -28,9 +28,13 @@
|
||||
</v-card-title>
|
||||
<!-- Кнопка активации поворота -->
|
||||
<v-card-actions class="justify-center vote-button">
|
||||
<v-btn size="x-large" @click="toggleFlip1" variant="elevated" color="teal-darken-1"
|
||||
<v-card-title class="you-voted" v-if="voted_bst">
|
||||
<div>Вы уже проголосовали!</div>
|
||||
</v-card-title>
|
||||
<v-btn v-else size="x-large" @click="toggleFlip1" variant="elevated" color="teal-darken-1"
|
||||
type="button">ОТДАТЬ
|
||||
ГОЛОС!</v-btn>
|
||||
|
||||
</v-card-actions>
|
||||
<!-- Кнопка активации поворота КОНЕЦ-->
|
||||
</v-card>
|
||||
@@ -58,7 +62,7 @@
|
||||
<!-- Задняя сторона карточки КОНЕЦ-->
|
||||
</v-col>
|
||||
<!-- Голосование Лучший сотрудник КОНЕЦ-->
|
||||
<v-col cols="2" v-if="admin_panel" justify="center" align="center">
|
||||
<v-col class="w-15" cols="2" v-if="admin_panel" justify="center" align="center">
|
||||
<v-dialog>
|
||||
<template v-slot:activator="{ props: VoteAdmin }">
|
||||
<v-btn variant="elevated" v-bind="VoteAdmin" color="teal-darken-1">ИНФОРМАЦИЯ О ХОДЕ <br>
|
||||
@@ -92,7 +96,11 @@
|
||||
</v-card-title>
|
||||
<!-- Кнопка активации поворота -->
|
||||
<v-card-actions class="justify-center vote-button">
|
||||
<v-btn size="x-large" @click="toggleFlip2" variant="elevated" color="teal-darken-1">ОТДАТЬ
|
||||
<v-card-title class="you-voted" v-if="voted_thn">
|
||||
<div>Вы уже проголосовали!</div>
|
||||
</v-card-title>
|
||||
<v-btn v-else size="x-large" @click="toggleFlip2" variant="elevated"
|
||||
color="teal-darken-1">ОТДАТЬ
|
||||
ГОЛОС!</v-btn>
|
||||
</v-card-actions>
|
||||
<!-- Кнопка активации поворота КОНЕЦ-->
|
||||
@@ -126,6 +134,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import VoteForm from '@/components/vote/VoteForm.vue';
|
||||
import PercBst from '@/components/vote/PercBst.vue';
|
||||
import PercThn from '@/components/vote/PercThn.vue';
|
||||
@@ -137,6 +146,7 @@ let account_login = useAccountStore().user.login;
|
||||
|
||||
export default {
|
||||
|
||||
|
||||
components: {
|
||||
VoteForm,
|
||||
CountDown,
|
||||
@@ -147,10 +157,36 @@ export default {
|
||||
|
||||
setup() {
|
||||
|
||||
let votedListBst = ref([]);
|
||||
let votedListThn = ref([]);
|
||||
let voted_thn = ref(false);
|
||||
let voted_bst = ref(false);
|
||||
|
||||
const isFlipped1 = ref(false);
|
||||
const isFlipped2 = ref(false);
|
||||
|
||||
|
||||
const isVoted = () => {
|
||||
clearAxios.get(`/api/vote/getthanks/`).then((data) => {
|
||||
votedListThn = data.data;
|
||||
let finded_thn = votedListThn.find(({ voted_user }) => voted_user === account_login)
|
||||
if (finded_thn.voted_user === account_login) {
|
||||
voted_thn.value = true;
|
||||
}
|
||||
});
|
||||
clearAxios.get(`/api/vote/getbest/`).then((data) => {
|
||||
votedListBst = data.data;
|
||||
let finded_bst = votedListBst.find(({ voted_user }) => voted_user === account_login)
|
||||
if (finded_bst.voted_user === account_login) {
|
||||
voted_bst.value = true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const toggleFlip1 = () => {
|
||||
isFlipped1.value = !isFlipped1.value;
|
||||
|
||||
@@ -161,9 +197,9 @@ export default {
|
||||
|
||||
if (account_login == '9966-00-011') {
|
||||
admin_panel = true;
|
||||
console.log(admin_panel);
|
||||
}
|
||||
|
||||
isVoted();
|
||||
return {
|
||||
isFlipped1,
|
||||
toggleFlip1,
|
||||
@@ -171,6 +207,8 @@ export default {
|
||||
toggleFlip2,
|
||||
account_login,
|
||||
admin_panel,
|
||||
voted_bst,
|
||||
voted_thn,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -213,7 +251,7 @@ export default {
|
||||
}
|
||||
|
||||
.vote-button {
|
||||
margin-top: 572px;
|
||||
margin-top: 577px;
|
||||
}
|
||||
|
||||
.vote-cards_cell {
|
||||
@@ -231,4 +269,10 @@ export default {
|
||||
.card-count {
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
.you-voted {
|
||||
background-color: rgba(182, 182, 182, 0.4);
|
||||
color: #ffff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user