Merge branch 'develop' into сja
This commit is contained in:
commit
8a5112e2b3
6 files changed
+190
-92
No files matched your search
@@ -31,26 +31,35 @@
|
|||||||
</template>
|
</template>
|
||||||
</v-stepper-header>
|
</v-stepper-header>
|
||||||
<v-stepper-window class="d-flex flex-column flex-fill">
|
<v-stepper-window class="d-flex flex-column flex-fill">
|
||||||
<v-stepper-window-item v-for="(question, index) in data.questions" :key="question.numb"
|
<v-stepper-window-item
|
||||||
|
v-for="(question, index) in data.questions"
|
||||||
|
:key="question.numb"
|
||||||
:step="question.numb">
|
:step="question.numb">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-center">{{ question.name }} <span class="text-subtitle-1">(вариантов ответа: {{question.settings.multiChoice}})</span></h3>
|
<h3 class="text-center">
|
||||||
|
{{ question.name }}
|
||||||
|
<span class="text-subtitle-1">(вариантов ответа: {{ question.settings.multiChoice }})</span>
|
||||||
|
</h3>
|
||||||
<v-row>
|
<v-row>
|
||||||
<div class="v-col align-self-start">
|
<div class="v-col align-self-start">
|
||||||
<v-img :src="question.file"
|
<v-img
|
||||||
|
:src="question.file"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
style="max-height:45vh"
|
style="max-height:45vh"
|
||||||
@click.stop="opendialog({answer:question.question, file:question.file})"/>
|
@click.stop="opendialog({ answer: question.question, file: question.file })"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="v-col-6" style="max-height:50vh">
|
<div class="v-col-6" style="max-height:50vh">
|
||||||
<v-list v-model:selected="result[question.id]" density="compact" select-strategy="leaf" slim style="max-height: 100%; overflow-y: auto;">
|
<v-list v-model:selected="result[question.id]" density="compact" select-strategy="leaf" slim style="max-height: 100%; overflow-y: auto;">
|
||||||
|
<template v-for="(answers, department) in groupedAnswers(question)" :key="department">
|
||||||
|
<v-list-item-subtitle v-if="department">
|
||||||
|
{{ department }}
|
||||||
|
</v-list-item-subtitle>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
v-for="answer in question.answers"
|
v-for="answer in answers"
|
||||||
:key="answer.id"
|
:key="answer.id"
|
||||||
:value="answer.id"
|
:value="answer.id"
|
||||||
:disabled="result[question.id].length >= question.settings.multiChoice && !result[question.id].includes(answer.id)"
|
:disabled="result[question.id]?.length >= question.settings.multiChoice && !result[question.id]?.includes(answer.id)"
|
||||||
density="compact"
|
density="compact">
|
||||||
>
|
|
||||||
{{ answer.employee?.fio || answer.name }}
|
{{ answer.employee?.fio || answer.name }}
|
||||||
<template v-slot:prepend="{ isSelected }">
|
<template v-slot:prepend="{ isSelected }">
|
||||||
<v-list-item-action start>
|
<v-list-item-action start>
|
||||||
@@ -58,10 +67,18 @@
|
|||||||
</v-list-item-action>
|
</v-list-item-action>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<v-avatar v-if="answer.file === null && answer.employee" @click.stop="opendialog(checkremote(`${spravURL()}${answer.employee.login}.jpg`))" :image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)" />
|
<v-avatar
|
||||||
<v-avatar v-if="answer.file !== null" :image="answer.file" @click.stop="opendialog(answer)"></v-avatar>
|
v-if="answer.file === null && answer.employee"
|
||||||
|
:image="checkremote(`${spravURL}${answer.employee.login}.jpg`)"
|
||||||
|
@click.stop="opendialog(checkremote(`${spravURL}${answer.employee.login}.jpg`))" />
|
||||||
|
<v-avatar
|
||||||
|
v-if="answer.file !== null"
|
||||||
|
:image="answer.file"
|
||||||
|
@click.stop="opendialog(answer)">
|
||||||
|
</v-avatar>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
</template>
|
||||||
</v-list>
|
</v-list>
|
||||||
</div>
|
</div>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -181,8 +198,6 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const submitVote = () => {
|
const submitVote = () => {
|
||||||
console.log(props.data);
|
|
||||||
console.log("Отправляем данные голосования:", result.value);
|
|
||||||
let voteData = []
|
let voteData = []
|
||||||
for (let val of Object.values(result.value)) {
|
for (let val of Object.values(result.value)) {
|
||||||
val.forEach(e => voteData.push({answer: e, comment: null, user: accountStore.user.id}))
|
val.forEach(e => voteData.push({answer: e, comment: null, user: accountStore.user.id}))
|
||||||
@@ -198,6 +213,7 @@ export default {
|
|||||||
).finally(() => isVoteSubmitted.value = true)
|
).finally(() => isVoteSubmitted.value = true)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const activepick = ref(null)
|
const activepick = ref(null)
|
||||||
const dialog = ref(false)
|
const dialog = ref(false)
|
||||||
const opendialog = (val) => {
|
const opendialog = (val) => {
|
||||||
@@ -205,7 +221,38 @@ export default {
|
|||||||
activepick.value = val
|
activepick.value = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const groupedAnswers = (question) => {
|
||||||
|
const filtered = question.answers.filter(answer => answer.employee?.id !== accountStore.user.is_idEmployee);
|
||||||
|
|
||||||
|
if (question.settings.onlyDep === null) {
|
||||||
|
return groupByDepartment(filtered);
|
||||||
|
} else if (question.settings.onlyDep) {
|
||||||
|
const byDepartment = filtered.filter(
|
||||||
|
(answer) => answer.employee?.department === accountStore.user.department
|
||||||
|
);
|
||||||
|
return groupByDepartment(byDepartment);
|
||||||
|
} else {
|
||||||
|
const notByDepartment = filtered.filter(
|
||||||
|
(answer) => answer.employee?.department !== accountStore.user.department
|
||||||
|
);
|
||||||
|
return groupByDepartment(notByDepartment);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const groupByDepartment = (answers) => {
|
||||||
|
return answers.reduce((groups, answer) => {
|
||||||
|
const department = answer.employee?.department || "";
|
||||||
|
if (!groups[department]) {
|
||||||
|
groups[department] = [];
|
||||||
|
}
|
||||||
|
groups[department].push(answer);
|
||||||
|
return groups;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
groupedAnswers,
|
||||||
activepick,
|
activepick,
|
||||||
opendialog,
|
opendialog,
|
||||||
dialog,
|
dialog,
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>{{ voteCard.name }}</span>
|
<span>{{ voteCard.name }}</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
<v-btn v-if="user.id === voteCard.author || user.is_superuser" flat size="medium"
|
<!-- <v-btn v-if="user.id === voteCard.author || user.is_superuser" flat size="medium"-->
|
||||||
@click="$emit('openEditVoteModal', voteCard)">
|
<!-- @click="$emit('openEditVoteModal', voteCard)">-->
|
||||||
<v-icon color="orange-lighten-1">mdi-pencil</v-icon>
|
<!-- <v-icon color="orange-lighten-1">mdi-pencil</v-icon>-->
|
||||||
</v-btn>
|
<!-- </v-btn>-->
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<v-col>
|
||||||
|
|||||||
@@ -1,38 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<v-row class="pt-2 mx-1 bg-pink flex-column fill-height" >
|
<v-row class="pt-2 mx-1 flex-column fill-height flex-grow-0 " >
|
||||||
<template v-if="isVoteCreated">
|
<template v-if="isVoteCreated">
|
||||||
<v-card class="text-center pa-8" flat>
|
<v-card class="d-flex flex-column flex-grow-1 flex-shrink-0 text-center pa-8" flat>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<div class>
|
||||||
<v-icon color="success" size="48">mdi-check-circle</v-icon>
|
<v-icon color="success" size="48">mdi-check-circle</v-icon>
|
||||||
<h2 class="mt-4">Голосование создано!</h2>
|
<h2 class="mt-4">Голосование создано!</h2>
|
||||||
<v-btn class="mt-4" color="teal-darken-4" @click="resetForm">Создать ещё</v-btn>
|
<v-btn class="mt-4" color="teal-darken-4" @click="resetForm">Создать ещё</v-btn>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
||||||
<div class="v-col-12 bg-green flex-grow-1 flex-shrink-0">
|
<div class="v-col flex-grow-1 flex-shrink-0 ">
|
||||||
|
|
||||||
<v-stepper v-model="step" editable class="full-height">
|
<v-stepper v-model="step" editable class="d-flex flex-column fill-height">
|
||||||
<v-stepper-header class="">
|
<v-stepper-header class="flex-grow-0 flex-shrink-1">
|
||||||
<v-stepper-item :complete="step > 0" step="1">Основная информация</v-stepper-item>
|
<v-stepper-item :complete="step > 0" step="1">Основная информация
|
||||||
|
|
||||||
|
</v-stepper-item>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-stepper-item :complete="step > 1" step="2">Создание опроса</v-stepper-item>
|
<v-stepper-item :complete="step > 1" step="2">Создание опроса</v-stepper-item>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-stepper-item :complete="step > 2" step="3">Подтверждение</v-stepper-item>
|
<v-stepper-item :complete="step > 2" step="3">Подтверждение</v-stepper-item>
|
||||||
</v-stepper-header>
|
</v-stepper-header>
|
||||||
|
|
||||||
<v-stepper-window class="bg-green flex-grow-1 flex-shrink-0 mb-6">
|
<v-stepper-window class="fill-height">
|
||||||
<!-- Основная информация -->
|
<!-- Основная информация -->
|
||||||
<v-stepper-window-item step="1">
|
<v-stepper-window-item step="1" class="fill-height">
|
||||||
<v-card flat>
|
<v-card flat class="fill-height d-flex flex-column ">
|
||||||
<v-card-title>Основная информация</v-card-title>
|
<v-card-title>Основная информация</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text class="d-flex flex-column overflow-auto">
|
||||||
<v-text-field v-model="form.title" :rules="[rules.required]" label="Название голосования"
|
<v-text-field v-model="form.title" :rules="[rules.required]" label="Название голосования"
|
||||||
|
class="flex-grow-0 flex-shrink-1"
|
||||||
variant="underlined"></v-text-field>
|
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>
|
variant="outlined"></v-textarea>
|
||||||
|
</div>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<div class="pt-2">Дата и время:</div>
|
<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 justify-space-around">
|
||||||
<div class="d-flex ga-3 align-center">
|
<div class="d-flex ga-3 align-center">
|
||||||
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
||||||
@@ -55,7 +68,9 @@
|
|||||||
</v-select>
|
</v-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn color="teal-darken-4" size="medium" @click="step = 1">Далее</v-btn>
|
<v-btn color="teal-darken-4" size="medium" @click="step = 1">Далее</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
@@ -63,10 +78,12 @@
|
|||||||
</v-stepper-window-item>
|
</v-stepper-window-item>
|
||||||
|
|
||||||
<!-- Создание опроса -->
|
<!-- Создание опроса -->
|
||||||
<v-stepper-window-item step="2">
|
<v-stepper-window-item step="2" class="fill-height">
|
||||||
<v-card flat class="h-100 ">
|
|
||||||
|
<v-card flat class="fill-height d-flex flex-column">
|
||||||
<v-card-title>Создание опроса:</v-card-title>
|
<v-card-title>Создание опроса:</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
|
<transition-group name="list" tag="div">
|
||||||
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
|
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<v-text-field density="comfortable" v-model="question.text" :label="'Вопрос ' + (index + 1)"
|
<v-text-field density="comfortable" v-model="question.text" :label="'Вопрос ' + (index + 1)"
|
||||||
@@ -76,14 +93,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
</v-text-field>
|
</v-text-field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<v-file-input density="comfortable" v-model="question.image" accept="image/*"
|
<v-file-input density="comfortable" v-model="question.image" accept="image/*"
|
||||||
label="Картинка для вопроса" variant="outlined"></v-file-input>
|
label="Картинка для вопроса" variant="outlined"></v-file-input>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<div class="py-2">Настройки вопроса</div>
|
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
|
||||||
<div class="v-row ">
|
<div class="v-row ">
|
||||||
|
|
||||||
<v-col class="align-self-center font-weight-bold py-0">
|
<v-col class="align-self-center font-weight-bold py-0">
|
||||||
@@ -92,6 +106,8 @@
|
|||||||
<v-col cols="3" class="py-0">
|
<v-col cols="3" class="py-0">
|
||||||
|
|
||||||
<v-select density="compact" v-model="question.settings.choice" :items="questionTypes"
|
<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>
|
item-title="name" item-value="choice" label="" hide-details variant="outlined"></v-select>
|
||||||
<!-- choice -->
|
<!-- choice -->
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -100,7 +116,7 @@
|
|||||||
<v-col class="align-self-center font-weight-bold">
|
<v-col class="align-self-center font-weight-bold">
|
||||||
Число возможных ответов
|
Число возможных ответов
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="2" class="">
|
<v-col cols="1" class="">
|
||||||
<v-text-field density="compact" v-model="question.settings.multiChoice"
|
<v-text-field density="compact" v-model="question.settings.multiChoice"
|
||||||
:rules="[rules.required && question.settings.multiChoice > 0]" hide-details type="number"
|
:rules="[rules.required && question.settings.multiChoice > 0]" hide-details type="number"
|
||||||
min="1" variant="outlined">
|
min="1" variant="outlined">
|
||||||
@@ -113,6 +129,7 @@
|
|||||||
|
|
||||||
<v-card-text class="px-0">
|
<v-card-text class="px-0">
|
||||||
<div v-if="question.settings.choice === 'free'">
|
<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">
|
<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]"
|
<v-text-field v-model="answer.text" :label="'Ответ ' + (ind + 1)" :rules="[rules.required]"
|
||||||
class="mr-4" variant="outlined" density="compact"></v-text-field>
|
class="mr-4" variant="outlined" density="compact"></v-text-field>
|
||||||
@@ -122,18 +139,31 @@
|
|||||||
|
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
<v-btn color="teal-darken-4" @click="addAnswer(index)">Добавить ответ</v-btn>
|
|
||||||
|
</transition-group>
|
||||||
|
<div class="d-flex justify-start">
|
||||||
|
<v-btn size="small" color="teal-darken-4" @click="addAnswer(index)">Добавить ответ</v-btn>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
|
||||||
<div class="v-row">
|
<div class="v-row">
|
||||||
|
|
||||||
<v-radio-group inline label="Голосование по отделам:" v-model="question.settings.onlyDep">
|
<v-radio-group class="text-caption" inline v-model="question.settings.onlyDep">
|
||||||
<v-radio v-for="x in onlyDepdict" :key="x.name" :label="x.name" :value=x.value></v-radio>
|
<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>
|
</v-radio-group>
|
||||||
|
|
||||||
<v-switch color="teal-darken-4" v-model="question.settings.withoutDirector"
|
<!-- <v-switch color="teal-darken-4" v-model="question.settings.withoutDirector"
|
||||||
:label="`Без начальства : ${question.settings.withoutDirector ? 'да ' : 'нет'}`" hide-details
|
:label="`Без начальства : ${question.settings.withoutDirector ? 'да ' : 'нет'}`" hide-details
|
||||||
class="v-col-auto"></v-switch>
|
class="v-col-auto"></v-switch> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -152,6 +182,15 @@
|
|||||||
<v-checkbox class="pa-0" :model-value="question.selectedEmployees.length==allEmployees.length" label="Все"
|
<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>
|
@update:model-value="handleSelectAll(question.selectedEmployees.length==allEmployees.length, index)"></v-checkbox>
|
||||||
</template>
|
</template>
|
||||||
|
<template #selection="{item}">
|
||||||
|
<v-chip
|
||||||
|
:prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)"
|
||||||
|
>
|
||||||
|
|
||||||
|
{{ item.raw.familyname }}</v-chip>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template #item="data">
|
<template #item="data">
|
||||||
|
|
||||||
@@ -176,9 +215,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<v-list-item-title class="text-third" v-text="data.item.raw.fio"></v-list-item-title>
|
<v-list-item-title class="text-third" v-text="data.item.raw.fio"></v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<!-- <v-list-tile-avatar> -->
|
|
||||||
|
|
||||||
<!-- </v-list-tile-avatar> -->
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -191,8 +228,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-autocomplete>
|
</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">
|
<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-col cols="7" class="py-0" >
|
||||||
|
|
||||||
@@ -210,10 +247,16 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</v-col>
|
</v-col>
|
||||||
</div>
|
</div>
|
||||||
|
</transition-group>
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</div>
|
</div>
|
||||||
<v-btn color="teal-darken-4" @click="addQuestion">Добавить вопрос</v-btn>
|
</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>
|
||||||
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
||||||
@@ -224,10 +267,14 @@
|
|||||||
</v-stepper-window-item>
|
</v-stepper-window-item>
|
||||||
|
|
||||||
<!-- Подтверждение -->
|
<!-- Подтверждение -->
|
||||||
<v-stepper-window-item step="3">
|
<v-stepper-window-item step="3" class="fill-height">
|
||||||
<v-card flat>
|
|
||||||
|
<v-card flat class="fill-height d-flex flex-column">
|
||||||
<v-card-title>Подтверждение</v-card-title>
|
<v-card-title>Подтверждение</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
|
<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.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 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>
|
||||||
@@ -266,11 +313,9 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
||||||
<v-btn 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-actions>
|
||||||
<v-alert v-if="errorMessage" class="mb-4" type="error">
|
|
||||||
{{ errorMessage }}
|
|
||||||
</v-alert>
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-stepper-window-item>
|
</v-stepper-window-item>
|
||||||
|
|
||||||
@@ -516,4 +561,14 @@ export default {
|
|||||||
.v-input--horizontal .v-input__prepend {
|
.v-input--horizontal .v-input__prepend {
|
||||||
margin-inline-end: 4px;
|
margin-inline-end: 4px;
|
||||||
}
|
}
|
||||||
|
.list-enter-active,
|
||||||
|
.list-leave-active {
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
.list-enter-from,
|
||||||
|
.list-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(50px);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container>
|
<v-container>
|
||||||
|
<div class="text-end">
|
||||||
|
<v-btn class="" color="red-darken-1" density="compact" icon="mdi-close-thick" size="small"
|
||||||
|
@click="$emit('closer')">
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
<v-card-title class="text-subtitle-1">Результат голосования: {{ title }}</v-card-title>
|
<v-card-title class="text-subtitle-1">Результат голосования: {{ title }}</v-card-title>
|
||||||
<v-card-subtitle class="text-subtitle-2">{{ description }}</v-card-subtitle>
|
<v-card-subtitle class="text-subtitle-2">{{ description }}</v-card-subtitle>
|
||||||
<v-tabs v-model="activeTab" class="mb-4">
|
<v-tabs v-model="activeTab" class="mb-4">
|
||||||
@@ -67,10 +72,15 @@
|
|||||||
<v-progress-linear
|
<v-progress-linear
|
||||||
:model-value="getPercentage(answer.count, question)"
|
:model-value="getPercentage(answer.count, question)"
|
||||||
color="teal-darken-4"
|
color="teal-darken-4"
|
||||||
height="10"
|
height="13"
|
||||||
rounded
|
rounded
|
||||||
striped
|
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-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
@@ -131,6 +141,7 @@ export default {
|
|||||||
return baseURL
|
return baseURL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
emits: ['closer'],
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|||||||
@@ -140,12 +140,7 @@ const routes = [
|
|||||||
ico: "mdi-account",
|
ico: "mdi-account",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// path: "/vote",
|
|
||||||
// name: "Vote",
|
|
||||||
// component: () =>
|
|
||||||
// import("@/views/Vote.vue")
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: "/vote",
|
path: "/vote",
|
||||||
name: "VoteHomePage",
|
name: "VoteHomePage",
|
||||||
@@ -166,12 +161,6 @@ const routes = [
|
|||||||
ico: "mdi-account",
|
ico: "mdi-account",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/vote/edit-vote/:id",
|
|
||||||
name: "EditVote",
|
|
||||||
component: () =>
|
|
||||||
import("@/views/VoteHomePage.vue")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/vote/vote-results/:id",
|
path: "/vote/vote-results/:id",
|
||||||
name: "VoteResults",
|
name: "VoteResults",
|
||||||
|
|||||||
@@ -24,45 +24,39 @@
|
|||||||
:isFinished="currentTab==='active'"
|
:isFinished="currentTab==='active'"
|
||||||
:voteCard="voting"
|
:voteCard="voting"
|
||||||
@deleteVoting="deleteVoting"
|
@deleteVoting="deleteVoting"
|
||||||
@openEditVoteModal="(voting) => openModal('edit', voting)"
|
|
||||||
@openResultModal="(voting) => openModal('results', voting)"
|
@openResultModal="(voting) => openModal('results', voting)"
|
||||||
@openVoteModal="(voting) => openModal('vote', voting)"
|
@openVoteModal="(voting) => openModal('vote', voting)"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-tabs-window-item>
|
</v-tabs-window-item>
|
||||||
|
|
||||||
<!-- Конструктор -->
|
<!-- Конструктор -->
|
||||||
<v-tabs-window-item class="h-100 " value="constructor">
|
<v-tabs-window-item class="h-100 overflow-auto" value="constructor">
|
||||||
<VoteConstructor @updating="updating"/>
|
<VoteConstructor @updating="updating"/>
|
||||||
</v-tabs-window-item>
|
</v-tabs-window-item>
|
||||||
|
|
||||||
|
|
||||||
</v-window>
|
</v-window>
|
||||||
|
|
||||||
<!-- Модальные окна -->
|
<!-- Модальные окна -->
|
||||||
<v-dialog v-model="voteModal" @click:outside="closeModal">
|
<v-dialog v-model="voteModal" @click:outside="closeModal">
|
||||||
|
|
||||||
|
|
||||||
<CurrentVote :data="res" @closer="closeModal"/>
|
<CurrentVote :data="res" @closer="closeModal"/>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
|
||||||
<v-dialog v-model="editVoteModal" max-width="1200px" @click:outside="closeModal">
|
<!-- <v-dialog v-model="editVoteModal" max-width="1200px" @click:outside="closeModal">-->
|
||||||
<v-card>
|
<!-- <v-card>-->
|
||||||
<v-card-title>Редактировать голосование: {{ selectedVoting?.title }}</v-card-title>
|
<!-- <v-card-title>Редактировать голосование: {{ selectedVoting?.title }}</v-card-title>-->
|
||||||
<v-card-text>
|
<!-- <v-card-text>-->
|
||||||
<VoteConstructor/>
|
<!-- <VoteConstructor/>-->
|
||||||
</v-card-text>
|
<!-- </v-card-text>-->
|
||||||
<v-card-actions>
|
<!-- <v-card-actions>-->
|
||||||
<v-btn color="teal-darken-4">Сохранить</v-btn>
|
<!-- <v-btn color="teal-darken-4">Сохранить</v-btn>-->
|
||||||
<v-btn @click="closeModal">Закрыть</v-btn>
|
<!-- <v-btn @click="closeModal">Закрыть</v-btn>-->
|
||||||
</v-card-actions>
|
<!-- </v-card-actions>-->
|
||||||
</v-card>
|
<!-- </v-card>-->
|
||||||
</v-dialog>
|
<!-- </v-dialog>-->
|
||||||
|
|
||||||
<v-dialog v-model="resultsModal" max-width="1200px" @click:outside="closeModal">
|
<v-dialog v-model="resultsModal" max-width="1200px" @click:outside="closeModal">
|
||||||
<v-card>
|
<v-card>
|
||||||
<VoteResult :data="result"/>
|
<VoteResult :data="result" @closer="closeModal" />
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn @click="closeModal">Закрыть</v-btn>
|
<v-btn @click="closeModal">Закрыть</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
@@ -109,7 +103,7 @@ export default {
|
|||||||
updating("active");
|
updating("active");
|
||||||
|
|
||||||
const voteModal = ref(false);
|
const voteModal = ref(false);
|
||||||
const editVoteModal = ref(false);
|
// const editVoteModal = ref(false);
|
||||||
const resultsModal = ref(false);
|
const resultsModal = ref(false);
|
||||||
const selectedVoting = ref(null);
|
const selectedVoting = ref(null);
|
||||||
|
|
||||||
@@ -139,7 +133,7 @@ export default {
|
|||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
voteModal.value = false;
|
voteModal.value = false;
|
||||||
editVoteModal.value = false;
|
// editVoteModal.value = false;
|
||||||
resultsModal.value = false;
|
resultsModal.value = false;
|
||||||
selectedVoting.value = null;
|
selectedVoting.value = null;
|
||||||
router.push({name: "VoteHomePage"});
|
router.push({name: "VoteHomePage"});
|
||||||
@@ -151,10 +145,12 @@ export default {
|
|||||||
await loadVoteDetails(voting.id);
|
await loadVoteDetails(voting.id);
|
||||||
voteModal.value = true;
|
voteModal.value = true;
|
||||||
router.push({name: "Voting", params: {id: voting.id}});
|
router.push({name: "Voting", params: {id: voting.id}});
|
||||||
} else if (type === "edit") {
|
}
|
||||||
editVoteModal.value = true;
|
// else if (type === "edit") {
|
||||||
router.push({name: "EditVote", params: {id: voting.id}});
|
// editVoteModal.value = true;
|
||||||
} else if (type === "results") {
|
// router.push({name: "EditVote", params: {id: voting.id}});
|
||||||
|
// }
|
||||||
|
else if (type === "results") {
|
||||||
await loadVoteResult(voting.id);
|
await loadVoteResult(voting.id);
|
||||||
resultsModal.value = true;
|
resultsModal.value = true;
|
||||||
router.push({name: "VoteResults", params: {id: voting.id}});
|
router.push({name: "VoteResults", params: {id: voting.id}});
|
||||||
@@ -175,13 +171,13 @@ export default {
|
|||||||
watch(
|
watch(
|
||||||
() => route,
|
() => route,
|
||||||
async () => {
|
async () => {
|
||||||
if (!voteModal.value && !editVoteModal.value && !resultsModal.value) {
|
if (!voteModal.value && !resultsModal.value) {
|
||||||
const voting = votes.value.find((v) => v.id === route.params.id);
|
const voting = votes.value.find((v) => v.id === route.params.id);
|
||||||
if (route.name === "Voting") {
|
if (route.name === "Voting") {
|
||||||
await loadVoteDetails(route.params.id);
|
await loadVoteDetails(route.params.id);
|
||||||
voteModal.value = true;
|
voteModal.value = true;
|
||||||
}
|
}
|
||||||
if (route.name === "EditVote") editVoteModal.value = true;
|
// if (route.name === "EditVote") editVoteModal.value = true;
|
||||||
if (route.name === "VoteResults") {
|
if (route.name === "VoteResults") {
|
||||||
await loadVoteResult(route.params.id)
|
await loadVoteResult(route.params.id)
|
||||||
resultsModal.value = true;
|
resultsModal.value = true;
|
||||||
@@ -199,7 +195,7 @@ export default {
|
|||||||
votes,
|
votes,
|
||||||
sortedVotes,
|
sortedVotes,
|
||||||
voteModal,
|
voteModal,
|
||||||
editVoteModal,
|
// editVoteModal,
|
||||||
resultsModal,
|
resultsModal,
|
||||||
selectedVoting,
|
selectedVoting,
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
Reference in new issue
Block a user