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