fix [P-300]: фикс событий с опцией весь день
This commit is contained in:
1 parent
c8561a1749
commit
cf78e48fc3
8 files changed
+39
-36
No files matched your search
@@ -155,7 +155,7 @@ export default {
|
|||||||
initialView: props.forHomePage ? props.view : currentView.value,
|
initialView: props.forHomePage ? props.view : currentView.value,
|
||||||
locales: [ruLocale],
|
locales: [ruLocale],
|
||||||
locale: 'ru',
|
locale: 'ru',
|
||||||
timeZone: 'local',
|
timeZone: 'locale',
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
headerToolbar: false,
|
headerToolbar: false,
|
||||||
height: '80vh',
|
height: '80vh',
|
||||||
@@ -277,7 +277,7 @@ export default {
|
|||||||
title: instance.title,
|
title: instance.title,
|
||||||
start: instance.start,
|
start: instance.start,
|
||||||
end: instance.end,
|
end: instance.end,
|
||||||
allDay: instance.allDay || isMultiDay,
|
allDay: instance.allday || isMultiDay,
|
||||||
textColor: '#ffffff',
|
textColor: '#ffffff',
|
||||||
backgroundColor: eventColor,
|
backgroundColor: eventColor,
|
||||||
borderColor: eventColor,
|
borderColor: eventColor,
|
||||||
@@ -287,17 +287,25 @@ export default {
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
let end = event.date_end;
|
||||||
|
|
||||||
|
if (event.allday) {
|
||||||
|
// Для allDay: просто добавляем 1 день к конечной дате
|
||||||
|
const endDate = new Date(event.date_end);
|
||||||
|
endDate.setDate(endDate.getDate() + 1);
|
||||||
|
end = endDate.toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: event.name,
|
title: event.name,
|
||||||
start: new Date(event.date_start),
|
start: event.date_start,
|
||||||
end: new Date(event.date_end),
|
end: end,
|
||||||
allDay: event.all_day,
|
allDay: event.allday,
|
||||||
textColor: '#ffffff',
|
textColor: '#ffffff',
|
||||||
backgroundColor: eventColor,
|
backgroundColor: eventColor,
|
||||||
borderColor: eventColor,
|
borderColor: eventColor,
|
||||||
allDay: isMultiDay,
|
|
||||||
extendedProps: {
|
extendedProps: {
|
||||||
originalEventId: event.id,
|
originalEventId: event.id,
|
||||||
description: event.description,
|
description: event.description,
|
||||||
@@ -313,7 +321,6 @@ export default {
|
|||||||
|
|
||||||
successCallback(events);
|
successCallback(events);
|
||||||
},
|
},
|
||||||
editable: true,
|
|
||||||
selectable: true,
|
selectable: true,
|
||||||
eventClick: handleEventClick,
|
eventClick: handleEventClick,
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatEventTime = (event) => {
|
const formatEventTime = (event) => {
|
||||||
if (event.all_day) return 'Весь день'; // Исправлено: было allday, должно быть all_day
|
if (event.all_day) return 'Весь день';
|
||||||
|
|
||||||
const start = event.startDate.toLocaleTimeString('ru-RU', {
|
const start = event.startDate.toLocaleTimeString('ru-RU', {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
<v-col class="pb-2 pt-2 d-flex flex-column ml-n3" lg="3">
|
<v-col class="pb-2 pt-2 d-flex flex-column ml-n3" lg="3">
|
||||||
<v-row no-gutters class="gap">
|
<v-row no-gutters class="gap">
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-checkbox-btn
|
<v-checkbox-btn v-model="newDate" color="indigo-darken-4" label="Весь день" />
|
||||||
v-model="newDate"
|
|
||||||
color="indigo-darken-4"
|
|
||||||
label="Весь день"
|
|
||||||
/>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { computed, ref } from "vue";
|
import { computed } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -29,19 +25,19 @@ export default {
|
|||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
propsDateEvent.value.allday = newValue;
|
propsDateEvent.value.allday = newValue;
|
||||||
if (newValue == true)
|
if (newValue === true)
|
||||||
(propsDateEvent.value.date_end = new Date(
|
(propsDateEvent.value.date_end = new Date(
|
||||||
new Date(propsDateEvent.value.date_end).setHours(23, 59, 0)
|
new Date(propsDateEvent.value.date_end).setHours(23, 59, 59),
|
||||||
)) &&
|
)) &&
|
||||||
(propsDateEvent.value.date_start = new Date(
|
(propsDateEvent.value.date_start = new Date(
|
||||||
new Date(propsDateEvent.value.date_start).setHours(0, 0, 0)
|
new Date(propsDateEvent.value.date_start).setHours(0, 0, 0),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const propsDateEvent = computed({
|
const propsDateEvent = computed({
|
||||||
get: () => props.dateEventStart,
|
get: () => props.dateEventStart,
|
||||||
set: (value) => emit("update:dateEventStart", value),
|
set: (value) => emit('update:dateEventStart', value),
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
:active="menutime"
|
:active="menutime"
|
||||||
:focus="menutime"
|
:focus="menutime"
|
||||||
hide-details
|
hide-details
|
||||||
:disabled="chek"
|
:disabled="isAllDay"
|
||||||
>
|
>
|
||||||
</v-textarea>
|
</v-textarea>
|
||||||
<v-menu
|
<v-menu
|
||||||
@@ -61,19 +61,22 @@
|
|||||||
activator="parent"
|
activator="parent"
|
||||||
transition="scale-transition"
|
transition="scale-transition"
|
||||||
>
|
>
|
||||||
<v-time-picker
|
<v-locale-provider locale="ru">
|
||||||
v-if="menutime"
|
<v-time-picker
|
||||||
:model-value="timeEvent"
|
v-if="menutime && !isAllDay"
|
||||||
@update:model-value="onTimePickerChange"
|
:model-value="timeEvent"
|
||||||
full-width
|
@update:model-value="onTimePickerChange"
|
||||||
format="24hr"
|
full-width
|
||||||
></v-time-picker>
|
format="24hr"
|
||||||
|
:disabled="isAllDay"
|
||||||
|
></v-time-picker>
|
||||||
|
</v-locale-provider>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
</v-col>
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { formatComa } from '@/utils/universal_functions';
|
import { formatComa } from '@/utils/universal_functions';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -91,7 +94,7 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: [0, 0],
|
default: [0, 0],
|
||||||
},
|
},
|
||||||
chek: {
|
isAllDay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ export function useRecurrence() {
|
|||||||
return dates.map((date, index) => ({
|
return dates.map((date, index) => ({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: event.name,
|
title: event.name,
|
||||||
start: new Date(date),
|
start: date,
|
||||||
end: new Date(date.getTime() + duration),
|
end: (date.getTime() + duration),
|
||||||
allDay: event.allday,
|
allDay: event.allday,
|
||||||
extendedProps: {
|
extendedProps: {
|
||||||
originalEventId: event.id,
|
originalEventId: event.id,
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ export default {
|
|||||||
internalShow.value = false;
|
internalShow.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Информация о календаре - ИСПРАВЛЕНО
|
|
||||||
const calendarInfo = computed(() => {
|
const calendarInfo = computed(() => {
|
||||||
const calendarId = props.eventData.event?.calendar;
|
const calendarId = props.eventData.event?.calendar;
|
||||||
return props.allCalendars.find((cal) => cal.id == calendarId) || {};
|
return props.allCalendars.find((cal) => cal.id == calendarId) || {};
|
||||||
@@ -230,7 +229,6 @@ export default {
|
|||||||
const calendarName = computed(() => calendarInfo.value.cl_name || 'Неизвестный календарь');
|
const calendarName = computed(() => calendarInfo.value.cl_name || 'Неизвестный календарь');
|
||||||
const calendarColor = computed(() => calendarInfo.value.cl_color || 'grey');
|
const calendarColor = computed(() => calendarInfo.value.cl_color || 'grey');
|
||||||
|
|
||||||
// Участники - ИСПРАВЛЕНО
|
|
||||||
const participantsList = computed(() => {
|
const participantsList = computed(() => {
|
||||||
const participantIds = props.eventData.event?.participant || [];
|
const participantIds = props.eventData.event?.participant || [];
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
<v-row no-gutters class="gap">
|
<v-row no-gutters class="gap">
|
||||||
<time-select
|
<time-select
|
||||||
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
||||||
:chek="propsEvent.event.allday"
|
:isAllDay="propsEvent.event.allday"
|
||||||
:order="[2, 1]"
|
:order="[2, 1]"
|
||||||
:dateEvent="String(propsEvent.event.date_start)"
|
:dateEvent="String(propsEvent.event.date_start)"
|
||||||
:limitation="String(propsEvent.event.date_end)"
|
:limitation="String(propsEvent.event.date_end)"
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<time-select
|
<time-select
|
||||||
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
||||||
:chek="propsEvent.event.allday"
|
:isAllDay="propsEvent.event.allday"
|
||||||
:order="[4, 5]"
|
:order="[4, 5]"
|
||||||
:dateEvent="String(propsEvent.event.date_end)"
|
:dateEvent="String(propsEvent.event.date_end)"
|
||||||
:limitation="String(propsEvent.event.date_start)"
|
:limitation="String(propsEvent.event.date_start)"
|
||||||
@@ -471,7 +471,6 @@ export default {
|
|||||||
// Computed property с защитой от undefined
|
// Computed property с защитой от undefined
|
||||||
// const safeCalendars = computed(() => props.allCalendars || []);
|
// const safeCalendars = computed(() => props.allCalendars || []);
|
||||||
|
|
||||||
|
|
||||||
const safeCalendars = computed(() => {
|
const safeCalendars = computed(() => {
|
||||||
const userId = accountStore.user.is_idEmployee;
|
const userId = accountStore.user.is_idEmployee;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { axiosApiInstance } from '@/utils/axios-api';
|
import { axiosApiInstance } from '@/utils/axios-api';
|
||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user