В админ панели информация по голсованию скажи спасибо добавлена.

This commit is contained in:
Andrei Filippov committed 2024-10-29 16:38:28 +03:00
1 parent 6233c9fd48
commit af1f9f752c
4 files changed
+106 -21

No files matched your search

+2
View File
@@ -9,4 +9,6 @@ urlpatterns = [
path('getthanks/', GetThanks.as_view(), name=''),
path('setbest/', SetBest.as_view(), name=''),
path('getbest/', GetBest.as_view(), name=''),
path('getnotvotethn/', GetNotVoteThn.as_view()),
path('getnotvotebst/', GetNotVoteBst.as_view()),
]
+16
View File
@@ -66,3 +66,19 @@ class GetBest(APIView):
count_bests = BestVote.objects.values(
'cand_name').annotate(total=Count('id'))
return Response(count_bests)
class GetNotVoteThn(APIView):
def get(self, request):
list_thn_users = ThanksVote.objects.values('voted_user')
list_emp = DictEmployee.objects.filter(
deleted=0).exclude(login__in=list_thn_users)
return Response(GetEmpSerializer(list_emp, many=True).data)
class GetNotVoteBst(APIView):
def get(self, request):
list_bst_users = BestVote.objects.values('voted_user')
list_emp_bst = DictEmployee.objects.filter(
deleted=0).exclude(login__in=list_bst_users)
return Response(GetEmpSerializer(list_emp_bst, many=True).data)
+88 -20
View File
@@ -14,14 +14,6 @@
88
</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>
<v-card color="teal-darken-1" class="ma-2">
<v-card-title>Лидер номинации</v-card-title>
</v-card>
@@ -30,6 +22,20 @@
ФИО
</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 id="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">
@@ -43,35 +49,97 @@
</v-card>
<v-card elevation="0">
<v-card-text>
88
</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>
ФИО
<perc-thn />
</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>
<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 id="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 { clearAxios } from "@/utils/axios-api";
import { objectToString } from "@vue/shared";
import PercThn from '@/components/vote/PercThn.vue';
export default {
components: {
PercThn,
},
setup() {
let result_thn = ref([]);
let result_bst = ref([]);
let all_voted_bst = ref([]);
let all_voted_thn = ref([]);
let max_thn = 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/getbest/`).then((data) => {
all_voted_bst = data.data;
});
};
getPercAndWin();
getNotVoted();
return {
max_thn,
result_thn,
result_bst,
}
}
}
</script>
<style>
.admin-vote {
margin-left: 10%;
}
#scroll-window {
overflow-y: scroll;
height: 400px;
}
</style>
-1
View File
@@ -161,7 +161,6 @@ export default {
if (account_login == '9966-00-011') {
admin_panel = true;
console.log(admin_panel);
}
return {