This commit is contained in:
Nukeap committed 2025-01-20 17:01:13 +03:00
1 parent 03828d965a
commit 4a26a749b3
2 files changed
+96 -50

No files matched your search

@@ -1,5 +1,5 @@
<template>
<div class="pt-2 h-100 ">
<v-row class="pt-2">
<template v-if="isVoteCreated">
<v-card class="text-center pa-8" flat>
<v-icon color="success" size="48">mdi-check-circle</v-icon>
@@ -8,72 +8,76 @@
</v-card>
</template>
<template v-else>
<div class="bg-green h-100 mb-0 pb-0 ">
<v-stepper class="h-50 d-flex flex-column" v-model="step" editable>
<v-stepper-header class="v-col-auto">
<div class="v-col">
<v-stepper v-model="step" editable>
<v-stepper-header>
<v-stepper-item :complete="step > 0" step="1">Основная информация</v-stepper-item>
<v-divider></v-divider>
<v-stepper-item :complete="step > 1" step="2">Создание опроса</v-stepper-item>
<v-divider></v-divider>
<v-stepper-item :complete="step > 2" step="3">Подтверждение</v-stepper-item>
</v-stepper-header>
<template v-slot:item.1>
<v-card title="Step Two" flat>...</v-card>
</template>
<v-stepper-window class="v-col">
<v-stepper-window>
<!-- Основная информация -->
<v-stepper-window-item step="1" class="h-100 d-flex flex-column bg-yellow h-100" >
<!-- <v-row class="flex-column h-100"> -->
<v-col cols="4" class="bg-green">1</v-col>
<v-col>1</v-col>
<!-- </v-row> -->
<!-- <v-card class=" v-row flex-column">
<v-card-title class="v-col-auto">
<div>Основная информация</div></v-card-title>
<v-card-text class="v-col flex-grow-1">
<v-stepper-window-item step="1">
<v-card flat>
<v-card-title>Основная информация</v-card-title>
<v-card-text>
<v-text-field
v-model="form.title"
:rules="[rules.required]"
label="Название голосования"
outlined
variant="underlined"
></v-text-field>
<v-textarea
v-model="form.description"
:rules="[rules.required]"
label="Описание"
outlined
variant="outlined"
></v-textarea>
<div class="d-flex ga-10">
<div class="d-flex ga-3 align-center">
<h6 class="text-subtitle-1">Дата и время начала:</h6>
<v-divider></v-divider>
<div class="pt-2">Дата и время:</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"
dense
outlined
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>
<div class="d-flex ga-3 align-center">
<h6 class="text-subtitle-1">Дата и время окончания:</h6>
<h6 class="text-subtitle-1 pt-2">окончание:</h6>
<date-select :datedefault="form.endDate" @returndate="returnend" />
<v-select
v-model="selectedTimeEnd"
:items="timeOptions"
dense
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>
</v-card-text>
<v-card-actions class="v-col-4 ">
<v-card-actions>
<v-btn color="teal-darken-4" size="medium" @click="step = 1">Далее</v-btn>
</v-card-actions>
</v-card> -->
</v-card>
</v-stepper-window-item>
<!-- Создание опроса -->
@@ -84,33 +88,73 @@
<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]"
outlined
></v-text-field>
<v-btn color="error" @click="removeQuestion(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
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="Картинка для вопроса"
outlined
></v-file-input>
<v-select
v-model="question.settings.type"
:items="questionTypes"
label="Тип ответа"
outlined
></v-select>
<v-divider></v-divider>
<div>Настройки вопроса</div>
<div class="v-row px-2">
<v-col class="align-self-center font-weight-bold">
Тип ответа
</v-col>
<v-col cols="3"
>
<v-select
density="compact"
v-model="question.settings.type"
:items="questionTypes"
label=""
hide-details
></v-select>
</v-col>
</div>
<div class="v-row">
<v-col class="align-self-center font-weight-bold">
Число возможных ответов
</v-col>
<v-col cols="2">
<v-text-field
density="compact"
v-model="question.settings.multiChoice"
:rules="[rules.required && question.settings.multiChoice > 0]"
hide-details="auto"
label="Число возможных ответов"
></v-text-field>
hide-details
type="number"
min="1"
class="v-col-auto"
>
<template v-slot:prepend>
</template>
</v-text-field>
</v-col>
</div>
<v-card-text>
<div v-if="question.settings.type === 'Ввести вручную'">
<div
@@ -251,22 +295,24 @@
</v-stepper-window-item>
</v-stepper-window>
</v-stepper>
</div>
</template>
</div>
</v-row>
</template>
<script>
import {computed, ref, watch} from "vue";
import {createVote, getEmployees} from "@/utils/axios-api";
import DateSelect from "@/components/UI/date-select.vue";
import {useAccountStore} from "@/store/AccountStore";
export default {
components: {DateSelect},
emits: ['updating'],
setup(props, {emit}) {
const accountStore = useAccountStore();
const user = accountStore.user;
const step = ref(0);
const isVoteCreated = ref(false);
const form = ref({
@@ -428,7 +474,7 @@ export default {
form.value.endDate = dates
}
const selectedEmployees = ref([]);
// const selectedEmployees = ref([]);
const onEmployeesChange = (selected) => {
form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null }));
+1 -1
View File
@@ -41,7 +41,7 @@
<!-- Конструктор -->
<v-tabs-window-item value="constructor" class="h-100 overflow-auto ">
<v-tabs-window-item value="constructor" class="">
<VoteConstructor @updating="updating" />
</v-tabs-window-item>
<!-- </v-tabs-window> -->