This commit is contained in:
Denzel committed 2025-01-20 15:27:31 +03:00
1 parent db63350978
commit 0d75cadf13
1 file changed
+12 -12
@@ -9,7 +9,7 @@
</template> </template>
<template v-else> <template v-else>
<div class="v-col"> <div class="v-col">
<v-stepper class="h-100 v-row flex-column" v-model="step" editable> <v-stepper class="h-100 v-row flex-column" v-model="step" editable>
<v-stepper-header class="v-col-auto pa-0"> <v-stepper-header class="v-col-auto pa-0">
<v-stepper-item :complete="step > 0" step="1">Основная информация</v-stepper-item> <v-stepper-item :complete="step > 0" step="1">Основная информация</v-stepper-item>
@@ -18,11 +18,11 @@
<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="v-col d-flex"> <v-stepper-window class="v-col d-flex">
<!-- Основная информация --> <!-- Основная информация -->
<v-stepper-window-item step="1" class=""> <v-stepper-window-item step="1" class="">
<v-card flat> <v-card flat>
<v-card-title>Основная информация</v-card-title> <v-card-title>Основная информация</v-card-title>
<v-card-text> <v-card-text>
@@ -94,7 +94,7 @@
outlined outlined
></v-file-input> ></v-file-input>
<v-select <v-select
v-model="question.settings.type" v-model="question.settings.choice"
:items="questionTypes" :items="questionTypes"
label="Тип ответа" label="Тип ответа"
outlined outlined
@@ -106,7 +106,7 @@
label="Число возможных ответов" label="Число возможных ответов"
></v-text-field> ></v-text-field>
<v-card-text> <v-card-text>
<div v-if="question.settings.type === 'Ввести вручную'"> <div v-if="question.settings.choice === 'choose'">
<div <div
v-for="(answer, index) in question.answers" v-for="(answer, index) in question.answers"
:key="index" :key="index"
@@ -211,8 +211,8 @@
<p><strong>Вопросы:</strong></p> <p><strong>Вопросы:</strong></p>
<ul> <ul>
<li v-for="(question, index) in form.questions" :key="index" class="mb-4"> <li v-for="(question, index) in form.questions" :key="index" class="mb-4">
<p><strong>Вопрос {{ index + 1 }}:</strong> {{ question.text }} ({{ question.type }})</p> <p><strong>Вопрос {{ index + 1 }}:</strong> {{ question.text }} ({{ question.choice }})</p>
<div v-if="question.settings.type === 'Ввести вручную' && question.answers.length"> <div v-if="question.settings.choice === 'choose' && question.answers.length">
<p><strong>Варианты ответов:</strong></p> <p><strong>Варианты ответов:</strong></p>
<ul> <ul>
<li v-for="(answer, answerIndex) in question.answers" :key="answerIndex"> <li v-for="(answer, answerIndex) in question.answers" :key="answerIndex">
@@ -220,7 +220,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div v-if="question.settings.type === 'Выбрать сотрудника' && question.answers.length"> <div v-if="question.settings.choice === 'employee' && question.answers.length">
<p><strong>Выбранные сотрудники:</strong></p> <p><strong>Выбранные сотрудники:</strong></p>
<ul> <ul>
<li <li
@@ -274,8 +274,10 @@ export default {
required: (value) => !!value || "Это поле обязательно для заполнения", required: (value) => !!value || "Это поле обязательно для заполнения",
}; };
const selectedEmployees = ref([]);
const currentQuestionIndex = ref(0); const currentQuestionIndex = ref(0);
const questionTypes = ["Ввести вручную", "Выбрать сотрудника"]; const questionTypes = ["choose", "employee"];
const groupedEmployees = ref([]); const groupedEmployees = ref([]);
const allEmployees = computed(() => [ const allEmployees = computed(() => [
@@ -313,7 +315,7 @@ export default {
const addQuestion = () => { const addQuestion = () => {
form.value.questions.push({ form.value.questions.push({
text: "", text: "",
settings: { type: "Ввести вручную", multiChoice: 1, onlyDep: false, withoutDirector: false }, settings: { choice: "choose", multiChoice: 1, onlyDep: false, withoutDirector: false },
image: null, image: null,
answers: [], answers: [],
selectedEmployees: [] selectedEmployees: []
@@ -421,8 +423,6 @@ export default {
form.value.endDate = dates form.value.endDate = dates
} }
const selectedEmployees = ref([]);
const onEmployeesChange = (selected) => { const onEmployeesChange = (selected) => {
form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null })); form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null }));
}; };