From 438fb6fadc65c48c2e28a4f36cf821fbce769d8e Mon Sep 17 00:00:00 2001 From: Denzel Date: Fri, 17 Jan 2025 09:04:59 +0300 Subject: [PATCH] ref --- .../src/components/vote/VoteConstructor.vue | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index f4ffc5925..c99a54c37 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -36,30 +36,31 @@ outlined > -
-
Дата начала:
+
+
+
Дата и время начала:
-
-
Дата окончания:
+
+
Дата и время окончания:
+
+ @@ -71,6 +72,7 @@ + {{form}} Создание опроса
@@ -298,20 +300,13 @@ export default { const handleSelectAll = (selected) => { if (selected.includes("all")) { - currentQuestion.value.answers = groupedEmployees.value.map((employee) => ({ + form.value.questions[currentQuestionIndex.value].answers = groupedEmployees.value.map((employee) => ({ text: employee.id, - image: null + image: null, })); selectedEmployees.value = groupedEmployees.value.map(employee => employee.id); - } else if ( - selected.length === groupedEmployees.value.length && - !selected.includes("all") - ) { - currentQuestion.value.answers = selected.map((id) => ({ text: id, image: null })); - selectedEmployees.value = groupedEmployees.value.map(employee => employee.id); } else { - currentQuestion.value.answers = selected.map((id) => ({ text: id, image: null })); - selectedEmployees.value = groupedEmployees.value.map(employee => employee.id); + form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null })); } }; @@ -320,10 +315,11 @@ export default { const addQuestion = () => { form.value.questions.push({ text: "", - settings: {type: "Ввести вручную", multiChoice: 1, onlyDep: false, withoutDirector: false}, + settings: { type: "Ввести вручную", multiChoice: 1, onlyDep: false, withoutDirector: false }, image: null, answers: [], }); + currentQuestionIndex.value = form.value.questions.length - 1; }; const removeQuestion = (index) => { @@ -335,7 +331,7 @@ export default { const addAnswer = () => { if (currentQuestion.value) { - currentQuestion.value.answers.push({text: "", image: null}); + form.value.questions[currentQuestionIndex.value].answers.push({ text: "", image: null }); } }; @@ -429,7 +425,7 @@ export default { const selectedEmployees = ref([]); const onEmployeesChange = (selected) => { - currentQuestion.value.answers = selected.map((id) => ({ text: id, image: null })); + form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null })); }; return {