ref
This commit is contained in:
1 parent
db63350978
commit
0d75cadf13
1 file changed
+9
-9
@@ -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 }));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user