Добавлены компоненты подсчета процентов в главном окне и кона подтверждения выбора
This commit is contained in:
1 parent
928a014ce4
commit
4168c7b100
7 files changed
+155
-20
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<span>{{ perc_best }}%</span>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
let account_login = useAccountStore().user.login;
|
||||
let department_id = useAccountStore().user.id_dict_department;
|
||||
let all_dep = ref([]);
|
||||
let all_voted = ref([]);
|
||||
let perc_best = ref();
|
||||
|
||||
const getAllDep = () => {
|
||||
clearAxios.get(`api/vote/get_for_bst/?login=${account_login}&dep=${department_id}`).then((data) => {
|
||||
all_dep.value = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
const getVoted = () => {
|
||||
clearAxios.get(`api/vote/getbest/`).then((data) => {
|
||||
all_voted.value = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
getAllDep();
|
||||
getVoted();
|
||||
|
||||
|
||||
perc_best = computed(() => Math.round(all_voted.value.length / all_dep.value.length * 100))
|
||||
|
||||
return {
|
||||
all_dep,
|
||||
all_voted,
|
||||
perc_best,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style></style>
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<span>{{ perc_thn }}%</span>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
let account_login = useAccountStore().user.login;
|
||||
let all_cod = ref([]);
|
||||
let all_voted = ref([]);
|
||||
let perc_thn = ref();
|
||||
|
||||
const getAllCod = () => {
|
||||
clearAxios.get(`api/vote/get_for_thn/?login=${account_login}`).then((data) => {
|
||||
all_cod.value = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
const getVoted = () => {
|
||||
clearAxios.get(`api/vote/getthanks/`).then((data) => {
|
||||
all_voted.value = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
getAllCod();
|
||||
getVoted();
|
||||
|
||||
|
||||
perc_thn = computed(() => Math.round(all_voted.value.length / all_cod.value.length * 100))
|
||||
|
||||
return {
|
||||
all_cod,
|
||||
all_voted,
|
||||
perc_thn,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style></style>
|
||||
@@ -7,10 +7,31 @@
|
||||
<v-checkbox v-model="vote" :id="item.fio" :value="item.fio" :label="item.fio" />
|
||||
</template>
|
||||
</v-virtual-scroll>
|
||||
|
||||
</v-card>
|
||||
<v-card-actions class="justify-center vote-button-back">
|
||||
<v-btn variant="elevated" color="teal-darken-1" type="submit">ПРОГОЛОСОВАТЬ</v-btn>
|
||||
<v-dialog max-width="500">
|
||||
<template v-slot:activator="{ props: activatorProps }">
|
||||
<v-btn variant="elevated" v-bind="activatorProps" color="teal-darken-1"
|
||||
@click="approveCandidate">Подтвердить выбор</v-btn>
|
||||
</template>
|
||||
<template v-slot:default="{ isActive }">
|
||||
<v-card class="justify-center align-center">
|
||||
<v-card-title>Вы подтверждаете выбор?</v-card-title>
|
||||
<v-card-text>После подтверждения внесение измений станет невозможным.</v-card-text>
|
||||
<p>Выбранный кандидат</p>
|
||||
<v-card-title>{{ approve_name }}</v-card-title>
|
||||
<v-col class="d-flex flex-rows justify-center align-center" cols="12">
|
||||
<v-col cols="2">
|
||||
<v-btn variant="elevated" color="green-darken-1" @click="voteSend">ДА</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="2">
|
||||
<v-btn variant="elevated" color="red-darken-1" @click="isActive.value = false">НЕТ</v-btn>
|
||||
</v-col>
|
||||
</v-col>
|
||||
</v-card>
|
||||
</template>
|
||||
</v-dialog>
|
||||
<!-- <v-btn variant="elevated" color="teal-darken-1" type="submit">Подтвердить выбор</v-btn> -->
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</template>
|
||||
@@ -25,11 +46,13 @@ export default {
|
||||
setup(props) {
|
||||
let account_login = useAccountStore().user.login;
|
||||
let department_id = useAccountStore().user.id_dict_department;
|
||||
let department_name = useAccountStore().user.department
|
||||
let type_fetch = props.type_fetch;
|
||||
let vote = ref();
|
||||
let get_address = ref();
|
||||
let send_address = ref();
|
||||
let vote_data = ref([]);
|
||||
let approve_name = ref();
|
||||
|
||||
if (type_fetch == "thn") {
|
||||
get_address = `api/vote/get_for_thn/?login=${account_login}`;
|
||||
@@ -45,9 +68,15 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
const approveCandidate = () => {
|
||||
approve_name.value = vote.value;
|
||||
}
|
||||
|
||||
const voteSend = () => {
|
||||
window.location.reload();
|
||||
clearAxios.post(send_address, {
|
||||
cand_name_id: vote.value,
|
||||
department_user: department_name,
|
||||
voted_user: account_login
|
||||
},
|
||||
{
|
||||
@@ -58,11 +87,15 @@ export default {
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
getVotesData();
|
||||
|
||||
return {
|
||||
approveCandidate,
|
||||
voteSend,
|
||||
vote_data,
|
||||
vote,
|
||||
approve_name,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<template>
|
||||
<v-row class="justify-center ma-0 ">
|
||||
<v-col
|
||||
class="flex-column d-flex"
|
||||
|
||||
>
|
||||
|
||||
<news-crossroad/>
|
||||
<v-col class="flex-column d-flex">
|
||||
|
||||
<news-crossroad />
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -13,18 +10,17 @@
|
||||
|
||||
<script>
|
||||
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
import { pagecounter } from '@/utils/universal_functions'
|
||||
import newsCrossroad from '../components/news-crossroad.vue'
|
||||
// import NewsListNews from '../components/news-list-news.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
newsCrossroad
|
||||
|
||||
},
|
||||
setup(){
|
||||
pagecounter()
|
||||
}
|
||||
setup() {
|
||||
pagecounter()
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<v-col cols="12" class="h-15 d-flex justify-center proc-count_cell">
|
||||
<v-col justify="center" align="center" cols="2">
|
||||
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
|
||||
<span>45%</span>
|
||||
<perc-bst />
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col justify="center" align="center" cols="4" class="vote-cards_cell ">
|
||||
@@ -11,7 +11,7 @@
|
||||
</v-col>
|
||||
<v-col justify="center" align="center" cols="2">
|
||||
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
|
||||
<span>55%</span>
|
||||
<perc-thn />
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-col>
|
||||
@@ -105,7 +105,9 @@
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import VoteForm from '@/components/VoteForm.vue';
|
||||
import VoteForm from '@/components/vote/VoteForm.vue';
|
||||
import PercBst from '@/components/vote/PercBst.vue';
|
||||
import PercThn from '@/components/vote/PercThn.vue';
|
||||
import CountDown from '@/components/CountDown.vue';
|
||||
|
||||
export default {
|
||||
@@ -113,6 +115,8 @@ export default {
|
||||
components: {
|
||||
VoteForm,
|
||||
CountDown,
|
||||
PercBst,
|
||||
PercThn,
|
||||
},
|
||||
|
||||
setup() {
|
||||
|
||||
Reference in new issue
Block a user