Merge branch 'develop' into test
This commit is contained in:
commit
0036b0e85b
44 files changed
+4624
-21920
No files matched your search
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
||||
Generated
+3019
-21123
File diff suppressed because it is too large.
Load diff
+26
-48
@@ -1,72 +1,50 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.83",
|
||||
"version": "0.0.84",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --fix --ignore-path .gitignore",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build"
|
||||
"docs": "vuepress build docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"-": "^0.0.1",
|
||||
"@ckeditor/ckeditor5-build-classic": "^41.4.2",
|
||||
"@ckeditor/ckeditor5-dev-translations": "^40.0.0",
|
||||
"@ckeditor/ckeditor5-vue": "^5.1.0",
|
||||
"@mdi/font": "7.0.96",
|
||||
"@vue-flow/background": "^1.3.0",
|
||||
"@vue-flow/controls": "^1.1.1",
|
||||
"@vue-flow/core": "^1.33.5",
|
||||
"@vue-flow/minimap": "^1.4.0",
|
||||
"@vue-flow/node-resizer": "^1.3.6",
|
||||
"@ckeditor/ckeditor5-build-classic": "^44.1.0",
|
||||
"@ckeditor/ckeditor5-dev-translations": "^43.0.1",
|
||||
"@ckeditor/ckeditor5-vue": "^7.3.0",
|
||||
"@mdi/font": "7.4.47",
|
||||
"@vuelidate/core": "^2.0.3",
|
||||
"@vuelidate/validators": "^2.0.3",
|
||||
"@vuelidate/validators": "^2.0.4",
|
||||
"adapter": "^1.0.0-beta.10",
|
||||
"axios": "^1.4.0",
|
||||
"chart.js": "^4.4.1",
|
||||
"chartjs": "^0.3.24",
|
||||
"axios": "^1.7.9",
|
||||
"chart.js": "^4.4.7",
|
||||
"chartjs-adapter-moment": "^1.0.1",
|
||||
"chartjs-plugin-datalabels": "^2.2.0",
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"ical.js": "^2.0.0",
|
||||
"ical.js": "^2.1.0",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.0.23",
|
||||
"roboto-fontface": "*",
|
||||
"pinia": "^2.3.1",
|
||||
"rrule": "^2.8.1",
|
||||
"v-tooltip": "^2.1.3",
|
||||
"vee-validate": "^4.12.8",
|
||||
"vue": "^3.2.0",
|
||||
"vue-cal": "^4.8.1",
|
||||
"vue-chartjs": "^5.3.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue-cal": "^4.10.2",
|
||||
"vue-chartjs": "^5.3.2",
|
||||
"vue-jwt-decode": "^0.1.0",
|
||||
"vue-pdf-embed": "^2.0.3",
|
||||
"vue-router": "^4.0.0",
|
||||
"vue3-autocounter": "^1.0.6",
|
||||
"vue-pdf-embed": "^2.1.2",
|
||||
"vue-router": "^4.5.0",
|
||||
"vue3-autocounter": "^1.0.8",
|
||||
"vuelidate": "^0.7.7",
|
||||
"vuetify": "^3.6.11",
|
||||
"webfontloader": "^1.0.0",
|
||||
"yup": "^1.4.0"
|
||||
"vuetify": "^3.7.8",
|
||||
"webfontloader": "^1.6.28"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/addon-essentials": "^7.4.6",
|
||||
"@storybook/addon-interactions": "^7.4.6",
|
||||
"@storybook/addon-links": "^7.4.6",
|
||||
"@storybook/blocks": "^7.4.6",
|
||||
"@storybook/testing-library": "^0.2.2",
|
||||
"@storybook/vue3": "^7.4.6",
|
||||
"@storybook/vue3-vite": "^7.4.6",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
||||
"eslint": "^8.22.0",
|
||||
"eslint-plugin-storybook": "^0.6.14",
|
||||
"eslint-plugin-vue": "^9.3.0",
|
||||
"eslint": "^9.19.0",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"vite": "^4.2.0",
|
||||
"vite-plugin-vuetify": "^1.0.0"
|
||||
"sass-embedded": "^1.83.4",
|
||||
"vite": "^6.0.11",
|
||||
"vite-plugin-vuetify": "^2.0.4"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
+12
-10
@@ -1,17 +1,18 @@
|
||||
<template>
|
||||
<v-card
|
||||
class="rounded-0 h-100 flex-column d-flex"
|
||||
min-height="410"
|
||||
max-height="410"
|
||||
min-height="400"
|
||||
max-height="400"
|
||||
|
||||
>
|
||||
<v-card-title class="pb-1">
|
||||
<v-card-title class="">
|
||||
{{news.title}}
|
||||
</v-card-title>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="d-flex flex-column ">
|
||||
<v-img
|
||||
:src="`${burl}${news.link}`"
|
||||
height="175px"
|
||||
height="170px"
|
||||
width="92%"
|
||||
class="mx-auto"
|
||||
cover
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
|
||||
<v-row class="ma-0 flex-grow-0">
|
||||
<v-col
|
||||
class="py-1 pl-4"
|
||||
@@ -84,7 +85,7 @@
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-divider class="mx-4"/>
|
||||
<v-row class="ma-0 overflow-auto">
|
||||
<v-col
|
||||
class="py-0"
|
||||
@@ -97,14 +98,15 @@
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-divider class="mx-4"/>
|
||||
<v-row class="flex-grow-0 ma-0">
|
||||
<v-col class="d-flex justify-space-between">
|
||||
<v-btn
|
||||
color="more_details_btn"
|
||||
variant="text"
|
||||
|
||||
:to='`/newsfull?id=${news.id}`'
|
||||
size="small"
|
||||
size="small"
|
||||
rounded="xl"
|
||||
append-icon="mdi-step-forward-2"
|
||||
>
|
||||
Подробнее
|
||||
@@ -130,7 +132,7 @@ const accountStore = useAccountStore()
|
||||
export default {
|
||||
|
||||
components: { icoUser },
|
||||
|
||||
name:'NewsCard',
|
||||
props: {
|
||||
news: {
|
||||
type: Object,
|
||||
@@ -41,6 +41,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { declOfNum } from '@/utils/universal_functions'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
export default {
|
||||
@@ -66,11 +67,6 @@ export default {
|
||||
const hours = computed(() => minutes.value * 60);
|
||||
const days = computed(() => hours.value * 24);
|
||||
|
||||
function declOfNum(value, titles) {
|
||||
const cases = [2, 0, 1, 1, 1, 2];
|
||||
return titles[(value % 100 > 4 && value % 100 < 20) ? 2 : cases[(value % 10 < 5) ? value % 10 : 5]];
|
||||
}
|
||||
|
||||
const disabledcard = ref({
|
||||
text: 'окончания',
|
||||
disabled: false
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
<v-divider/>
|
||||
<v-card-actions class="align-self-end py-0">
|
||||
<v-btn
|
||||
color="modal_btn"
|
||||
variant="text"
|
||||
rounded="xl"
|
||||
color="more_details_btn"
|
||||
@click= "$emit('update:opendialog', false)"
|
||||
>
|
||||
Закрыть
|
||||
|
||||
@@ -121,11 +121,11 @@
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import { ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import CKEditor from "@ckeditor/ckeditor5-vue";
|
||||
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
||||
import "@ckeditor/ckeditor5-build-classic/build/translations/ru";
|
||||
import EventDialogEditParticipant from "./event-dialog-edit-participant.vue";
|
||||
import eventDialogEdit from "@/components/calendar_of_events/event-dialog-edit.vue";
|
||||
// import CKEditor from "@ckeditor/ckeditor5-vue";
|
||||
// import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
||||
// import "@ckeditor/ckeditor5-build-classic/build/translations/ru";
|
||||
// import EventDialogEditParticipant from "./event-dialog-edit-participant.vue";
|
||||
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -136,8 +136,8 @@ export default {
|
||||
},
|
||||
components: {
|
||||
// Use the <ckeditor> component in this view.
|
||||
ckeditor: CKEditor.component,
|
||||
EventDialogEditParticipant,
|
||||
// ckeditor: CKEditor.component,
|
||||
// EventDialogEditParticipant,
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<v-spacer/>
|
||||
<v-btn
|
||||
color="modal_btn"
|
||||
variant="text"
|
||||
rounded="xl"
|
||||
text="Закрыть"
|
||||
@click="menusCloses"
|
||||
/>
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
<template>
|
||||
{{ interval }}
|
||||
<v-carousel
|
||||
cycle
|
||||
interval="10000"
|
||||
v-model="currentslide"
|
||||
:interval="interval"
|
||||
cover
|
||||
cycle
|
||||
height="450"
|
||||
hide-delimiters
|
||||
hide-delimiter-background
|
||||
:show-arrows="carous.length<2?false:'hover'"
|
||||
color="white"
|
||||
@update:modelValue="slidechanged"
|
||||
>
|
||||
|
||||
<v-carousel-item
|
||||
v-for="(x, i) in carous"
|
||||
:key="i"
|
||||
|
||||
<template v-for="(x, i) in carous" :key="i">
|
||||
<v-carousel-item
|
||||
v-if="!x.link.endsWith('mp4')"
|
||||
:src="`${burl}${x.link}`"
|
||||
cover
|
||||
eager
|
||||
@@ -67,19 +70,42 @@
|
||||
</v-card>
|
||||
</v-container>
|
||||
</v-carousel-item>
|
||||
<v-carousel-item v-else >
|
||||
|
||||
<div class="d-flex justify-center">
|
||||
<video
|
||||
ref="videoElement"
|
||||
style="height: 450px"
|
||||
|
||||
controls
|
||||
autoplay
|
||||
preload="metadata"
|
||||
@ended="ended"
|
||||
@loadedmetadata="interval = 10000000000"
|
||||
>
|
||||
<source :src="`${burl}${x.link}`" type="video/mp4" />
|
||||
|
||||
Текущий браузер не поддерживает воспроизведение этого видео.
|
||||
</video>
|
||||
</div>
|
||||
<!-- currentslide=currentslide<carous.length-1?currentslide+1:0 -->
|
||||
</v-carousel-item>
|
||||
</template>
|
||||
</v-carousel>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
|
||||
export default {
|
||||
|
||||
setup() {
|
||||
const currentslide=ref(0)
|
||||
const burl = baseURL.slice(0, -1);
|
||||
|
||||
const videoElement=ref(null)
|
||||
const carous = ref([{ link: `/media/newsimage/scales.jpg`, "title": null, "text": "" }]);
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
@@ -92,6 +118,7 @@ export default {
|
||||
feedalert.ico = "mdi-alert-outline";
|
||||
}
|
||||
|
||||
console.log(result.data);
|
||||
if (result.data.result.length > 0) {
|
||||
carous.value = result.data.result;
|
||||
}
|
||||
@@ -100,10 +127,53 @@ export default {
|
||||
};
|
||||
|
||||
getfromserver();
|
||||
const interval=ref(10000)
|
||||
|
||||
const slidechanged=()=>{
|
||||
console.log(videoElement.value);
|
||||
|
||||
if (carous.value[currentslide.value].link.endsWith('mp4')){
|
||||
videoElement.value.forEach((e)=>{
|
||||
if(e.currentSrc!=burl+carous.value[currentslide.value].link){
|
||||
e.pause()
|
||||
|
||||
}else{
|
||||
console.log("sdflkhlh");
|
||||
e.play()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(carous.value[currentslide.value].link.endsWith('mp4')){
|
||||
interval.value = 10000000000
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
interval.value=10000
|
||||
}
|
||||
|
||||
}
|
||||
const ended = (val)=>{
|
||||
val.target.currentTime = 0
|
||||
val.target.pause();
|
||||
document.exitFullscreen()
|
||||
currentslide.value=currentslide.value<carous.value.length-1?currentslide.value+1:0
|
||||
}
|
||||
|
||||
return {
|
||||
slidechanged,
|
||||
videoElement,
|
||||
currentslide,
|
||||
interval,
|
||||
// intervalcomp,
|
||||
burl,
|
||||
carous,
|
||||
ended
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
</v-card>
|
||||
<v-divider class="" />
|
||||
<v-card-actions class="pb-0" style="place-content: end">
|
||||
<v-btn color="more_details_btn" variant="text" @click="onSubmit">
|
||||
<v-btn
|
||||
color="more_details_btn" rounded="xl" @click="onSubmit">
|
||||
Закрыть
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-row class="py-2">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row class=" flex-grow-1 pa-1 d-flex h-0 overflow-auto">
|
||||
<v-row class="h-0 overflow-auto">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
@@ -11,27 +11,40 @@
|
||||
sm=12
|
||||
xs=12
|
||||
cols=12
|
||||
class="d-flex pa-1 flex-column "
|
||||
class="d-flex pa-0 flex-column "
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
<NewsCard :news="x" class="ma-1"/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row class="flex-grow-0 ">
|
||||
<v-col class="pa-0" >
|
||||
<v-pagination
|
||||
density="compact"
|
||||
v-model="page"
|
||||
:length=visiblePage
|
||||
:length="visiblePage"
|
||||
:total-visible="7"
|
||||
@update:modelValue="loadNewsAll"
|
||||
/>
|
||||
>
|
||||
<template v-slot:item="item">
|
||||
|
||||
<v-btn icon density="compact"
|
||||
:color="item.isActive?'more_details_btn':'grey-ligten-3'"
|
||||
@click="pager(item.page)"
|
||||
>{{ item.page }}</v-btn>
|
||||
</template>
|
||||
|
||||
|
||||
</v-pagination>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0 py-0">
|
||||
<v-col class="flex-grow-0 py-0 " >
|
||||
<v-select
|
||||
style="width:53px"
|
||||
hide-details
|
||||
hide-selected
|
||||
density="compact"
|
||||
hide-selected
|
||||
|
||||
v-model="countpage"
|
||||
rounded
|
||||
variant="underlined"
|
||||
@@ -50,12 +63,12 @@
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import newsCard from './UI/news-card.vue'
|
||||
import NewsCard from './UI/NewsCard.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
newsCard
|
||||
NewsCard
|
||||
},
|
||||
|
||||
setup(){
|
||||
@@ -68,21 +81,27 @@ export default {
|
||||
const visiblePage = ref(0)
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path.slice(1)}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage/countpage.value
|
||||
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
|
||||
visiblePage.value = countetnews.value <= 1 ? 1 : Math.ceil(countetnews.value)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
loadNewsAll()
|
||||
const pager=(val)=>{
|
||||
page.value=Number(val)
|
||||
loadNewsAll()
|
||||
}
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
|
||||
countetnews,
|
||||
pager,
|
||||
page,
|
||||
countpage,
|
||||
visiblePage,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row class="mt-0 h-0 overflow-auto ">
|
||||
<v-row class="">
|
||||
<v-col class="flex-column d-flex pa-0">
|
||||
<v-row class="mt-0 mx-3 h-0 overflow-auto ">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
class="pb-1 pt-0"
|
||||
class="py-1"
|
||||
lg=12
|
||||
md=6
|
||||
sm=6
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
|
||||
<NewsCard :news="x"/>
|
||||
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfotoOne"
|
||||
@@ -73,12 +73,12 @@
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import newsCard from './UI/news-card.vue'
|
||||
import NewsCard from './UI/NewsCard.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
newsCard
|
||||
NewsCard
|
||||
},
|
||||
|
||||
setup(){
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<!-- Раздел с назначенным тестированием -->
|
||||
<template>
|
||||
<div class="my-4 text-h5"> {{ title }} </div>
|
||||
<v-container :fluid="true">
|
||||
<v-row>
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
append-inner-icon="mdi-magnify"
|
||||
label="Найти тестирование по названию"
|
||||
variant="solo"
|
||||
@click:append-inner="searchTest"
|
||||
clearable/>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<!-- Карточка где буду отрисовываться тесты в цикле -->
|
||||
<v-card v-for="cardValue in searchTest" :key="cardValue.id" class="my-2 border-sm">
|
||||
<v-row class="pa-2">
|
||||
<v-col cols="1">
|
||||
<v-img height="125" :src="cardValue.file" />
|
||||
</v-col>
|
||||
<v-col cols="auto" class="d-flex flex-grow-1">
|
||||
<div class="d-flex flex-column justify-center flex-grow-1">
|
||||
<div class="text-body-1 font-weight-medium mb-2">{{ cardValue.name }}</div>
|
||||
<div class="text-body-1 text-disabled mb-2">{{ cardValue.description }}</div>
|
||||
<div class="d-flex ga-4">
|
||||
<slot name="results"></slot>
|
||||
<div v-for="icon in activeTabIcon">
|
||||
<v-icon :color="icon.color" :icon="icon.icon" size="large" />
|
||||
<span class="ml-1">{{ momenter(cardValue[icon.field], icon.field) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="auto" class="align-self-center">
|
||||
<slot name="buttons"></slot>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
<!-- Если данные отсутствуют, выводим сообщение об этом -->
|
||||
<v-container v-if="!searchTest.length" :fluid="true">
|
||||
<v-row class="align-center flex-column">
|
||||
<v-icon icon="mdi-note-off-outline" color="grey-lighten-1" size="x-large" />
|
||||
<v-card-title class="text-h4 text-grey-lighten-1">Данные не найдены</v-card-title>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
import { declOfNum } from '@/utils/universal_functions'
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: 'Не забыть передать тайтл сюда!',
|
||||
},
|
||||
activeTab: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
testingCard: {
|
||||
type: Array,
|
||||
default: () => [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
|
||||
type: 'test',
|
||||
description: 'Краткое описание тестирования',
|
||||
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
dateend: new Date(),
|
||||
question_count: 20,
|
||||
time: 20,
|
||||
attemps_number: 3,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Удобство раздела тестирования',
|
||||
type: 'test',
|
||||
description: 'Опрос среди сотрудников ЦОД МФ',
|
||||
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
dateend: new Date(),
|
||||
question_count: 28,
|
||||
time: 15,
|
||||
attemps_number: 1,
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const search = ref('');
|
||||
|
||||
const searchTest = computed(() => {
|
||||
if (!search.value) return props.testingCard
|
||||
return props.testingCard.filter(item => item.name.toLowerCase().includes(search.value.toLowerCase()))
|
||||
})
|
||||
|
||||
const activeTabIcon = computed(() => {
|
||||
let icons = [
|
||||
// иконки для использования в карточках
|
||||
{
|
||||
icon: 'mdi-calendar-clock',
|
||||
field: 'dateend',
|
||||
color: 'teal-darken-1',
|
||||
},
|
||||
{
|
||||
icon: 'mdi-clipboard-list-outline',
|
||||
field: 'question_count',
|
||||
color: 'teal-darken-1',
|
||||
},
|
||||
{
|
||||
icon: 'mdi-timer-outline',
|
||||
field: 'time',
|
||||
color: 'teal-darken-1',
|
||||
},
|
||||
{
|
||||
icon: 'mdi-fire',
|
||||
field: 'attemps_number',
|
||||
color: '#FF9800'
|
||||
},
|
||||
]
|
||||
if (props.activeTab == 0) {
|
||||
return icons
|
||||
} else {
|
||||
return icons.splice(1,2)
|
||||
}
|
||||
})
|
||||
|
||||
const momenter = (val, field)=>{
|
||||
if (field == 'dateend'){
|
||||
return 'до ' + moment(val).format('DD.MM.YYYY, HH:mm')
|
||||
}
|
||||
else if (field == 'question_count') {
|
||||
return val + declOfNum(val, [' вопрос', ' вопроса', ' вопросов'])
|
||||
}
|
||||
else if (field == 'time') {
|
||||
return val + declOfNum(val, [' минута', ' минуты', ' минут'])
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
return { search, searchTest, momenter, activeTabIcon, baseURL }
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<v-card-title>{{ item.title }}</v-card-title>
|
||||
<v-card-subtitle>
|
||||
<div>{{ item.description }}</div>
|
||||
</v-card-subtitle>
|
||||
<v-card-actions class="ga-4">
|
||||
<div>
|
||||
<v-icon color="teal-darken-4">mdi-calendar</v-icon>
|
||||
<strong> До:</strong> {{ new Date(item.date).toLocaleDateString() }}
|
||||
</div>
|
||||
<div>
|
||||
<v-icon color="teal-darken-4">mdi-calendar-text</v-icon>
|
||||
<strong> Вопросов:</strong> {{ item.questions }}
|
||||
</div>
|
||||
<div v-if="item.time">
|
||||
<v-icon color="teal-darken-4">mdi-clock</v-icon>
|
||||
<strong> Время:</strong> {{ item.time }}
|
||||
</div>
|
||||
<div v-if="item.attempts">
|
||||
<v-icon color="deep-orange-accent-4">mdi-alert-outline</v-icon>
|
||||
<strong> Попытки:</strong> {{ item.attempts }}
|
||||
</div>
|
||||
</v-card-actions>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -62,6 +62,7 @@
|
||||
:disabled="result[question.id]?.length >= question.settings.multiChoice && !result[question.id]?.includes(answer.id)"
|
||||
density="compact">
|
||||
{{ answer.employee?.fio || answer.name }}
|
||||
|
||||
<template v-slot:prepend="{ isSelected }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
||||
@@ -148,15 +149,11 @@ 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() {
|
||||
return spravURL
|
||||
}
|
||||
},
|
||||
|
||||
emits: ['closer'],
|
||||
props: {
|
||||
data: {
|
||||
@@ -255,6 +252,8 @@ export default {
|
||||
|
||||
|
||||
return {
|
||||
spravURL,
|
||||
checkremote,
|
||||
groupedAnswers,
|
||||
activepick,
|
||||
opendialog,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<v-container class="h-100">
|
||||
<v-row justify="center" align="center" class="h-100">
|
||||
<v-card-title class="text-h4 text-grey-lighten-1">{{ current }} голосований сейчас нет</v-card-title>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
current: ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -100,7 +100,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'
|
||||
import defaultImage from '@/assets/emblem.png'
|
||||
|
||||
export default {
|
||||
components: {Timer},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
|
||||
<v-row class="pt-2 mx-1 flex-column fill-height flex-grow-0 " >
|
||||
<v-row class="pt-2 mx-1 flex-column fill-height flex-grow-0 ">
|
||||
<template v-if="isVoteCreated">
|
||||
<v-card class="d-flex flex-column flex-grow-1 flex-shrink-0 text-center pa-8" flat>
|
||||
<v-spacer></v-spacer>
|
||||
@@ -14,10 +14,8 @@
|
||||
</v-card>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
||||
<div class="v-col flex-grow-1 flex-shrink-0 ">
|
||||
|
||||
<v-stepper v-model="step" editable class="d-flex flex-column fill-height">
|
||||
<v-stepper v-model="step" class="d-flex flex-column fill-height" editable>
|
||||
<v-stepper-header class="flex-grow-0 flex-shrink-1">
|
||||
<v-stepper-item :complete="step > 0" step="1">Основная информация
|
||||
|
||||
@@ -30,44 +28,45 @@
|
||||
|
||||
<v-stepper-window class="fill-height">
|
||||
<!-- Основная информация -->
|
||||
<v-stepper-window-item step="1" class="fill-height">
|
||||
<v-card flat class="fill-height d-flex flex-column ">
|
||||
<v-stepper-window-item class="fill-height" step="1">
|
||||
<v-card class="fill-height d-flex flex-column " flat>
|
||||
<v-card-title>Основная информация</v-card-title>
|
||||
<v-card-text class="d-flex flex-column overflow-auto">
|
||||
<v-text-field v-model="form.title" :rules="[rules.required]" label="Название голосования"
|
||||
class="flex-grow-0 flex-shrink-1"
|
||||
variant="underlined"></v-text-field>
|
||||
<div class="flex-grow-1 flex-shrink-0">
|
||||
<v-text-field v-model="form.title" :rules="[rules.required]" class="flex-grow-0 flex-shrink-1"
|
||||
label="Название голосования"
|
||||
variant="underlined"></v-text-field>
|
||||
<div class="flex-grow-1 flex-shrink-0">
|
||||
|
||||
<v-textarea v-model="form.description" :rules="[rules.required]" label="Описание"
|
||||
<v-textarea v-model="form.description" :rules="[rules.required]" label="Описание"
|
||||
|
||||
variant="outlined"></v-textarea>
|
||||
</div>
|
||||
variant="outlined"></v-textarea>
|
||||
</div>
|
||||
<v-divider></v-divider>
|
||||
<div class="flex-grow-0 flex-shrink-1">
|
||||
<div class="pt-2 text-overline text-grey">Дата и время:</div>
|
||||
<div class="d-flex justify-space-around">
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
||||
<date-select :datedefault="form.startDate" @returndate="returnstart" />
|
||||
<v-select v-model="selectedTimeStart" :items="timeOptions" density="compact" variant="plain"
|
||||
hide-details>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon icon="mdi-timer" size="xsmall" color="red"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
<div class="pt-2 text-overline text-grey">Дата и время:</div>
|
||||
<div class="d-flex justify-space-around">
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
||||
<date-select :datedefault="form.startDate" @returndate="returnstart"/>
|
||||
<v-select v-model="selectedTimeStart" :items="timeOptions" density="compact" hide-details
|
||||
variant="plain">
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">окончание:</h6>
|
||||
<date-select :datedefault="form.endDate" @returndate="returnend"/>
|
||||
<v-select v-model="selectedTimeEnd" :items="timeOptions" density="compact" hide-details
|
||||
outlined
|
||||
variant="plain">
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">окончание:</h6>
|
||||
<date-select :datedefault="form.endDate" @returndate="returnend" />
|
||||
<v-select v-model="selectedTimeEnd" :items="timeOptions" density="compact" outlined variant="plain"
|
||||
hide-details>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon icon="mdi-timer" size="xsmall" color="red"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
@@ -78,184 +77,187 @@
|
||||
</v-stepper-window-item>
|
||||
|
||||
<!-- Создание опроса -->
|
||||
<v-stepper-window-item step="2" class="fill-height">
|
||||
<v-stepper-window-item class="fill-height" step="2">
|
||||
|
||||
<v-card flat class="fill-height d-flex flex-column">
|
||||
<v-card class="fill-height d-flex flex-column" flat>
|
||||
<v-card-title>Создание опроса:</v-card-title>
|
||||
<v-card-text style="max-height: 62vh; overflow-y: auto;">
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
|
||||
<div class="d-flex">
|
||||
<v-text-field density="comfortable" v-model="question.text" :label="'Вопрос ' + (index + 1)"
|
||||
:rules="[rules.required]" variant="underlined">
|
||||
<template v-slot:append>
|
||||
<v-btn color="error" icon="mdi-delete" size="small" @click="removeQuestion(index)" />
|
||||
</template>
|
||||
|
||||
</v-text-field>
|
||||
</div>
|
||||
<v-file-input density="comfortable" v-model="question.image" accept="image/*"
|
||||
label="Картинка для вопроса" variant="outlined"></v-file-input>
|
||||
<v-divider></v-divider>
|
||||
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
|
||||
<div class="v-row ">
|
||||
|
||||
<v-col cols="auto" class="align-self-center font-weight-bold py-0">
|
||||
Тип ответа
|
||||
</v-col>
|
||||
<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>
|
||||
<v-spacer/>
|
||||
<v-col cols="auto" class="align-self-center font-weight-bold">
|
||||
Число возможных ответов
|
||||
</v-col>
|
||||
<v-col cols="1" class="">
|
||||
<v-text-field density="compact" v-model="question.settings.multiChoice"
|
||||
:rules="[rules.required && question.settings.multiChoice > 0]" hide-details type="number"
|
||||
min="1" variant="outlined">
|
||||
<template v-slot:prepend>
|
||||
|
||||
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
|
||||
<div class="d-flex">
|
||||
<!-- <v-text-field v-model="question.text" :label="'Вопрос ' + (index + 1)" :rules="[rules.required]"-->
|
||||
<!-- density="comfortable" variant="underlined">-->
|
||||
<v-text-field
|
||||
v-model="question.text"
|
||||
:label="'Вопрос ' + (index + 1)"
|
||||
density="comfortable"
|
||||
variant="underlined"
|
||||
:rules="[rules.required]"
|
||||
@input="updateQuest(index)"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<v-btn color="error" icon="mdi-delete" size="small" @click="removeQuestion(index)"/>
|
||||
</template>
|
||||
|
||||
</v-text-field>
|
||||
</v-col>
|
||||
</div>
|
||||
<div class="v-row">
|
||||
</div>
|
||||
</div>
|
||||
<v-file-input v-model="question.image" accept="image/*" density="comfortable"
|
||||
label="Картинка для вопроса" variant="outlined"></v-file-input>
|
||||
<v-divider></v-divider>
|
||||
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
|
||||
<div class="v-row ">
|
||||
|
||||
<v-card-text class="px-0">
|
||||
<div v-if="question.settings.choice === 'free'">
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(answer, ind) in question.answers" :key="ind" class="d-flex align-start mb-4">
|
||||
<v-text-field v-model="answer.text" :label="'Ответ ' + (ind + 1)" :rules="[rules.required]"
|
||||
class="mr-4" variant="outlined" density="compact"></v-text-field>
|
||||
<v-file-input v-model="answer.image" accept="image/*" dense hide-details label="Картинка"
|
||||
variant="outlined" density="compact"></v-file-input>
|
||||
<v-btn class="ms-1" color="error" icon="mdi-delete" size="small" @click="removeAnswer(index,ind)">
|
||||
<v-col class="align-self-center font-weight-bold py-0" cols="auto">
|
||||
Тип ответа
|
||||
</v-col>
|
||||
<v-col class="py-0 align-self-center " cols="3">
|
||||
|
||||
</v-btn>
|
||||
<v-select v-model="question.settings.choice" :items="questionTypes" :list-props="{density:'compact'}"
|
||||
density="compact"
|
||||
hide-details
|
||||
item-title="name" item-value="choice" label="" variant="outlined"
|
||||
@update:model-value="question.answers=[]"></v-select>
|
||||
<!-- choice -->
|
||||
|
||||
</v-col>
|
||||
<v-spacer/>
|
||||
<v-col class="align-self-center font-weight-bold" cols="auto">
|
||||
Число возможных ответов
|
||||
</v-col>
|
||||
<v-col class="" cols="1">
|
||||
<v-text-field v-model="question.settings.multiChoice" :rules="[rules.required && question.settings.multiChoice > 0]"
|
||||
density="compact" hide-details
|
||||
min="1"
|
||||
type="number" 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'">
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(answer, ind) in question.answers" :key="ind" class="d-flex align-start mb-4">
|
||||
<v-text-field
|
||||
v-model="answer.text"
|
||||
:label="'Ответ ' + (ind + 1)"
|
||||
:rules="[rules.required]"
|
||||
class="mr-4"
|
||||
density="compact"
|
||||
variant="outlined">
|
||||
</v-text-field>
|
||||
<v-file-input
|
||||
v-model="answer.image"
|
||||
accept="image/*"
|
||||
dense
|
||||
density="compact"
|
||||
hide-details
|
||||
label="Картинка"
|
||||
variant="outlined">
|
||||
</v-file-input>
|
||||
<v-btn
|
||||
class="ms-1"
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeAnswer(index, ind)">
|
||||
</v-btn>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="d-flex justify-start">
|
||||
<v-btn color="teal-darken-4" size="small" @click="addAnswer(index)">Добавить ответ</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="v-row">
|
||||
<v-radio-group v-model="question.settings.onlyDep" class="text-caption" inline>
|
||||
<template v-slot:label>
|
||||
<div class="text-body-2 font-weight-bold">Голосование по отделам:</div>
|
||||
</template>
|
||||
<v-radio v-for="x in onlyDepdict" :key="x.name" :value=x.value>
|
||||
<template v-slot:label>
|
||||
<div class="text-caption">{{ x.name }}</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
</div>
|
||||
<v-autocomplete
|
||||
v-model="question.selectedEmployees"
|
||||
:items="allEmployeesgroupedbydep" class=" text-no-wrap"
|
||||
density="compact" item-title="fio" item-value="id" label="Выберите сотрудников" multiple
|
||||
variant="outlined"
|
||||
@update:model-value="(selected)=>question.answers=question.answers.filter(e=>selected.includes(e.text))"
|
||||
>
|
||||
<template #prepend-item>
|
||||
<v-checkbox :model-value="question.selectedEmployees.length===allEmployees.length"
|
||||
class="pa-0"
|
||||
label="Все"
|
||||
@update:model-value="handleSelectAll(question.selectedEmployees.length===allEmployees.length, index)"></v-checkbox>
|
||||
</template>
|
||||
<template #selection="{item}">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)"
|
||||
>
|
||||
|
||||
</transition-group>
|
||||
{{ item.raw.familyname }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<template #item="data">
|
||||
<template v-if="typeof data.item.raw !== 'object'">
|
||||
<v-divider/>
|
||||
<v-list-group class='pa-4 text-overline text-grey'
|
||||
v-text="data.item.raw"></v-list-group>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-list-item
|
||||
|
||||
<div class="d-flex justify-start">
|
||||
<v-btn size="small" color="teal-darken-4" @click="addAnswer(index)">Добавить ответ</v-btn>
|
||||
:append-avatar="checkremote(`${spravURL}${data.item.raw.login}.jpg`)"
|
||||
density="compact"
|
||||
slim
|
||||
@click="onEmployeesChange(data.item.raw.id, index)"
|
||||
>
|
||||
<template #prepend>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<v-checkbox :model-value="question.selectedEmployees.includes(data.item.raw.id)"
|
||||
|
||||
<div class="v-row">
|
||||
|
||||
<v-radio-group class="text-caption" inline v-model="question.settings.onlyDep">
|
||||
<template v-slot:label>
|
||||
<div class="text-body-2 font-weight-bold">Голосование по отделам:</div>
|
||||
density="compact"
|
||||
hide-details></v-checkbox>
|
||||
</template>
|
||||
<v-radio v-for="x in onlyDepdict" :key="x.name" :value=x.value>
|
||||
<template v-slot:label>
|
||||
<div class="text-caption">{{ x.name }}</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<v-autocomplete
|
||||
class=" text-no-wrap"
|
||||
v-model="question.selectedEmployees" :items="allEmployeesgroupedbydep"
|
||||
item-title="fio" item-value="id" label="Выберите сотрудников" multiple variant="outlined"
|
||||
density="compact"
|
||||
@update:model-value="(selected)=>question.answers=question.answers.filter(e=>selected.includes(e.text))"
|
||||
>
|
||||
<template #prepend-item>
|
||||
<v-checkbox class="pa-0" :model-value="question.selectedEmployees.length==allEmployees.length" label="Все"
|
||||
@update:model-value="handleSelectAll(question.selectedEmployees.length==allEmployees.length, index)"></v-checkbox>
|
||||
</template>
|
||||
<template #selection="{item}">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)"
|
||||
>
|
||||
|
||||
{{ item.raw.familyname }}</v-chip>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template #item="data">
|
||||
|
||||
<template v-if="typeof data.item.raw !== 'object'">
|
||||
<v-divider/>
|
||||
<v-list-group class='pa-4 text-overline text-grey' v-text="data.item.raw"></v-list-group>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-list-item
|
||||
|
||||
slim
|
||||
density="compact"
|
||||
:append-avatar="checkremote(`${spravURL}${data.item.raw.login}.jpg`)"
|
||||
@click="onEmployeesChange(data.item.raw.id, index)"
|
||||
>
|
||||
<template #prepend>
|
||||
|
||||
<v-checkbox hide-details
|
||||
|
||||
:model-value="question.selectedEmployees.includes(data.item.raw.id)"
|
||||
density="compact"></v-checkbox>
|
||||
</template>
|
||||
<v-list-item-title class="text-third" v-text="data.item.raw.fio"></v-list-item-title>
|
||||
</v-list-item>
|
||||
|
||||
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</v-autocomplete>
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(person, ind) in question.answers" :key="person" class="v-row align-center mb-4">
|
||||
<v-col cols="7" class="py-0" >
|
||||
|
||||
<v-chip :prepend-avatar="checkremote(`${spravURL}${findEmployeeById(person.text)?.login}.jpg`)" :text="findEmployeeById(person.text)?.fio ">
|
||||
|
||||
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-col class="py-0 d-flex" cols="5">
|
||||
<v-file-input v-model="person.image" accept="image/*" dense hide-details label="Картинка"
|
||||
variant="outlined" density="compact"></v-file-input>
|
||||
<v-btn class="ms-1" color="error" icon="mdi-delete" size="small"
|
||||
@click="question.selectedEmployees.splice(ind,1); removeAnswer(index,ind)">
|
||||
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-list-item-title class="text-third" v-text="data.item.raw.fio"></v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(person, ind) in question.answers" :key="person"
|
||||
class="v-row align-center mb-4">
|
||||
<v-col class="py-0" cols="7">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${findEmployeeById(person.text)?.login}.jpg`)"
|
||||
:text="findEmployeeById(person.text)?.fio ">
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-col class="py-0 d-flex" cols="5">
|
||||
<v-file-input v-model="person.image" accept="image/*" dense density="compact"
|
||||
hide-details
|
||||
label="Картинка" variant="outlined"></v-file-input>
|
||||
<v-btn class="ms-1" color="error" icon="mdi-delete" size="small"
|
||||
@click="question.selectedEmployees.splice(ind,1); removeAnswer(index,ind)">
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</transition-group>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</transition-group>
|
||||
<v-divider class="ma-2 pa-1"></v-divider>
|
||||
<div class="d-flex justify-center">
|
||||
|
||||
<v-btn size="small" color="orange-darken-4" @click="addQuestion">Добавить вопрос</v-btn>
|
||||
<v-btn color="orange-darken-4" size="small" @click="addQuestion">Добавить вопрос</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -267,39 +269,49 @@
|
||||
</v-stepper-window-item>
|
||||
|
||||
<!-- Подтверждение -->
|
||||
<v-stepper-window-item step="3" class="fill-height">
|
||||
<v-stepper-window-item class="fill-height" step="3">
|
||||
|
||||
<v-card flat class="fill-height d-flex flex-column">
|
||||
<v-card class="fill-height d-flex flex-column" flat>
|
||||
<v-card-title>Подтверждение</v-card-title>
|
||||
<v-card-text style="max-height: 62vh; overflow-y: auto;">
|
||||
<v-alert v-if="errorMessage" class="mb-4 " type="error">
|
||||
{{ errorMessage }}
|
||||
</v-alert>
|
||||
|
||||
<p><v-icon size="xsmall" :class="form.title===null||form.title.length==0?'':'opacity-0'" color='red' icon="mdi-alert"/><strong class="px-2">Название:</strong> {{ form.title }}</p>
|
||||
<p><v-icon size="xsmall" :class="form.description===null||form.description.length==0?'':'opacity-0'" color='red' icon="mdi-alert"/><strong class="px-2">Описание:</strong> {{ form.description }}</p>
|
||||
<p>
|
||||
<v-icon :class="form.title===null||form.title.length===0?'':'opacity-0'" color='red' icon="mdi-alert"
|
||||
size="xsmall"/>
|
||||
<strong class="px-2">Название:</strong> {{ form.title }}
|
||||
</p>
|
||||
<p>
|
||||
<v-icon :class="form.description===null||form.description.length===0?'':'opacity-0'" color='red'
|
||||
icon="mdi-alert" size="xsmall"/>
|
||||
<strong class="px-2">Описание:</strong> {{ form.description }}
|
||||
</p>
|
||||
<p><strong class="px-2">Дата начала:</strong> {{ form.startDate.toLocaleDateString() }}</p>
|
||||
<p><strong class="px-2">Дата окончания:</strong> {{ form.endDate.toLocaleDateString() }}</p>
|
||||
<p><strong class="px-2">Вопросы:</strong></p>
|
||||
|
||||
<v-card v-for="(question, index) in form.questions" :key="index" class="mb-4 pa-3">
|
||||
<div class="pa-2">
|
||||
<v-card v-for="(question, index) in form.questions" :key="index" class="mb-4 pa-3">
|
||||
<div class="pa-2">
|
||||
|
||||
<p><strong>Вопрос {{ index + 1 }}:</strong> {{ question.text }} ({{ question.type }})</p>
|
||||
<p><strong>Вопрос {{ index + 1 }}:</strong> {{ question.text }} ({{ question.type }})</p>
|
||||
|
||||
<div v-if="question.settings.choice === 'free' && question.answers.length">
|
||||
<p><strong>Варианты ответов:</strong></p>
|
||||
<div v-if="question.settings.choice === 'free' && question.answers.length">
|
||||
<p><strong>Варианты ответов:</strong></p>
|
||||
|
||||
|
||||
<ul>
|
||||
<li v-for="(answer, answerIndex) in question.answers" :key="answerIndex">
|
||||
{{ answer.text }}
|
||||
<ul>
|
||||
<li v-for="(answer, answerIndex) in question.answers" :key="answerIndex">
|
||||
{{ answer.text }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="question.settings.choice === 'employee' && question.answers.length">
|
||||
<div>Количество допустимых ответов: {{ question.settings.multiChoice }}</div>
|
||||
<div class="">Голосование по отделам: {{ onlyDepdict.find(e=>e.value===question.settings.onlyDep).name}}</div>
|
||||
<div class="">Голосование по отделам:
|
||||
{{ onlyDepdict.find(e => e.value === question.settings.onlyDep).name }}
|
||||
</div>
|
||||
<p><strong>Выбранные сотрудники:</strong></p>
|
||||
<ul>
|
||||
<li v-for="employeeId in question.answers" :key="employeeId">
|
||||
@@ -308,12 +320,14 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-card>
|
||||
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
||||
<v-btn :disabled="errorMessage!=''" color="teal-darken-4" size="medium" @click="saveVoting">Сохранить</v-btn>
|
||||
<v-btn :disabled="errorMessage!=''" color="teal-darken-4" size="medium" @click="saveVoting">
|
||||
Сохранить
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
|
||||
</v-card>
|
||||
@@ -329,18 +343,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { spravURL } from "@/utils/axios-api";
|
||||
import { createVote, getEmployees } from "@/utils/axios-api";
|
||||
import {computed, ref, watch} from "vue";
|
||||
import {createVote, getEmployees, spravURL} from "@/utils/axios-api";
|
||||
import DateSelect from "@/components/UI/date-select.vue";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import { checkremote } from "@/utils/universal_functions";
|
||||
import {checkremote} from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
components: { DateSelect },
|
||||
components: {DateSelect},
|
||||
emits: ['updating'],
|
||||
setup(props, { emit }) {
|
||||
const accountStore = useAccountStore();
|
||||
const user = accountStore.user;
|
||||
setup(props, {emit}) {
|
||||
const step = ref(0);
|
||||
const isVoteCreated = ref(false);
|
||||
const form = ref({
|
||||
@@ -356,7 +367,7 @@ export default {
|
||||
};
|
||||
|
||||
const currentQuestionIndex = ref(0);
|
||||
const questionTypes = [{ name: "Ввести вручную", choice: 'free' }, { name: "Выбрать сотрудника", choice: 'employee' }];
|
||||
const questionTypes = [{name: "Ввести вручную", choice: 'free'}, {name: "Выбрать сотрудника", choice: 'employee'}];
|
||||
|
||||
const groupedEmployees = ref([]);
|
||||
const allEmployees = computed(() => [
|
||||
@@ -369,10 +380,10 @@ export default {
|
||||
const currentQuestion = computed(() =>
|
||||
form.value.questions[currentQuestionIndex.value] || null
|
||||
);
|
||||
const allEmployeesgroupedbydep = computed(()=>{
|
||||
const allEmployeesgroupedbydep = computed(() => {
|
||||
let groupped = []
|
||||
for (let x of allEmployees.value.sort((a,b)=>a.id_dict_department-b.id_dict_department)){
|
||||
if(!groupped.includes(x.department))groupped.push(x.department)
|
||||
for (let x of allEmployees.value.sort((a, b) => a.id_dict_department - b.id_dict_department)) {
|
||||
if (!groupped.includes(x.department)) groupped.push(x.department)
|
||||
groupped.push(x)
|
||||
}
|
||||
return groupped
|
||||
@@ -382,7 +393,6 @@ export default {
|
||||
|
||||
|
||||
const handleSelectAll = (selected, index) => {
|
||||
console.log(selected, index);
|
||||
if (!selected) {
|
||||
form.value.questions[index].answers = groupedEmployees.value.map((employee) => ({
|
||||
text: employee.id,
|
||||
@@ -391,7 +401,7 @@ export default {
|
||||
form.value.questions[index].selectedEmployees = groupedEmployees.value.map(employee => employee.id);
|
||||
} else {
|
||||
form.value.questions[index].answers = [];
|
||||
form.value.questions[index].selectedEmployees=[]
|
||||
form.value.questions[index].selectedEmployees = []
|
||||
}
|
||||
};
|
||||
|
||||
@@ -400,7 +410,7 @@ export default {
|
||||
const addQuestion = () => {
|
||||
form.value.questions.push({
|
||||
text: "",
|
||||
settings: { choice: "free", multiChoice: 1, onlyDep: null },
|
||||
settings: {choice: "free", multiChoice: 1, onlyDep: null},
|
||||
image: null,
|
||||
answers: [],
|
||||
selectedEmployees: []
|
||||
@@ -415,36 +425,59 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
const updateQuest = (index) => {
|
||||
quests[index] = form.value.questions[index].text.length > 0;
|
||||
};
|
||||
|
||||
const addAnswer = (index) => {
|
||||
if (currentQuestion.value) {
|
||||
form.value.questions[index].answers.push({ text: "", image: null });
|
||||
form.value.questions[index].answers.push({text: "", image: null});
|
||||
}
|
||||
};
|
||||
|
||||
const removeAnswer = (index,ind) => {
|
||||
// if (currentQuestion.value) {
|
||||
form.value.questions[index].answers.splice(ind, 1)
|
||||
// currentQuestion.value.answers.splice(index, 1);
|
||||
// }
|
||||
const removeAnswer = (index, ind) => {
|
||||
form.value.questions[index].answers.splice(ind, 1)
|
||||
};
|
||||
|
||||
const errorMessage = ref("");
|
||||
|
||||
const validateAnswers = () => {
|
||||
return form.value.questions.some((question) => {
|
||||
if (question.settings.choice === "free") {
|
||||
return question.answers.some(
|
||||
(answer) => !answer.text || answer.text.trim() === ""
|
||||
);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
const saveVoting = async () => {
|
||||
if (!form.value.title || !form.value.description || form.value.questions.length < 1) {
|
||||
errorMessage.value = "Все обязательные поля должны быть заполнены";
|
||||
const hasEmptyQuestions = quests.value.includes(false);
|
||||
const hasInvalidAnswers = validateAnswers();
|
||||
|
||||
if (
|
||||
!form.value.title ||
|
||||
!form.value.description ||
|
||||
form.value.questions.length < 1 ||
|
||||
hasEmptyQuestions ||
|
||||
hasInvalidAnswers
|
||||
) {
|
||||
errorMessage.value = "Все обязательные поля и ответы должны быть заполнены";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await createVote(form.value);
|
||||
console.log("Голосование успешно создано:", response);
|
||||
isVoteCreated.value = true;
|
||||
emit('updating', 'active')
|
||||
emit("updating", "active");
|
||||
} catch (error) {
|
||||
console.error("Ошибка при создании голосования:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
title: "",
|
||||
@@ -457,27 +490,49 @@ export default {
|
||||
isVoteCreated.value = false;
|
||||
};
|
||||
|
||||
const timeOptions = Array.from({ length: 48 }, (_, i) => {
|
||||
const timeOptions = Array.from({length: 48}, (_, i) => {
|
||||
const hours = String(Math.floor(i / 2)).padStart(2, "0");
|
||||
const minutes = i % 2 === 0 ? "00" : "30";
|
||||
return `${hours}:${minutes}`;
|
||||
});
|
||||
|
||||
const selectedTimeStart = ref(
|
||||
`${(form.value.startDate.getHours()+1).toString().padStart(2, "0")}:00`
|
||||
`${(form.value.startDate.getHours() + 1).toString().padStart(2, "0")}:00`
|
||||
);
|
||||
|
||||
const selectedTimeEnd = ref(
|
||||
`${(form.value.endDate.getHours()+1).toString().padStart(2, "0")}:00`
|
||||
`${(form.value.endDate.getHours() + 1).toString().padStart(2, "0")}:00`
|
||||
);
|
||||
|
||||
watch(form.value, () => {
|
||||
if (!form.value.title || !form.value.description || form.value.questions < 1) {
|
||||
if (!form.value.title || !form.value.description || form.value.questions.length < 1) {
|
||||
errorMessage.value = "Все обязательные поля должны быть заполнены";
|
||||
} else {
|
||||
errorMessage.value = "";
|
||||
}
|
||||
})
|
||||
}, { deep: true });
|
||||
|
||||
const updateQuests = () => {
|
||||
quests.value = form.value.questions.map((q) => !!q.text.trim());
|
||||
};
|
||||
|
||||
watch(() => form.value.questions, updateQuests, { deep: true });
|
||||
|
||||
watch(
|
||||
() => form.value.questions,
|
||||
(newQuestions) => {
|
||||
const hasEmptyQuestions = newQuestions.some((q) => !q.text || q.text.trim() === "");
|
||||
const hasInvalidAnswers = validateAnswers();
|
||||
|
||||
if (hasEmptyQuestions || hasInvalidAnswers) {
|
||||
errorMessage.value = "Все вопросы и ответы должны быть заполнены";
|
||||
} else {
|
||||
errorMessage.value = "";
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
|
||||
watch(selectedTimeStart, () => {
|
||||
updateStartDate()
|
||||
@@ -503,23 +558,30 @@ export default {
|
||||
form.value.endDate = dates
|
||||
}
|
||||
|
||||
const selectedEmployees = ref([]);
|
||||
|
||||
const onEmployeesChange = (selected, index) => {
|
||||
let ind = form.value.questions[index].selectedEmployees.findIndex(e=>e==selected)
|
||||
if(ind>-1){
|
||||
form.value.questions[index].selectedEmployees.splice(ind,1)
|
||||
let answ =form.value.questions[index].answers.findIndex(a=>a.text==selected)
|
||||
form.value.questions[index].answers.splice(answ,1)
|
||||
}
|
||||
else{
|
||||
let ind = form.value.questions[index].selectedEmployees.findIndex(e => e === selected)
|
||||
if (ind > -1) {
|
||||
form.value.questions[index].selectedEmployees.splice(ind, 1)
|
||||
let answ = form.value.questions[index].answers.findIndex(a => a.text === selected)
|
||||
form.value.questions[index].answers.splice(answ, 1)
|
||||
} else {
|
||||
form.value.questions[index].selectedEmployees.push(selected)
|
||||
form.value.questions[index].answers.push({ text: selected, image: null });
|
||||
form.value.questions[index].answers.push({text: selected, image: null});
|
||||
}
|
||||
};
|
||||
|
||||
const onlyDepdict = [{name:'За любого сотрудника' ,value:null},{name:"Кроме своего отдела" ,value:false}, {name:"Только за свой отдел" ,value:true}]
|
||||
const onlyDepdict = [{name: 'За любого сотрудника', value: null}, {
|
||||
name: "Кроме своего отдела",
|
||||
value: false
|
||||
}, {name: "Только за свой отдел", value: true}]
|
||||
|
||||
const quests = computed(() =>
|
||||
form.value.questions.map((question) => question.text.length > 0)
|
||||
);
|
||||
|
||||
return {
|
||||
quests,
|
||||
updateQuest,
|
||||
onlyDepdict,
|
||||
allEmployeesgroupedbydep,
|
||||
onEmployeesChange,
|
||||
@@ -555,10 +617,12 @@ export default {
|
||||
.v-input--horizontal .v-input__prepend {
|
||||
margin-inline-end: 4px;
|
||||
}
|
||||
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
.list-enter-from,
|
||||
.list-leave-to {
|
||||
opacity: 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-container style="height: 85vh">
|
||||
<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')">
|
||||
@@ -30,10 +30,15 @@
|
||||
</v-tabs>
|
||||
<v-tabs-window v-model="activeTab">
|
||||
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
|
||||
|
||||
<v-row v-if="question.settings.onlyDep">
|
||||
<v-col v-for="(winner, department) in getWinnersByDepartment(question)" :key="department">
|
||||
<v-card>
|
||||
<v-col
|
||||
v-for="(winner, department) in getWinnersByDepartment(question).winnersByDepartment"
|
||||
:key="department"
|
||||
>
|
||||
<v-card
|
||||
class="cursor-pointer"
|
||||
@click="opendialogWinn(department, getWinnersByDepartment(question).groupedByDepartment[department])"
|
||||
style="max-height: 50vh; overflow-y: auto;">
|
||||
<v-card-title>
|
||||
<strong class="text-teal-darken-4">{{ department }}</strong>
|
||||
</v-card-title>
|
||||
@@ -60,14 +65,15 @@
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-card class="mb-4">
|
||||
<v-card-title class="text-teal-darken-3">Топ {{ getTopResults(question).length }}</v-card-title>
|
||||
<v-card-title class="text-teal-darken-3">Распределение голосов:</v-card-title>
|
||||
<v-card-text>
|
||||
<v-list style="max-height: 45vh; overflow-y: auto;">
|
||||
<v-list-item
|
||||
v-for="(answer, answerIndex) in getTopResults(question)"
|
||||
v-for="(answer, answerIndex) in getTopResults(question).filter(el => el.count > 0)"
|
||||
:key="answerIndex"
|
||||
>
|
||||
<p>
|
||||
<strong class="mr-4">{{ answerIndex + 1 }}.</strong>
|
||||
<v-avatar v-if="answer.file === null && answer.employee"
|
||||
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
||||
class="cursor-pointer"
|
||||
@@ -105,10 +111,12 @@
|
||||
</v-row>
|
||||
</v-tabs-window-item>
|
||||
<v-tabs-window-item>
|
||||
<NonVoteSad v-if="Object.keys(groupedByDepartment).length > 0" />
|
||||
<v-card-title v-if="Object.keys(groupedByDepartment).length > 0" class="text-red-darken-3">Не голосовали:</v-card-title>
|
||||
<NonVoteSad v-if="nonVoters.length > 0"/>
|
||||
<v-card-title v-if="nonVoters.length > 0" class="text-red-darken-3">Число сотрудников, которые не проголосовали
|
||||
<strong>{{ nonVoters.length }}</strong>
|
||||
</v-card-title>
|
||||
<v-card-item style="max-height: 50vh; overflow-y: auto;">
|
||||
<NonVoteHappy v-if="Object.keys(groupedByDepartment).length < 1"/>
|
||||
<NonVoteHappy v-if="nonVoters.length < 1"/>
|
||||
<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="`${department}-${voterIndex}`">
|
||||
@@ -119,9 +127,9 @@
|
||||
@click="userCardIndex = `${department}-${voterIndex}`"
|
||||
/>
|
||||
<InfoUserCard
|
||||
:author="voter"
|
||||
:opendialog="userCardIndex === `${department}-${voterIndex}`"
|
||||
@update:opendialog="userCardIndex = $event ? `${department}-${voterIndex}` : null"
|
||||
:author="voter"
|
||||
/>
|
||||
<strong class="ml-4">{{ voter.fio }}</strong>
|
||||
</p>
|
||||
@@ -150,6 +158,60 @@
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-dialog v-model="dialogWinner" max-width="800">
|
||||
<v-card>
|
||||
<v-card-title class="d-flex">
|
||||
<strong class="text-teal-darken-4">Результаты голосования: {{ activeDepartment }}</strong>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialogWinner=false"/>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-list>
|
||||
<v-list-item
|
||||
v-for="(answer, index) in activeDepartmentResults.filter(el => el.count > 0)"
|
||||
:key="index"
|
||||
>
|
||||
<p>
|
||||
<strong class="mr-4">{{ index + 1 }}.</strong>
|
||||
<v-avatar v-if="answer.file === null && answer.employee"
|
||||
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
|
||||
class="cursor-pointer"
|
||||
@click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))"/>
|
||||
<v-avatar v-if="answer.file !== null" :image="baseURL.slice(0, -1) + answer.file"
|
||||
class="cursor-pointer"
|
||||
@click.stop="opendialog(answer)"/>
|
||||
<strong class="ml-4">{{ answer.employee ? answer.employee.fio : answer.name }}</strong>:
|
||||
{{ answer.count }}
|
||||
{{ voteCount(answer.count) }}
|
||||
<template v-if="answer.employee">
|
||||
<br/>
|
||||
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
|
||||
<br/>
|
||||
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
||||
</template>
|
||||
</p>
|
||||
|
||||
<v-progress-linear
|
||||
:model-value="getPercentage(answer.count, questions[index])"
|
||||
color="teal-darken-4"
|
||||
height="13"
|
||||
rounded
|
||||
striped
|
||||
>
|
||||
<template v-slot:default="{ value }">
|
||||
<strong v-if="value < 50" class="text-grey-darken-3">{{ Math.ceil(value) }}%</strong>
|
||||
<strong v-else class="text-grey-lighten-5">{{ Math.ceil(value) }}%</strong>
|
||||
</template>
|
||||
</v-progress-linear>
|
||||
|
||||
</v-list-item>
|
||||
|
||||
</v-list>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -190,6 +252,17 @@ export default {
|
||||
const description = props.data.description;
|
||||
const nonVoters = props.data.nonvoting;
|
||||
|
||||
const activeDepartment = ref(null);
|
||||
const activeDepartmentResults = ref([]);
|
||||
const dialog = ref(false);
|
||||
const dialogWinner = ref(false);
|
||||
|
||||
const opendialogWinn = (department, results) => {
|
||||
activeDepartment.value = department;
|
||||
activeDepartmentResults.value = results;
|
||||
dialogWinner.value = true;
|
||||
};
|
||||
|
||||
const getWinner = (question) => {
|
||||
return question.answers.reduce(
|
||||
(max, answer) => (answer.count > max.count ? answer : max),
|
||||
@@ -198,7 +271,21 @@ export default {
|
||||
};
|
||||
|
||||
const getTopResults = (question) => {
|
||||
return [...question.answers].sort((a, b) => b.count - a.count).slice(0, 10);
|
||||
const sortedAnswers = [...question.answers].sort((a, b) => b.count - a.count);
|
||||
|
||||
// Присваиваем одинаковые индексы для одинаковых значений count
|
||||
let rank = 1;
|
||||
let previousCount = null;
|
||||
return sortedAnswers.map((answer, index) => {
|
||||
if (answer.count !== previousCount) {
|
||||
rank = index + 1;
|
||||
previousCount = answer.count;
|
||||
}
|
||||
return {
|
||||
...answer,
|
||||
rank
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const truncateText = (text, maxLength) => {
|
||||
@@ -225,7 +312,7 @@ export default {
|
||||
};
|
||||
|
||||
const activepick = ref(null)
|
||||
const dialog = ref(false)
|
||||
// const dialog = ref(false)
|
||||
const opendialog = (val) => {
|
||||
dialog.value = true
|
||||
activepick.value = val
|
||||
@@ -244,11 +331,18 @@ export default {
|
||||
|
||||
// Сортируем департаменты по id_dict_department
|
||||
const sortedDepartments = Object.keys(departments).sort((a, b) => {
|
||||
const idA = nonVoters.find(voter => voter.department === a)?.id_dict_department;
|
||||
const idB = nonVoters.find(voter => voter.department === b)?.id_dict_department;
|
||||
const idA = nonVoters.find(voter => voter.department === a)?.id_dict_department || 0;
|
||||
const idB = nonVoters.find(voter => voter.department === b)?.id_dict_department || 0;
|
||||
return idA - idB;
|
||||
});
|
||||
|
||||
// Сортируем сотрудников внутри каждого департамента по id_dict_position
|
||||
sortedDepartments.forEach(department => {
|
||||
departments[department].sort((voterA, voterB) => {
|
||||
return (voterA.id_dict_position || 0) - (voterB.id_dict_position || 0);
|
||||
});
|
||||
});
|
||||
|
||||
// Возвращаем отсортированные департаменты с пользователями
|
||||
const sortedGroupedByDepartment = {};
|
||||
sortedDepartments.forEach(department => {
|
||||
@@ -263,7 +357,7 @@ export default {
|
||||
const getWinnersByDepartment = (question) => {
|
||||
// Группируем ответы по департаментам
|
||||
const groupedByDepartment = question.answers.reduce((groups, answer) => {
|
||||
const department = answer.employee?.department || 'Без отдела'; // Отдел или 'Без отдела' если нет
|
||||
const department = answer.employee?.department;
|
||||
if (!groups[department]) {
|
||||
groups[department] = [];
|
||||
}
|
||||
@@ -282,11 +376,15 @@ export default {
|
||||
winnersByDepartment[department] = winner;
|
||||
}
|
||||
|
||||
return winnersByDepartment;
|
||||
return { groupedByDepartment, winnersByDepartment };
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
opendialogWinn,
|
||||
dialogWinner,
|
||||
activeDepartmentResults,
|
||||
activeDepartment,
|
||||
getWinnersByDepartment,
|
||||
userCardIndex,
|
||||
activepick,
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-list nav density="compact" class="text-blue-grey-lighten-1">
|
||||
|
||||
|
||||
<v-list-item
|
||||
v-for="x in aMenuItem"
|
||||
:key="x"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link ? '_blank' : ''"
|
||||
slim
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
</v-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
|
||||
|
||||
export default {
|
||||
name:'AdminMenu',
|
||||
props: {
|
||||
rail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
setup() {
|
||||
const aMenuItem = [
|
||||
{
|
||||
name: "Панель администратора",
|
||||
ico: "mdi-wrench",
|
||||
link: baseURL + "admin",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
aMenuItem,
|
||||
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -12,7 +12,6 @@
|
||||
<template v-slot:append>
|
||||
<template v-if="accountStore.cod2user">
|
||||
<vcard-user :author="accountStore.user" />
|
||||
|
||||
<v-tooltip location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="black_and_white" v-bind="props" dark to="/faq" icon="mdi-comment-question-outline" />
|
||||
@@ -78,15 +77,15 @@
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row><v-col>
|
||||
<v-list nav density="compact">
|
||||
<template v-for="(x, key) in navigations">
|
||||
<template v-for="(x, key) in navigations" :key="key">
|
||||
<!-- v-if="!('submenu' in x) || (x.path== '/portal' && accountStore.user.is_staff)" -->
|
||||
<v-list-item v-if="(x.path == '/portal'
|
||||
? accountStore.user.is_superuser
|
||||
: true) && !('submenu' in x)
|
||||
<v-list-item v-if="(x.path == '/portal'? accountStore.user.is_superuser : true) && !('submenu' in x)
|
||||
" :key="x.key" :title="x.name" :value="x.name" :href="x.link" :disabled="x.path == ''" :to="x.path"
|
||||
:target="x.link ? '_blank' : ''" color="navigation">
|
||||
|
||||
<!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа -->
|
||||
:target="x.link ? '_blank' : ''"
|
||||
color="navigation"
|
||||
|
||||
>
|
||||
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
@@ -116,7 +115,7 @@
|
||||
</v-list>
|
||||
|
||||
<v-list nav density="compact">
|
||||
<v-list-item v-for="x of mainmenuStore.portallinks" :key="x.name" :title="x.name" :value="x.name"
|
||||
<v-list-item v-for="x of mainmenuStore.portallinks" :key="x.name" :title="x.name" :value="x.name"
|
||||
:href="x.link" color="app_bar" :target="x.link ? '_blank' : ''">
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.imagecode" />
|
||||
@@ -131,17 +130,8 @@
|
||||
|
||||
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||
<v-col>
|
||||
<default-portal-menu-list :rail="rail" />
|
||||
<!-- <v-list nav density="compact" active-class="noneoutline">
|
||||
<default-portal-menu-list :aMenuItem="supperuser"/>
|
||||
<div v-if="getDevelopment()">
|
||||
|
||||
<default-portal-menu-list :aMenuItem="oRasrab"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</v-list> -->
|
||||
<AdminMenu :rail="rail" />
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
@@ -197,8 +187,8 @@ import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import VcardUser from "@/components/UI/fiousercard/vcardUser.vue";
|
||||
import PageCounter from "@/components/UI/defaultportal/page-counter.vue";
|
||||
import DefaultPortalMenuList from "@/layouts/default/DefaultPortalMenuList.vue";
|
||||
import { getDevelopment } from "@/utils/universal_functions";
|
||||
import AdminMenu from "@/layouts/default/AdminMenu.vue";
|
||||
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
export default {
|
||||
@@ -208,7 +198,7 @@ export default {
|
||||
CardLike,
|
||||
VcardUser,
|
||||
PageCounter,
|
||||
DefaultPortalMenuList,
|
||||
AdminMenu,
|
||||
},
|
||||
|
||||
mixins: [uf],
|
||||
@@ -258,30 +248,7 @@ export default {
|
||||
|
||||
mainmenuStore.loadlinks();
|
||||
|
||||
const gittlink = () => {
|
||||
const link =
|
||||
baseURL == "http://127.0.0.1:8000/"
|
||||
? "http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/projects"
|
||||
: "http://maestro.cod2.regions.tax.nalog.ru:3333/COD2/PORTAL_COD2/projects/22";
|
||||
return link;
|
||||
};
|
||||
|
||||
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
||||
|
||||
const oRasrab = [
|
||||
{
|
||||
name: "Gitt",
|
||||
ico: "mdi-github",
|
||||
link: gittlink(),
|
||||
},
|
||||
{
|
||||
name: "Swagger",
|
||||
ico: "mdi-puzzle",
|
||||
link: "http://127.0.0.1:8000/swagger/",
|
||||
},
|
||||
];
|
||||
|
||||
// ]
|
||||
|
||||
|
||||
const navigations = ref([
|
||||
{
|
||||
@@ -354,11 +321,7 @@ export default {
|
||||
path: "/portal",
|
||||
},
|
||||
|
||||
// {
|
||||
// name: 'К празднику',
|
||||
// ico: 'mdi-cake-variant',
|
||||
// path: "/fnshol"
|
||||
// }
|
||||
|
||||
]);
|
||||
|
||||
const imageSrc = computed(() => {
|
||||
@@ -390,7 +353,7 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
getSafetyChapter();
|
||||
// getSafetyChapter();
|
||||
|
||||
return {
|
||||
theme,
|
||||
@@ -402,18 +365,16 @@ export default {
|
||||
navigations,
|
||||
imageSrc,
|
||||
LikeDialog,
|
||||
scrimg,
|
||||
oRasrab,
|
||||
scrimg,
|
||||
rail,
|
||||
showTooltip,
|
||||
menuTruncated,
|
||||
// feedalert,
|
||||
alert,
|
||||
burl,
|
||||
name,
|
||||
closeinfo,
|
||||
baseURL,
|
||||
getDevelopment,
|
||||
|
||||
message,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-list nav density="compact" class="text-blue-grey-lighten-1">
|
||||
<div v-for="(list, key) in aMenuItem" :key="key">
|
||||
<div v-if="showProm(key)">
|
||||
<v-list-item
|
||||
v-for="x in list"
|
||||
:key="x"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link ? '_blank' : ''"
|
||||
slim
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</v-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { getDevelopment } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
rail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
setup() {
|
||||
const gittlink = () => {
|
||||
const link =
|
||||
baseURL == "http://127.0.0.1:8000/"
|
||||
? "http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/projects"
|
||||
: "http://maestro.cod2.regions.tax.nalog.ru:3333/COD2/PORTAL_COD2/projects/22";
|
||||
return link;
|
||||
};
|
||||
const aMenuItem = {
|
||||
prom: [
|
||||
{
|
||||
name: "Панель администратора",
|
||||
ico: "mdi-wrench",
|
||||
link: baseURL + "admin",
|
||||
},
|
||||
],
|
||||
my: [
|
||||
{
|
||||
name: "Gitt",
|
||||
ico: "mdi-github",
|
||||
link: gittlink(),
|
||||
},
|
||||
{
|
||||
name: "Swagger",
|
||||
ico: "mdi-puzzle",
|
||||
link: "http://127.0.0.1:8000/swagger/",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const showProm = (data) => {
|
||||
let show = true;
|
||||
|
||||
if (data == "my" && getDevelopment() == false) {
|
||||
show = false;
|
||||
}
|
||||
|
||||
return show;
|
||||
};
|
||||
|
||||
return {
|
||||
aMenuItem,
|
||||
getDevelopment,
|
||||
showProm,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -140,7 +140,7 @@ const routes = [
|
||||
ico: "mdi-account",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: "/vote",
|
||||
name: "VoteHomePage",
|
||||
@@ -177,11 +177,6 @@ const routes = [
|
||||
ico: "mdi-account",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
path: '/secret',
|
||||
name: 'Secret Page',
|
||||
|
||||
@@ -4,7 +4,7 @@ import axios from "axios";
|
||||
const spravURL = 'http://10.252.44.33/accounting6/images/photo/'
|
||||
const spravURLBase = 'http://10.252.44.33/accounting6/'
|
||||
const baseURL = process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:8000/' : `http://${window.location.host}/`;
|
||||
const baseWS = process.env.NODE_ENV == 'development' ? 'ws://127.0.0.1:8000/' : `ws://${window.location.host}/`;
|
||||
const baseWS = process.env.NODE_ENV === 'development' ? 'ws://127.0.0.1:8000/' : `ws://${window.location.host}/`;
|
||||
// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`;
|
||||
// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`;
|
||||
// для релизного меняем 'http://ukd/'
|
||||
|
||||
@@ -6,8 +6,7 @@ import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
|
||||
import { useRouter } from "vue-router";
|
||||
import moment from "moment";
|
||||
import { ref, onMounted } from "vue";
|
||||
|
||||
|
||||
import defaultImage from '@/assets/FNS-logo-xs.png'
|
||||
export function get_name(namestr) {
|
||||
let arr = namestr.split("/");
|
||||
return arr[arr.length - 1];
|
||||
@@ -57,18 +56,23 @@ export function getfromserverfree(path, reactive) {
|
||||
|
||||
export function checkremote(filecheck) {
|
||||
return process.env.NODE_ENV == "development"
|
||||
? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
|
||||
? defaultImage
|
||||
: filecheck;
|
||||
}
|
||||
|
||||
export default str;
|
||||
|
||||
export function splitname(name) {
|
||||
|
||||
return name.familyname + " " + name.name[0] + "." + name.parentname[0] + ".";
|
||||
}
|
||||
|
||||
export function pagecounter() {
|
||||
// Функция записи посещения страницы сотрудникам.
|
||||
// В случае, если в роуте присутствует ключ мета и в нем ико - тогда производится запись
|
||||
const router = useRouter();
|
||||
|
||||
if('meta' in router.currentRoute.value && 'ico' in router.currentRoute.value.meta){
|
||||
const accountStore = useAccountStore();
|
||||
const appStore = useAppStore();
|
||||
|
||||
@@ -86,9 +90,6 @@ export function pagecounter() {
|
||||
appStore.countvisitor = result.data;
|
||||
});
|
||||
}
|
||||
|
||||
export function getDevelopment() {
|
||||
return process.env.NODE_ENV == "development" ? true : false;
|
||||
}
|
||||
|
||||
export function useICalReader(url) {
|
||||
@@ -167,3 +168,9 @@ export function useICalReader(url) {
|
||||
|
||||
// return { icsContent, fetchICalFile }
|
||||
// }
|
||||
|
||||
// Функция склонения числительных
|
||||
export function declOfNum(value, titles) {
|
||||
const cases = [2, 0, 1, 1, 1, 2];
|
||||
return titles[(value % 100 > 4 && value % 100 < 20) ? 2 : cases[(value % 10 < 5) ? value % 10 : 5]];
|
||||
}
|
||||
@@ -13,8 +13,9 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row style="height:250px">
|
||||
<v-col class="d-flex flex-column pa-1">
|
||||
<v-col class="d-flex flex-column flex-grow-0 pa-1">
|
||||
<!-- <event-calendar/> -->
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
@@ -65,6 +66,8 @@
|
||||
<v-slide-group
|
||||
show-arrows
|
||||
>
|
||||
|
||||
|
||||
<v-slide-group-item
|
||||
v-for="x in favorit"
|
||||
:key="x"
|
||||
@@ -95,6 +98,7 @@
|
||||
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -109,7 +113,7 @@
|
||||
|
||||
import CarouselList from '@/components/carousel-list.vue'
|
||||
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
||||
|
||||
|
||||
|
||||
import NewsHome from '@/components/news-home.vue'
|
||||
import LoadRound from '@/components/load-round.vue'
|
||||
@@ -121,7 +125,7 @@
|
||||
export default {
|
||||
|
||||
components: {
|
||||
|
||||
|
||||
CarouselList,
|
||||
CarouselNumbers,
|
||||
|
||||
|
||||
@@ -1,23 +1,223 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col
|
||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
Тестирование
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container>
|
||||
<v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4">
|
||||
<v-tab>Назначенные ({{ scheduledTests.length }})</v-tab>
|
||||
<v-tab>Завершенные ({{ completedTests.length }})</v-tab>
|
||||
<v-tab>Каталог</v-tab>
|
||||
</v-tabs>
|
||||
|
||||
<v-tabs-window v-model="activeTab">
|
||||
<!-- Назначенные -->
|
||||
<v-tabs-window-item>
|
||||
<v-card outlined>
|
||||
<v-card-title>
|
||||
Назначенные
|
||||
</v-card-title>
|
||||
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
class="mx-4"
|
||||
clearable
|
||||
label="Найти тестирование по названию"
|
||||
variant="outlined"
|
||||
/>
|
||||
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="filteredScheduledTests"
|
||||
hide-default-footer
|
||||
hide-default-header
|
||||
item-value="id"
|
||||
>
|
||||
|
||||
<template #item.image="{ item }">
|
||||
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
||||
</template>
|
||||
|
||||
<template #item.title="{ item }">
|
||||
<TestCard :item="item"/>
|
||||
</template>
|
||||
|
||||
<template #item.actions="{ item }">
|
||||
<v-btn v-if="item.type === 'test'" class="mr-4" color="teal-darken-4" variant="tonal">Тренироваться
|
||||
</v-btn>
|
||||
<v-btn color="teal-darken-4">Пройти</v-btn>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</v-tabs-window-item>
|
||||
|
||||
<!-- Завершенные -->
|
||||
<v-tabs-window-item>
|
||||
<v-card class="mb-6" outlined>
|
||||
<v-card-title>
|
||||
Завершенные
|
||||
</v-card-title>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="filteredCompletedTests"
|
||||
hide-default-footer
|
||||
hide-default-header
|
||||
item-value="id"
|
||||
>
|
||||
<template #item.image="{ item }">
|
||||
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
||||
</template>
|
||||
|
||||
<template #item.title="{ item }">
|
||||
<TestCard :item="item"/>
|
||||
</template>
|
||||
|
||||
<template #item.actions="{ item }">
|
||||
<v-btn color="teal-darken-4">Посмотреть результаты</v-btn>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</v-tabs-window-item>
|
||||
|
||||
<!-- Каталог -->
|
||||
<v-tabs-window-item>
|
||||
<v-card outlined>
|
||||
<v-card-title>
|
||||
Каталог
|
||||
</v-card-title>
|
||||
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
class="mx-4"
|
||||
clearable
|
||||
label="Найти тестирование по названию"
|
||||
variant="outlined"
|
||||
/>
|
||||
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="filteredTests"
|
||||
hide-default-footer
|
||||
hide-default-header
|
||||
item-value="id"
|
||||
>
|
||||
<template #item.image="{ item }">
|
||||
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
||||
</template>
|
||||
|
||||
<template #item.title="{ item }">
|
||||
<TestCard :item="item"/>
|
||||
</template>
|
||||
|
||||
<template #item.actions="{ item }">
|
||||
<v-btn v-if="item.type === 'test'" class="mr-4" color="teal-darken-4" variant="tonal">Тренироваться
|
||||
</v-btn>
|
||||
<v-btn color="teal-darken-4">Пройти</v-btn>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</v-tabs-window-item>
|
||||
</v-tabs-window>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
import {computed, ref} from 'vue';
|
||||
import TestCard from "@/components/tests/TestCard.vue";
|
||||
|
||||
export default {
|
||||
setup(){
|
||||
pagecounter()
|
||||
}
|
||||
}
|
||||
components: {TestCard},
|
||||
setup() {
|
||||
const activeTab = ref(0);
|
||||
const search = ref('');
|
||||
|
||||
const headers = [
|
||||
{text: 'Картинка', value: 'image', sortable: false},
|
||||
{text: 'Название', value: 'title', align: 'start'},
|
||||
{text: 'Действия', value: 'actions', sortable: false},
|
||||
];
|
||||
|
||||
const tests = ref([
|
||||
{
|
||||
id: 1,
|
||||
title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
|
||||
type: 'test',
|
||||
description: 'Краткое описание тестирования',
|
||||
date: '2025-02-28',
|
||||
questions: 20,
|
||||
time: '15 минут',
|
||||
attempts: 1,
|
||||
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'Удобство раздела тестирования',
|
||||
type: 'survey',
|
||||
description: 'Опрос среди сотрудников ЦОД МФ',
|
||||
date: '2025-06-22',
|
||||
questions: 28,
|
||||
time: null,
|
||||
attempts: null,
|
||||
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: 'Законченная карточка законченного тестирования',
|
||||
type: 'survey',
|
||||
description: 'законченное описание законченного тестирования',
|
||||
date: '2024-06-22',
|
||||
questions: 1,
|
||||
time: null,
|
||||
attempts: null,
|
||||
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
},
|
||||
]);
|
||||
|
||||
const currentDate = new Date();
|
||||
|
||||
const scheduledTests = computed(() => {
|
||||
return tests.value.filter(test => new Date(test.date) > currentDate);
|
||||
});
|
||||
|
||||
const completedTests = computed(() => {
|
||||
return tests.value.filter(test => new Date(test.date) <= currentDate);
|
||||
});
|
||||
|
||||
const filteredScheduledTests = computed(() => {
|
||||
if (!search.value) return scheduledTests.value;
|
||||
return scheduledTests.value.filter(test =>
|
||||
test.title.toLowerCase().includes(search.value.toLowerCase())
|
||||
);
|
||||
});
|
||||
|
||||
const filteredCompletedTests = computed(() => {
|
||||
if (!search.value) return completedTests.value;
|
||||
return completedTests.value.filter(test =>
|
||||
test.title.toLowerCase().includes(search.value.toLowerCase())
|
||||
);
|
||||
});
|
||||
|
||||
const filteredTests = computed(() => {
|
||||
if (!search.value) return tests.value.filter(test => new Date(test.date) > currentDate);
|
||||
return tests.value.filter(test => new Date(test.date) > currentDate)
|
||||
.filter((test) =>
|
||||
test.title.toLowerCase().includes(search.value.toLowerCase())
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
activeTab,
|
||||
search,
|
||||
headers,
|
||||
tests,
|
||||
filteredTests,
|
||||
filteredScheduledTests,
|
||||
filteredCompletedTests,
|
||||
scheduledTests,
|
||||
completedTests,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
.v-data-table__wrapper {
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -7,22 +7,22 @@
|
||||
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">
|
||||
<v-row class="mx-2">
|
||||
<v-row v-if="sortedVotes.length > 0" class="mx-2">
|
||||
<v-col
|
||||
v-for="voting in sortedVotes"
|
||||
:key="voting.id"
|
||||
cols="12"
|
||||
lg="3"
|
||||
md="4"
|
||||
v-for="voting in sortedVotes"
|
||||
:key="voting.id"
|
||||
cols="12"
|
||||
lg="3"
|
||||
md="4"
|
||||
>
|
||||
<VoteCardVue
|
||||
:isFinished="currentTab==='active'"
|
||||
@@ -33,13 +33,14 @@
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<NoneVote v-else :current="currentTab == 'active' ? 'Текущих' : 'Завершенных'"/>
|
||||
</v-tabs-window-item>
|
||||
<!-- Конструктор -->
|
||||
<v-tabs-window-item v-if="accountStore.user.is_staff" class="h-100 overflow-auto" value="constructor">
|
||||
<VoteConstructor @updating="updating"/>
|
||||
<VoteConstructor @updating="updating" ref="constructor"/>
|
||||
</v-tabs-window-item>
|
||||
</v-window>
|
||||
|
||||
|
||||
<!-- Модальные окна -->
|
||||
<v-dialog v-model="voteModal" @click:outside="closeModal">
|
||||
<CurrentVote :data="res" @closer="closeModal"/>
|
||||
@@ -48,9 +49,6 @@
|
||||
<v-dialog v-model="resultsModal" max-width="1200px" @click:outside="closeModal">
|
||||
<v-card>
|
||||
<VoteResult :data="result" @closer="closeModal" />
|
||||
<v-card-actions>
|
||||
<v-btn @click="closeModal">Закрыть</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
@@ -63,24 +61,25 @@ import {computed, ref, watch} from "vue";
|
||||
import VoteConstructor from "@/components/vote/VoteConstructor.vue";
|
||||
import CurrentVote from "@/components/vote/CurrentVote.vue";
|
||||
import VoteCardVue from "@/components/vote/VoteCard.vue";
|
||||
import NoneVote from "@/components/vote/NoneVote.vue"
|
||||
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 {formatDate} from "@vueuse/shared";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
|
||||
export default {
|
||||
methods: {formatDate},
|
||||
|
||||
|
||||
components: {CurrentVote, VoteConstructor, VoteCardVue, VoteResult},
|
||||
components: {CurrentVote, VoteConstructor, VoteCardVue, VoteResult, NoneVote},
|
||||
setup() {
|
||||
pagecounter()
|
||||
const accountStore = useAccountStore();
|
||||
const tabs = [
|
||||
{value: "active", text: 'Текущие голосования'},
|
||||
{value: "completed", text: 'Завершенные голосования'},
|
||||
|
||||
|
||||
]
|
||||
|
||||
const currentTab = ref("active");
|
||||
@@ -89,6 +88,7 @@ export default {
|
||||
const route = useRoute();
|
||||
const res = ref(null);
|
||||
const result = ref(null);
|
||||
const constructor = ref(null)
|
||||
|
||||
const updating = async (param) => {
|
||||
const data = await getVotes(param);
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
} catch (error) {
|
||||
console.error("Ошибка при загрузке данных голосования:", error);
|
||||
// res.value = {};
|
||||
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -163,7 +163,15 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
watch(currentTab, async () => await updating(currentTab.value))
|
||||
watch(currentTab, async () => {
|
||||
if (currentTab.value !== 'constructor') {
|
||||
await updating(currentTab.value)
|
||||
console.log(constructor.value, '!!!');
|
||||
if (constructor.value !== null) {
|
||||
constructor.value.resetForm()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route,
|
||||
@@ -205,7 +213,8 @@ export default {
|
||||
updating,
|
||||
res,
|
||||
tabs,
|
||||
result
|
||||
result,
|
||||
constructor
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,27 +1,97 @@
|
||||
<template>
|
||||
<!-- <v-container>
|
||||
<TimerUI :endTime="end" />
|
||||
<SmallTimer :endTime="end"/>
|
||||
</v-container> -->
|
||||
<VoteCard />
|
||||
<v-container :fluid="true">
|
||||
<v-tabs v-model="activeTab" class="mb-2 text-teal-darken-4">
|
||||
<v-tab v-for="tab in tabs" :key="tab.value" :value="tab.value"> {{ tab.title }} </v-tab>
|
||||
</v-tabs>
|
||||
<v-tabs-window v-model="activeTab" class="border-t-thin">
|
||||
<!-- Вкладка назначенные -->
|
||||
<v-tabs-window-item class="my-2 ">
|
||||
<CatalogTest title="Назначенные" :activeTab="activeTab" :testingCard="getAllTests">
|
||||
<template #buttons>
|
||||
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||
Тренироваться
|
||||
</v-btn>
|
||||
<v-btn color="teal-darken-1" elevation="0">
|
||||
Пройти
|
||||
</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
<!-- Вкладка завершенных -->
|
||||
<v-tabs-window-item>
|
||||
<CatalogTest title="Завершенные" :activeTab="activeTab" :testingCard="getAllTests">
|
||||
<template #results>
|
||||
<div>
|
||||
<v-icon icon="mdi-calendar-clock" size="large" />
|
||||
<span class="ml-1">12354</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #buttons>
|
||||
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||
Результаты
|
||||
</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
<!-- Вкладка каталога -->
|
||||
<v-tabs-window-item>
|
||||
<CatalogTest title="Каталог" :activeTab="activeTab" :testingCard="getAllTests">
|
||||
<template #buttons>
|
||||
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||
Тренироваться
|
||||
</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
</v-tabs-window>
|
||||
{{ getAllTests }}
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import TimerUI from "@/components/secret/TimerUI.vue"
|
||||
// import SmallTimer from "@/components/secret/SmallTimer.vue"
|
||||
import VoteCard from "@/components/vote/VoteCard.vue"
|
||||
import CatalogTest from "@/components/testing/CatalogTest.vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
|
||||
import { ref, computed, watch } from "vue"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// TimerUI,
|
||||
// SmallTimer,
|
||||
VoteCard
|
||||
CatalogTest
|
||||
},
|
||||
setup() {
|
||||
// const end = new Date(2025, 0, 14, 15, 58, 5)
|
||||
const activeTab = ref(0);
|
||||
const currentTest = ref('')
|
||||
|
||||
const getAllTests = ref([])
|
||||
|
||||
const getTestById = () => {
|
||||
let status = activeTab.value == 0 ? '?status=active' : activeTab.value == 1 ? '?status=completed' : ''
|
||||
axiosApiInstance.get(`/api/tests/gettests/${status}`).then(resp => getAllTests.value = resp.data).finally(() => {
|
||||
if (activeTab.value == 0) {
|
||||
currentTest.value = getAllTests.value.length
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getTestById()
|
||||
|
||||
watch (() => activeTab.value,
|
||||
() => {
|
||||
getTestById()
|
||||
}
|
||||
)
|
||||
|
||||
const tabs = computed(() => [
|
||||
{ value: 0, title: `Назначенные (${currentTest.value})`, },
|
||||
{ value: 1, title: 'Завершенные', },
|
||||
{ value: 2, title: 'Каталог', },
|
||||
])
|
||||
|
||||
|
||||
return {
|
||||
// end
|
||||
activeTab,
|
||||
tabs,
|
||||
getAllTests,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user