Merge pull request 'develop' (#131) from develop into main
Reviewed-on: https://sulaco.nodered.ru:5333/COD2/PORTAL_COD2/pulls/131
This commit is contained in:
commit
ecf8bfd2a1
3 files changed
+28
-28
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="flip-card">
|
<v-card flat class="flip-card">
|
||||||
<div class="flip-card-inner" :class="{ 'is-flipped': isExpanded }">
|
<div class="flip-card-inner" :class="{ 'is-flipped': isExpanded }">
|
||||||
<!-- Передняя сторона карточки -->
|
<!-- Передняя сторона карточки -->
|
||||||
<div class="flip-card-front">
|
<div class="flip-card-front">
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
{{ !voteCard.is_passed ? "Проголосовать" : "Уже проголосовали" }}
|
{{ !voteCard.is_passed ? "Проголосовать" : "Уже проголосовали" }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="user.id === voteCard.author || isFinished">
|
<template v-if="user.id === voteCard.author || isFinished || user.is_superuser">
|
||||||
<v-btn
|
<v-btn
|
||||||
color="teal-darken-4"
|
color="teal-darken-4"
|
||||||
prepend-icon="mdi-trophy-outline"
|
prepend-icon="mdi-trophy-outline"
|
||||||
|
|||||||
@@ -216,11 +216,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import {baseURL, spravURL} from "@/utils/axios-api";
|
import { baseURL, spravURL } from '@/utils/axios-api';
|
||||||
import {checkremote} from "@/utils/universal_functions";
|
import { checkremote } from '@/utils/universal_functions';
|
||||||
import NonVoteHappy from "@/components/vote/NonVoteHappy.vue";
|
import NonVoteHappy from '@/components/vote/NonVoteHappy.vue';
|
||||||
import NonVoteSad from "@/components/vote/NonVoteSad.vue";
|
import NonVoteSad from '@/components/vote/NonVoteSad.vue';
|
||||||
import InfoUserCard from "@/components/UI/fiousercard/infoUserCard.vue";
|
import InfoUserCard from '@/components/UI/fiousercard/infoUserCard.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'VoteResult',
|
name: 'VoteResult',
|
||||||
@@ -228,13 +228,13 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
checkremote,
|
checkremote,
|
||||||
spravURL() {
|
spravURL() {
|
||||||
return spravURL
|
return spravURL;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
baseURL() {
|
baseURL() {
|
||||||
return baseURL
|
return baseURL;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
emits: ['closer'],
|
emits: ['closer'],
|
||||||
props: {
|
props: {
|
||||||
@@ -250,7 +250,8 @@ export default {
|
|||||||
|
|
||||||
const title = props.data.name;
|
const title = props.data.name;
|
||||||
const description = props.data.description;
|
const description = props.data.description;
|
||||||
const nonVoters = props.data.nonvoting;
|
const allVoters = props.data.nonvoting;
|
||||||
|
const nonVoters = allVoters.filter(el => el.deleted !== 1);
|
||||||
|
|
||||||
const activeDepartment = ref(null);
|
const activeDepartment = ref(null);
|
||||||
const activeDepartmentResults = ref([]);
|
const activeDepartmentResults = ref([]);
|
||||||
@@ -266,7 +267,7 @@ export default {
|
|||||||
const getWinner = (question) => {
|
const getWinner = (question) => {
|
||||||
return question.answers.reduce(
|
return question.answers.reduce(
|
||||||
(max, answer) => (answer.count > max.count ? answer : max),
|
(max, answer) => (answer.count > max.count ? answer : max),
|
||||||
{count: 0, employee: {fio: '', department: '', post: ''}, name: ''}
|
{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' },
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -283,7 +284,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...answer,
|
...answer,
|
||||||
rank
|
rank,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -300,23 +301,23 @@ export default {
|
|||||||
const voteCount = (count) => {
|
const voteCount = (count) => {
|
||||||
let currentVote = '';
|
let currentVote = '';
|
||||||
const lastDigit = count % 10;
|
const lastDigit = count % 10;
|
||||||
if (lastDigit === 1) currentVote = 'голос'
|
if (lastDigit === 1) currentVote = 'голос';
|
||||||
if (lastDigit > 1) currentVote = 'голоса'
|
if (lastDigit > 1) currentVote = 'голоса';
|
||||||
if (lastDigit > 4 || count === 0 || count === 11 || count === 12 || count === 13 || count === 14) currentVote = 'голосов'
|
if (lastDigit > 4 || count === 0 || count === 11 || count === 12 || count === 13 || count === 14) currentVote = 'голосов';
|
||||||
return currentVote
|
return currentVote;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getPercentage = (count, question) => {
|
const getPercentage = (count, question) => {
|
||||||
const totalVotes = question.answers.reduce((sum, answer) => sum + answer.count, 0);
|
const totalVotes = question.answers.reduce((sum, answer) => sum + answer.count, 0);
|
||||||
return totalVotes > 0 ? (count / totalVotes) * 100 : 0;
|
return totalVotes > 0 ? (count / totalVotes) * 100 : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const activepick = ref(null)
|
const activepick = ref(null);
|
||||||
// const dialog = ref(false)
|
// const dialog = ref(false)
|
||||||
const opendialog = (val) => {
|
const opendialog = (val) => {
|
||||||
dialog.value = true
|
dialog.value = true;
|
||||||
activepick.value = val
|
activepick.value = val;
|
||||||
}
|
};
|
||||||
|
|
||||||
const groupedByDepartment = computed(() => {
|
const groupedByDepartment = computed(() => {
|
||||||
// Группируем пользователей по департаментам
|
// Группируем пользователей по департаментам
|
||||||
@@ -352,7 +353,6 @@ export default {
|
|||||||
return sortedGroupedByDepartment;
|
return sortedGroupedByDepartment;
|
||||||
});
|
});
|
||||||
|
|
||||||
// const groupedByDepartment = {};
|
|
||||||
|
|
||||||
const getWinnersByDepartment = (question) => {
|
const getWinnersByDepartment = (question) => {
|
||||||
// Группируем ответы по департаментам
|
// Группируем ответы по департаментам
|
||||||
@@ -371,7 +371,7 @@ export default {
|
|||||||
const answers = groupedByDepartment[department];
|
const answers = groupedByDepartment[department];
|
||||||
const winner = answers.reduce(
|
const winner = answers.reduce(
|
||||||
(max, answer) => (answer.count > max.count ? answer : max),
|
(max, answer) => (answer.count > max.count ? answer : max),
|
||||||
{count: 0, employee: {fio: '', department: '', post: ''}, name: ''}
|
{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' },
|
||||||
);
|
);
|
||||||
winnersByDepartment[department] = winner;
|
winnersByDepartment[department] = winner;
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ export default {
|
|||||||
description,
|
description,
|
||||||
getPercentage,
|
getPercentage,
|
||||||
nonVoters,
|
nonVoters,
|
||||||
groupedByDepartment
|
groupedByDepartment,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -129,8 +129,8 @@ export default {
|
|||||||
resultsModal.value = false;
|
resultsModal.value = false;
|
||||||
selectedVoting.value = null;
|
selectedVoting.value = null;
|
||||||
router.push({ name: 'VoteHomePage' });
|
router.push({ name: 'VoteHomePage' });
|
||||||
if (route.name === 'Voting') updating('active');
|
// if (route.name === 'Voting') updating('active');
|
||||||
if (route.name === 'VoteResults') updating('completed');
|
// if (route.name === 'VoteResults') updating('completed');
|
||||||
};
|
};
|
||||||
|
|
||||||
const openModal = async (type, voting) => {
|
const openModal = async (type, voting) => {
|
||||||
|
|||||||
Reference in new issue
Block a user