Merge branch 'develop' into сja

This commit is contained in:
Cja committed 2025-01-23 10:21:41 +03:00
commit 571032eeee
9 files changed
+163 -43

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

+1 -1
View File
@@ -88,7 +88,7 @@
type="error"
density="compact"
title="Ошибка авторизации"
:text="info"
v-model="alert"
+1 -1
View File
@@ -14,7 +14,7 @@
class="d-flex pa-1 flex-column "
>
<news-card :news="x"/>
{{aNewsAll}}
</v-col>
</v-row>
<v-row class="flex-grow-0 ">
@@ -42,6 +42,7 @@
</h3>
<v-row>
<div class="v-col align-self-start">
<VoteAnimation v-if="!question.file" />
<v-img
:src="question.file"
class="cursor-pointer"
@@ -145,9 +146,11 @@ import {axiosApiInstance, spravURL} from "@/utils/axios-api";
import {computed, ref} from "vue";
import {useAccountStore} from "@/store/AccountStore";
import {checkremote} from "@/utils/universal_functions";
import VoteAnimation from "@/components/vote/VoteAnimation.vue";
export default {
name: 'CurrentVote',
components: {VoteAnimation},
methods: {
checkremote,
spravURL() {
@@ -0,0 +1,92 @@
<template>
<v-container class="d-flex flex-column align-center">
<div class="animation-container">
<div class="ballot">
<span class="ballot-text">Голос</span>
</div>
<div class="urn">
<div class="slot"></div>
</div>
</div>
</v-container>
</template>
<script>
export default {
setup() {
return {};
},
};
</script>
<style scoped>
.animation-container {
position: relative;
width: 200px;
height: 300px;
display: flex;
justify-content: center;
align-items: flex-end;
overflow: hidden;
}
.ballot {
position: absolute;
width: 60px;
height: 40px;
background-color: #004D40;
border-radius: 4px;
color: #fff;
font-size: 14px;
font-weight: bold;
text-align: center;
line-height: 40px;
animation: dropBallot 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
.ballot-text {
display: block;
}
.urn {
position: absolute;
bottom: 0;
width: 120px;
height: 80px;
background-color: #546E7A;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
display: flex;
justify-content: center;
align-items: flex-start;
}
.slot {
width: 60px;
height: 10px;
background-color: #455A64;
border-radius: 5px;
}
@keyframes dropBallot {
0% {
top: -50px;
transform: rotate(0deg);
opacity: 1;
}
40% {
transform: rotate(15deg);
}
60% {
top: 220px;
transform: rotate(-10deg);
opacity: 1;
}
100% {
transform: rotate(0deg);
opacity: 0.8;
}
}
</style>
+7 -3
View File
@@ -25,7 +25,7 @@
<v-carousel-item
v-for="(picture, index) in images"
:key="index"
:src="`${baseURL.slice(0, -1)}${picture}`">
:src="images[index].length < 1 ? defaultImage : `${baseURL.slice(0, -1)}${picture}`">
</v-carousel-item>
</v-carousel>
</v-col>
@@ -42,12 +42,15 @@
<span>{{ voteCard.description }}</span>
</v-tooltip>
</v-card-text>
<div class="px-2">
<Timer v-if="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
@changeBtn="(time) => timeChange = time"/>
<div v-else class="font-weight-bold text-center"> Завершено: {{
new Date(voteCard.dateend).toLocaleDateString()
}}
</div>
</div>
<v-card-actions class="justify-space-between mt-4 pb-2">
<template v-if="!isFinished">
<v-btn :disabled="voteCard.is_passed || timeChange" color="teal-darken-4" prepend-icon="mdi-vote-outline"
@@ -101,6 +104,7 @@ import Timer from "@/components/UI/Timer.vue"
import {baseURL} from "@/utils/axios-api";
import {computed, ref} from 'vue'
import {useAccountStore} from "@/store/AccountStore";
import defaultImage from '../../assets/emblem.png'
export default {
components: {Timer},
@@ -132,7 +136,7 @@ export default {
const user = accountStore.user;
const images = computed(() => {
return props.voteCard.files.length > 0 ? props.voteCard.files : ['/media/defaultimg/vote.png']
return props.voteCard.files.length > 0 ? props.voteCard.files : ['']
})
const date = new Date();
@@ -143,7 +147,7 @@ export default {
isFinished.value = true;
}
return {timeChange, baseURL, images, youSure, isFinished, user}
return {timeChange, baseURL, images, youSure, isFinished, user, defaultImage}
}
}
@@ -100,20 +100,20 @@
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
<div class="v-row ">
<v-col class="align-self-center font-weight-bold py-0">
<v-col cols="auto" class="align-self-center font-weight-bold py-0">
Тип ответа
</v-col>
<v-col cols="3" class="py-0">
<v-col cols="3" class="py-0 align-self-center ">
<v-select density="compact" v-model="question.settings.choice" :items="questionTypes"
@update:model-value="question.answers=[]"
:list-props="{density:'compact'}"
item-title="name" item-value="choice" label="" hide-details variant="outlined"></v-select>
<!-- choice -->
</v-col>
</div>
<div class="v-row">
<v-col class="align-self-center font-weight-bold">
<v-spacer/>
<v-col cols="auto" class="align-self-center font-weight-bold">
Число возможных ответов
</v-col>
<v-col cols="1" class="">
@@ -121,11 +121,13 @@
: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>
</div>
<div class="v-row">
</div>
<v-card-text class="px-0">
<div v-if="question.settings.choice === 'free'">
@@ -141,6 +143,7 @@
</div>
</transition-group>
<div class="d-flex justify-start">
<v-btn size="small" color="teal-darken-4" @click="addAnswer(index)">Добавить ответ</v-btn>
@@ -161,10 +164,7 @@
</v-radio>
</v-radio-group>
<!-- <v-switch color="teal-darken-4" v-model="question.settings.withoutDirector"
:label="`Без начальства : ${question.settings.withoutDirector ? 'да ' : 'нет'}`" hide-details
class="v-col-auto"></v-switch> -->
</div>
@@ -400,7 +400,7 @@ export default {
const addQuestion = () => {
form.value.questions.push({
text: "",
settings: { choice: "free", multiChoice: 1, onlyDep: null, withoutDirector: false },
settings: { choice: "free", multiChoice: 1, onlyDep: null },
image: null,
answers: [],
selectedEmployees: []
@@ -464,17 +464,11 @@ export default {
});
const selectedTimeStart = ref(
`${form.value.startDate.getHours().toString().padStart(2, "0")}:${form.value.startDate
.getMinutes()
.toString()
.padStart(2, "0")}`
`${(form.value.startDate.getHours()+1).toString().padStart(2, "0")}:00`
);
const selectedTimeEnd = ref(
`${form.value.endDate.getHours().toString().padStart(2, "0")}:${form.value.endDate
.getMinutes()
.toString()
.padStart(2, "0")}`
`${(form.value.endDate.getHours()+1).toString().padStart(2, "0")}:00`
);
watch(form.value, () => {
+35 -15
View File
@@ -1,5 +1,5 @@
<template>
<v-container>
<v-container style="height: 85vh">
<div class="text-end">
<v-btn class="" color="red-darken-1" density="compact" icon="mdi-close-thick" size="small"
@click="$emit('closer')">
@@ -46,7 +46,7 @@
<v-card class="mb-4">
<v-card-title class="text-teal-darken-3">Топ {{ getTopResults(question).length }}</v-card-title>
<v-card-text>
<v-list style="max-height: 40vh; overflow-y: auto;">
<v-list style="max-height: 45vh; overflow-y: auto;">
<v-list-item
v-for="(answer, answerIndex) in getTopResults(question)"
:key="answerIndex"
@@ -88,18 +88,24 @@
</v-col>
</v-row>
</v-tabs-window-item>
<!-- Не голосовали -->
<!-- <v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">-->
<!-- <v-card-title class="text-red-darken-3">Не голосовали:</v-card-title>-->
<!-- <v-list style="max-height: 40vh; overflow-y: auto;">-->
<!-- <v-list-item-->
<!-- v-for="(answer, answerIndex) in getTopResults(question)"-->
<!-- :key="answerIndex"-->
<!-- >-->
<!-- {{answer.employee.fio}}-->
<!-- </v-list-item>-->
<!-- </v-list>-->
<!-- </v-tabs-window-item>-->
<v-tabs-window-item>
<v-card-title class="text-red-darken-3">Не голосовали:</v-card-title>
<v-card-item style="max-height: 60vh; overflow-y: auto;">
<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 v-for="(voter, voterIndex) in voters" :key="voterIndex">
<!-- {{ voter.fio }}-->
<p>
<v-avatar :image="checkremote(`${spravURL()}${voter.login}.jpg`)"
class="cursor-pointer"
@click.stop="opendialog(checkremote(`${spravURL()}${voter.login}.jpg`))"/>
<strong class="ml-4">{{ voter.fio }}</strong>
(<small>{{ voter.post }}</small>) 👿
</p>
</v-list-item>
</template>
</v-card-item>
</v-tabs-window-item>
</v-tabs-window>
</v-container>
@@ -154,6 +160,7 @@ export default {
const title = props.data.name;
const description = props.data.description;
const nonVoters = props.data.nonvoting;
const getWinner = (question) => {
return question.answers.reduce(
@@ -196,6 +203,17 @@ export default {
activepick.value = val
}
const groupedByDepartment = computed(() => {
return nonVoters.reduce((groups, voter) => {
const department = voter.department || '';
if (!groups[department]) {
groups[department] = [];
}
groups[department].push(voter);
return groups;
}, {});
});
return {
activepick,
opendialog,
@@ -209,7 +227,9 @@ export default {
voteCount,
title,
description,
getPercentage
getPercentage,
nonVoters,
groupedByDepartment
};
},
};
+11 -4
View File
@@ -6,9 +6,13 @@
v-model="currentTab"
align="center">
<v-tab v-for="x in tabs" :key="x.value" :value="x.value">{{ x.text }}</v-tab>
<v-tab v-if="accountStore.user.is_staff" value="constructor">Создать новое голосование</v-tab>
</v-tabs>
</v-col>
<v-col class="pa-0 overflow-hidden">
<v-window v-model="currentTab" class="h-100">
<!-- Текущие голосования -->
<v-tabs-window-item v-for="x in ['active','completed']" :value="x" class="h-100 overflow-auto">
@@ -31,11 +35,11 @@
</v-row>
</v-tabs-window-item>
<!-- Конструктор -->
<v-tabs-window-item class="h-100 overflow-auto" value="constructor">
<v-tabs-window-item v-if="accountStore.user.is_staff" class="h-100 overflow-auto" value="constructor">
<VoteConstructor @updating="updating"/>
</v-tabs-window-item>
</v-window>
<!-- Модальные окна -->
<v-dialog v-model="voteModal" @click:outside="closeModal">
<CurrentVote :data="res" @closer="closeModal"/>
@@ -63,16 +67,17 @@ import {useRoute, useRouter} from "vue-router";
import VoteResult from "@/components/vote/VoteResult.vue";
import {deleteVote, getVoteDetail, getVoteResult, getVotes} from "@/utils/axios-api";
import {formatDate} from "@vueuse/shared";
import { useAccountStore } from "@/store/AccountStore";
export default {
methods: {formatDate},
components: {CurrentVote, VoteConstructor, VoteCardVue, VoteResult},
setup() {
const accountStore = useAccountStore();
const tabs = [
{value: "active", text: 'Текущие голосования'},
{value: "completed", text: 'Завершенные голосования'},
{value: "constructor", text: 'Создать новое голосование'},
]
const currentTab = ref("active");
@@ -104,6 +109,7 @@ export default {
} catch (error) {
console.error("Ошибка при загрузке данных голосования:", error);
res.value = null;
router.push({ name: "VoteHomePage" });
}
};
@@ -173,6 +179,7 @@ export default {
updating("active");
return {
accountStore,
currentTab,
votes,
sortedVotes,