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
+50
-50
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"
|
||||||
|
|||||||
@@ -77,17 +77,17 @@
|
|||||||
<v-avatar v-if="answer.file === null && answer.employee"
|
<v-avatar v-if="answer.file === null && answer.employee"
|
||||||
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))"/>
|
@click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))" />
|
||||||
<v-avatar v-if="answer.file !== null" :image="baseURL.slice(0, -1) + answer.file"
|
<v-avatar v-if="answer.file !== null" :image="baseURL.slice(0, -1) + answer.file"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click.stop="opendialog(answer)"/>
|
@click.stop="opendialog(answer)" />
|
||||||
<strong class="ml-4">{{ answer.employee ? answer.employee.fio : answer.name }}</strong>:
|
<strong class="ml-4">{{ answer.employee ? answer.employee.fio : answer.name }}</strong>:
|
||||||
{{ answer.count }}
|
{{ answer.count }}
|
||||||
{{ voteCount(answer.count) }}
|
{{ voteCount(answer.count) }}
|
||||||
<template v-if="answer.employee">
|
<template v-if="answer.employee">
|
||||||
<br/>
|
<br />
|
||||||
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
||||||
<br/>
|
<br />
|
||||||
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
@@ -111,12 +111,12 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
</v-tabs-window-item>
|
</v-tabs-window-item>
|
||||||
<v-tabs-window-item>
|
<v-tabs-window-item>
|
||||||
<NonVoteSad v-if="nonVoters.length > 0"/>
|
<NonVoteSad v-if="nonVoters.length > 0" />
|
||||||
<v-card-title v-if="nonVoters.length > 0" class="text-red-darken-3">Число сотрудников, которые не проголосовали
|
<v-card-title v-if="nonVoters.length > 0" class="text-red-darken-3">Число сотрудников, которые не проголосовали
|
||||||
<strong>{{ nonVoters.length }}</strong>
|
<strong>{{ nonVoters.length }}</strong>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-item style="max-height: 50vh; overflow-y: auto;">
|
<v-card-item style="max-height: 50vh; overflow-y: auto;">
|
||||||
<NonVoteHappy v-if="nonVoters.length < 1"/>
|
<NonVoteHappy v-if="nonVoters.length < 1" />
|
||||||
<template v-for="(voters, department) in groupedByDepartment" :key="department">
|
<template v-for="(voters, department) in groupedByDepartment" :key="department">
|
||||||
<v-list-item-title class="text-teal-darken-4">{{ department }}</v-list-item-title>
|
<v-list-item-title class="text-teal-darken-4">{{ department }}</v-list-item-title>
|
||||||
<v-list-item v-for="(voter, voterIndex) in voters" :key="`${department}-${voterIndex}`">
|
<v-list-item v-for="(voter, voterIndex) in voters" :key="`${department}-${voterIndex}`">
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<div>
|
<div>
|
||||||
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialog=false"/>
|
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialog=false" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<v-card-title class="d-flex">
|
<v-card-title class="d-flex">
|
||||||
<strong class="text-teal-darken-4">Результаты голосования: {{ activeDepartment }}</strong>
|
<strong class="text-teal-darken-4">Результаты голосования: {{ activeDepartment }}</strong>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialogWinner=false"/>
|
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialogWinner=false" />
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-list>
|
<v-list>
|
||||||
@@ -173,21 +173,21 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<strong class="mr-4">{{ index + 1 }}.</strong>
|
<strong class="mr-4">{{ index + 1 }}.</strong>
|
||||||
<v-avatar v-if="answer.file === null && answer.employee"
|
<v-avatar v-if="answer.file === null && answer.employee"
|
||||||
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))"/>
|
@click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))" />
|
||||||
<v-avatar v-if="answer.file !== null" :image="baseURL.slice(0, -1) + answer.file"
|
<v-avatar v-if="answer.file !== null" :image="baseURL.slice(0, -1) + answer.file"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click.stop="opendialog(answer)"/>
|
@click.stop="opendialog(answer)" />
|
||||||
<strong class="ml-4">{{ answer.employee ? answer.employee.fio : answer.name }}</strong>:
|
<strong class="ml-4">{{ answer.employee ? answer.employee.fio : answer.name }}</strong>:
|
||||||
{{ answer.count }}
|
{{ answer.count }}
|
||||||
{{ voteCount(answer.count) }}
|
{{ voteCount(answer.count) }}
|
||||||
<template v-if="answer.employee">
|
<template v-if="answer.employee">
|
||||||
<br/>
|
<br />
|
||||||
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
||||||
<br/>
|
<br />
|
||||||
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
@@ -215,26 +215,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<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',
|
||||||
components: {InfoUserCard, NonVoteSad, NonVoteHappy},
|
components: { InfoUserCard, NonVoteSad, NonVoteHappy },
|
||||||
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,34 +301,34 @@ 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(() => {
|
||||||
// Группируем пользователей по департаментам
|
// Группируем пользователей по департаментам
|
||||||
const departments = nonVoters.reduce((groups, voter) => {
|
const departments = nonVoters.reduce((groups, voter) => {
|
||||||
const department = voter.department || '';
|
const department = voter.department || '';
|
||||||
if (!groups[department]) {
|
if (!groups[department]) {
|
||||||
groups[department] = [];
|
groups[department] = [];
|
||||||
}
|
}
|
||||||
groups[department].push(voter);
|
groups[department].push(voter);
|
||||||
return groups;
|
return groups;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
// Сортируем департаменты по id_dict_department
|
// Сортируем департаменты по id_dict_department
|
||||||
const sortedDepartments = Object.keys(departments).sort((a, b) => {
|
const sortedDepartments = Object.keys(departments).sort((a, b) => {
|
||||||
@@ -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