This commit is contained in:
Denzel committed 2025-01-17 09:04:59 +03:00
1 parent 26d994b1a9
commit 438fb6fadc
1 file changed
+17 -21
@@ -36,30 +36,31 @@
outlined outlined
></v-textarea> ></v-textarea>
<div> <div class="d-flex ga-10">
<h6 class="text-h6">Дата начала:</h6> <div class="d-flex ga-3 align-center">
<h6 class="text-subtitle-1">Дата и время начала:</h6>
<date-select :datedefault="form.startDate" @returndate="returnstart" /> <date-select :datedefault="form.startDate" @returndate="returnstart" />
<v-select <v-select
v-model="selectedTimeStart" v-model="selectedTimeStart"
:items="timeOptions" :items="timeOptions"
dense dense
label="Время начала"
outlined outlined
prepend-icon="mdi-calendar-clock" hide-details
/> />
</div> </div>
<div> <div class="d-flex ga-3 align-center">
<h6 class="text-h6">Дата окончания:</h6> <h6 class="text-subtitle-1">Дата и время окончания:</h6>
<date-select :datedefault="form.endDate" @returndate="returnend" /> <date-select :datedefault="form.endDate" @returndate="returnend" />
<v-select <v-select
v-model="selectedTimeEnd" v-model="selectedTimeEnd"
:items="timeOptions" :items="timeOptions"
dense dense
label="Время окончания"
outlined outlined
prepend-icon="mdi-calendar-clock" hide-details
/> />
</div> </div>
</div>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@@ -71,6 +72,7 @@
<!-- Создание опроса --> <!-- Создание опроса -->
<v-stepper-window-item step="2"> <v-stepper-window-item step="2">
<v-card flat> <v-card flat>
{{form}}
<v-card-title>Создание опроса</v-card-title> <v-card-title>Создание опроса</v-card-title>
<v-card-text> <v-card-text>
<div v-for="(question, index) in form.questions" :key="index" class="mb-4"> <div v-for="(question, index) in form.questions" :key="index" class="mb-4">
@@ -298,20 +300,13 @@ export default {
const handleSelectAll = (selected) => { const handleSelectAll = (selected) => {
if (selected.includes("all")) { if (selected.includes("all")) {
currentQuestion.value.answers = groupedEmployees.value.map((employee) => ({ form.value.questions[currentQuestionIndex.value].answers = groupedEmployees.value.map((employee) => ({
text: employee.id, text: employee.id,
image: null image: null,
})); }));
selectedEmployees.value = groupedEmployees.value.map(employee => employee.id); 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 { } else {
currentQuestion.value.answers = selected.map((id) => ({ text: id, image: null })); form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null }));
selectedEmployees.value = groupedEmployees.value.map(employee => employee.id);
} }
}; };
@@ -320,10 +315,11 @@ 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: { type: "Ввести вручную", multiChoice: 1, onlyDep: false, withoutDirector: false },
image: null, image: null,
answers: [], answers: [],
}); });
currentQuestionIndex.value = form.value.questions.length - 1;
}; };
const removeQuestion = (index) => { const removeQuestion = (index) => {
@@ -335,7 +331,7 @@ export default {
const addAnswer = () => { const addAnswer = () => {
if (currentQuestion.value) { 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 selectedEmployees = ref([]);
const onEmployeesChange = (selected) => { 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 { return {