Создание опроса:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Настройки вопроса
-
-
- Тип ответа
-
-
-
-
-
-
-
- Число возможных ответов
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Добавить ответ
-
-
-
-
-
-
-
- Голосование по отделам:
-
-
-
-
- {{ x.name }}
-
-
-
-
-
- (question.answers = question.answers.filter((e) =>
- selected.includes(e.text),
- ))
- "
- >
-
-
-
-
-
- {{ item.raw.familyname }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ form.value = val"
+ :allEmployees="allEmployees"
+ :allEmployeesgroupedbydep="allEmployeesgroupedbydep"
+ :handleSelectAll="handleSelectAll"
+ :onEmployeesChange="onEmployeesChange"
+ :findEmployeeById="findEmployeeById"
+ :onlyDepdict="onlyDepdict"
+ />
Добавить вопросДобавить вопрос
+
@@ -377,7 +64,6 @@
{{ errorMessage }}
-
Назад
import { computed, ref, watch } from 'vue';
-import { createVote, getEmployees, spravURL } from '@/utils/axios-api';
+import { createVote, getEmployees } from '@/utils/axios-api';
import DateSelect from '@/components/UI/date-select.vue';
-import { checkremote } from '@/utils/universal_functions';
+import MainInfo from '@/components/vote/ConstructorVote/MainInfo.vue';
+import CreatedVote from '@/components/vote/ConstructorVote/CreatedVote.vue';
+import NewQuestion from '@/components/vote/ConstructorVote/NewQuestion.vue';
export default {
- components: { DateSelect },
+ components: { NewQuestion, CreatedVote, MainInfo, DateSelect },
emits: ['updating'],
setup(props, { emit }) {
const step = ref(0);
@@ -490,6 +178,7 @@ export default {
endDate: new Date(new Date().setDate(new Date().getDate() + 14)),
questions: [],
createnews: false,
+ appoint: false
});
const rules = {
@@ -497,10 +186,6 @@ export default {
};
const currentQuestionIndex = ref(0);
- const questionTypes = [
- { name: 'Ввести вручную', choice: 'free' },
- { name: 'Выбрать сотрудника', choice: 'employee' },
- ];
const groupedEmployees = ref([]);
const allEmployees = computed(() => [...groupedEmployees.value]);
@@ -560,10 +245,6 @@ export default {
}
};
- const updateQuest = (index) => {
- quests[index] = form.value.questions[index].text.length > 0;
- };
-
const addAnswer = (index) => {
if (currentQuestion.value) {
form.value.questions[index].answers.push({ text: '', image: null });
@@ -601,12 +282,11 @@ export default {
}
try {
- const response = await createVote(form.value);
- console.log('Голосование успешно создано:', response);
+ await createVote(form.value);
isVoteCreated.value = true;
emit('updating', 'active');
} catch (error) {
- console.error('Ошибка при создании голосования:', error);
+ return new Error(error)
}
};
@@ -622,20 +302,6 @@ export default {
isVoteCreated.value = false;
};
- const timeOptions = Array.from({ length: 48 }, (_, i) => {
- const hours = String(Math.floor(i / 2)).padStart(2, '0');
- const minutes = i % 2 === 0 ? '00' : '30';
- return `${hours}:${minutes}`;
- });
-
- const selectedTimeStart = ref(
- `${(form.value.startDate.getHours() + 1).toString().padStart(2, '0')}:00`,
- );
-
- const selectedTimeEnd = ref(
- `${(form.value.endDate.getHours() + 1).toString().padStart(2, '0')}:00`,
- );
-
watch(
form.value,
() => {
@@ -651,7 +317,6 @@ export default {
watch(
() => form.value.questions,
(newQuestions) => {
- // Обновляем quests
quests.value = newQuestions.map((q) => !!q.text.trim());
// Проверяем, есть ли пустые вопросы или невалидные ответы
@@ -666,28 +331,6 @@ export default {
{ deep: true },
);
- watch([selectedTimeStart, selectedTimeEnd], ([newStart, newEnd]) => {
- updateStartDate();
- updateEndDate();
- });
-
- const updateStartDate = () => {
- const [hours, minutes] = selectedTimeStart.value.split(':').map(Number);
- form.value.startDate.setHours(hours, minutes);
- };
- const updateEndDate = () => {
- const [hours, minutes] = selectedTimeEnd.value.split(':').map(Number);
- form.value.endDate.setHours(hours, minutes);
- };
-
- const returnstart = (dates) => {
- form.value.startDate = dates;
- };
-
- const returnend = (dates) => {
- form.value.endDate = dates;
- };
-
const onEmployeesChange = (selected, index) => {
let ind = form.value.questions[index].selectedEmployees.findIndex((e) => e === selected);
if (ind > -1) {
@@ -713,15 +356,11 @@ export default {
return {
quests,
- updateQuest,
onlyDepdict,
allEmployeesgroupedbydep,
onEmployeesChange,
- returnend,
- returnstart,
step,
form,
- questionTypes,
addQuestion,
removeQuestion,
addAnswer,
@@ -732,14 +371,9 @@ export default {
resetForm,
rules,
errorMessage,
- timeOptions,
- selectedTimeStart,
- selectedTimeEnd,
allEmployees,
handleSelectAll,
isAllSelected,
- checkremote,
- spravURL,
};
},
};
diff --git a/src/front/src/views/AboutInspectionPage.vue b/src/front/src/views/AboutInspectionPage.vue
index b8248df09..643a04ef3 100644
--- a/src/front/src/views/AboutInspectionPage.vue
+++ b/src/front/src/views/AboutInspectionPage.vue
@@ -18,12 +18,12 @@