изменения в редакторе для голосования

This commit is contained in:
Denzel committed 2025-01-15 12:25:30 +03:00
1 parent 5ec31af7c0
commit c35882b0af
3 files changed
+112 -109

No files matched your search

+110 -108
View File
@@ -14,9 +14,7 @@
<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-divider></v-divider>
<v-stepper-item step="4">Подтверждение</v-stepper-item>
<v-stepper-item :complete="step > 2" step="3">Подтверждение</v-stepper-item>
</v-stepper-header>
<v-stepper-window>
@@ -37,11 +35,12 @@
outlined
:rules="[rules.required]"
></v-textarea>
<v-text-field
:placeholder="form.startDate.toLocaleDateString()"
:value="form.startDate.toLocaleDateString()"
:placeholder="`${form.startDate.toLocaleDateString()} ${form.startDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`"
:value="`${form.startDate.toLocaleDateString()} ${form.startDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`"
color="teal-darken-4"
label="Дата начала"
label="Дата и время начала"
persistentPlaceholder
readonly
>
@@ -51,19 +50,18 @@
color="teal-darken-4"
hideHeader
hideWeekdays
>
</v-date-picker>
/>
</v-menu>
<v-btn flat icon style="background-color: transparent">
<v-icon>mdi-calendar</v-icon>
<v-icon>mdi-calendar-clock</v-icon>
</v-btn>
</v-text-field>
<v-text-field
:placeholder="form.endDate.toLocaleDateString()"
:value="form.endDate.toLocaleDateString()"
:placeholder="`${form.endDate.toLocaleDateString()} ${form.endDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`"
:value="`${form.endDate.toLocaleDateString()} ${form.endDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`"
color="teal-darken-4"
label="Дата окончания"
label="Дата и время окончания"
persistentPlaceholder
readonly
>
@@ -73,13 +71,13 @@
color="teal-darken-4"
hideHeader
hideWeekdays
>
</v-date-picker>
/>
</v-menu>
<v-btn flat icon style="background-color: transparent">
<v-icon>mdi-calendar</v-icon>
<v-icon>mdi-calendar-clock</v-icon>
</v-btn>
</v-text-field>
</v-card-text>
<v-card-actions>
<v-btn color="teal-darken-4" size="medium" @click="step = 1">Далее</v-btn>
@@ -93,12 +91,17 @@
<v-card-title>Создание опроса</v-card-title>
<v-card-text>
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
<v-text-field
<div class="d-flex">
<v-text-field
v-model="question.text"
:label="'Вопрос ' + (index + 1)"
outlined
:rules="[rules.required]"
></v-text-field>
></v-text-field>
<v-btn color="error" icon @click="removeQuestion(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</div>
<v-file-input
v-model="question.image"
accept="image/*"
@@ -111,9 +114,73 @@
label="Тип ответа"
outlined
></v-select>
<v-btn color="error" icon @click="removeQuestion(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
<v-switch
v-model="question.multiChoice"
color="teal-darken-4"
:label="`Множественный выбор: ${question.multiChoice ? 'да' : 'нет'}`"
:false-value="false"
:true-value="true"
hide-details
></v-switch>
<v-card-text>
<div v-if="question.type === 'Ввести вручную'">
<div
v-for="(answer, index) in question.answers"
:key="index"
class="d-flex align-start mb-4"
>
<v-text-field
v-model="answer.text"
:label="'Ответ ' + (index + 1)"
class="mr-4"
outlined
:rules="[rules.required]"
></v-text-field>
<v-file-input
v-model="answer.image"
accept="image/*"
dense
hide-details
label="Картинка"
outlined
></v-file-input>
<v-btn color="error" icon @click="removeAnswer(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</div>
<v-btn color="teal-darken-4" @click="addAnswer">Добавить ответ</v-btn>
</div>
<div v-else>
<v-autocomplete
v-model="currentQuestion.selectedEmployees"
:items="groupedEmployees"
item-title="fio"
item-value="id"
label="Выберите сотрудников"
multiple
outlined
></v-autocomplete>
<div
v-for="(person, index) in currentQuestion.selectedEmployees"
:key="person.id"
class="d-flex align-center mb-4"
>
<v-chip>{{ findEmployeeById(person).fio }}</v-chip>
<v-file-input
v-model="currentQuestion.selectedEmployeeImages[person]"
accept="image/*"
class="ml-4"
dense
hide-details
label="Картинка"
outlined
></v-file-input>
<v-btn color="error" icon @click="removeEmployee(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</div>
</div>
</v-card-text>
</div>
<v-btn color="teal-darken-4" @click="addQuestion">Добавить вопрос</v-btn>
</v-card-text>
@@ -124,95 +191,8 @@
</v-card>
</v-stepper-window-item>
<!-- Настройка ответов -->
<v-stepper-window-item step="3">
<v-card flat>
<v-card-title>
Настройка ответов
<v-select
v-model="currentQuestionIndex"
:items="form.questions.map((q, i) => ({ text: `Вопрос ${i + 1}: ${q.text || 'Без названия'}`, value: i }))"
class="ml-4"
dense
item-title="text"
item-value="value"
label="Выберите вопрос"
outlined
></v-select>
</v-card-title>
<v-card-text>
<div v-if="currentQuestion">
<div v-if="currentQuestion.type === 'Ввести вручную'">
<div
v-for="(answer, index) in currentQuestion.answers"
:key="index"
class="d-flex align-start mb-4"
>
<v-text-field
v-model="answer.text"
:label="'Ответ ' + (index + 1)"
class="mr-4"
outlined
:rules="[rules.required]"
></v-text-field>
<v-file-input
v-model="answer.image"
accept="image/*"
dense
hide-details
label="Картинка"
outlined
></v-file-input>
<v-btn color="error" icon @click="removeAnswer(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</div>
<v-btn color="teal-darken-4" @click="addAnswer">Добавить ответ</v-btn>
</div>
<div v-else>
<v-autocomplete
v-model="currentQuestion.selectedEmployees"
:items="groupedEmployees"
item-title="fio"
item-value="id"
label="Выберите сотрудников"
multiple
outlined
></v-autocomplete>
<div
v-for="(person, index) in currentQuestion.selectedEmployees"
:key="person.id"
class="d-flex align-center mb-4"
>
<v-chip>{{ findEmployeeById(person).fio }}</v-chip>
<v-file-input
v-model="currentQuestion.selectedEmployeeImages[person]"
accept="image/*"
class="ml-4"
dense
hide-details
label="Картинка"
outlined
></v-file-input>
<v-btn color="error" icon @click="removeEmployee(index)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</div>
</div>
</div>
<div v-else>
<p>Выберите вопрос, чтобы добавить ответы.</p>
</div>
</v-card-text>
<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 = 3">Далее</v-btn>
</v-card-actions>
</v-card>
</v-stepper-window-item>
<!-- Подтверждение -->
<v-stepper-window-item step="4">
<v-stepper-window-item step="3">
<v-card flat>
<v-card-title>Подтверждение</v-card-title>
<v-card-text>
@@ -310,6 +290,7 @@ export default {
answers: [],
selectedEmployees: [],
selectedEmployeeImages: {},
multiChoice: false
});
};
@@ -383,3 +364,24 @@ export default {
},
};
</script>
<style>
.t-datetime-picker {
.v-tabs-slider-wrapper {
top: 0;
}
.v-picker__title {
height: 90px;
}
.v-time-picker-title__time * {
font-size: 60px;
height: 60px;
}
.v-picker__body {
height: 290px;
}
.v-tabs-items {
height: 380px;
}
}
</style>