chore [P-304]: merge dev-denzel branch
This commit is contained in:
1 parent
05a6797a16
commit
3c9c244dc7
9 files changed
+152
-1339
No files matched your search
@@ -7,7 +7,7 @@
|
||||
@delObject="delEvent(form.id)"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-row no-gutters class="flex-column ">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Название </v-col>
|
||||
@@ -25,7 +25,7 @@
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Участники </v-col>
|
||||
<v-col class="text-body-2 text-text_grey pb-3" lg="2"> Участники </v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:staff="newStaff"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-card class="home-calendar-widget" elevation="2">
|
||||
<v-card elevation="2">
|
||||
<v-card-text class="pa-4">
|
||||
<v-row no-gutters class="calendar-pair">
|
||||
<!-- Месячный календарь -->
|
||||
@@ -278,13 +278,6 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home-calendar-widget {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.calendar-pair {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -1,402 +0,0 @@
|
||||
<template>
|
||||
<v-locale-provider locale="ru">
|
||||
<v-calendar
|
||||
ref="calendar"
|
||||
:events="returnPeriod"
|
||||
:view-mode="type"
|
||||
:month="monthNow"
|
||||
:year="YearNow"
|
||||
:model-value="selectDay"
|
||||
class="h-100"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col class="flex-grow-0" lg="2">
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
variant="outlined"
|
||||
@click="todayDay"
|
||||
>
|
||||
Сегодня
|
||||
</v-btn>
|
||||
<v-btn icon="mdi-menu-left" variant="text" @click="returnDate" />
|
||||
|
||||
<v-btn icon="mdi-menu-right" variant="text" @click="nextDay" />
|
||||
</v-col>
|
||||
<v-col class="text-h6 align-self-center ml-n6">
|
||||
<span class="text-capitalize">
|
||||
{{ getMonthName(monthNow + 1) }}
|
||||
</span>
|
||||
|
||||
{{ YearNow }} г.
|
||||
</v-col>
|
||||
<v-col class="text-end align-self-center">
|
||||
<v-btn
|
||||
v-for="x in types"
|
||||
:key="x"
|
||||
:active="type != null && type == x.type"
|
||||
variant="text"
|
||||
@click="switchCalendar(x.type)"
|
||||
class="text-subtitle-1"
|
||||
:color="
|
||||
type != null && type == x.type ? 'btn_text' : 'text_grey'
|
||||
"
|
||||
>
|
||||
{{ x.text }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</template>
|
||||
|
||||
<template v-slot:event="{ day, event }">
|
||||
<v-chip
|
||||
v-show="
|
||||
(!event.disable &&
|
||||
new Date(day.date).setHours(0, 0, 0, 0) !=
|
||||
new Date(event.end).setHours(0, 0, 0, 0)) ||
|
||||
(event.disable &&
|
||||
!(
|
||||
new Date(day.date).setHours(0, 0, 0, 0) !=
|
||||
new Date(event.end).setHours(0, 0, 0, 0)
|
||||
))
|
||||
"
|
||||
class="w-100"
|
||||
density="compact"
|
||||
:class="funRoundet(event, day)"
|
||||
:color="event.color"
|
||||
@click="whatDay(event)"
|
||||
>
|
||||
{{ event.title }}
|
||||
</v-chip>
|
||||
</template>
|
||||
</v-calendar>
|
||||
</v-locale-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, computed } from "vue";
|
||||
import { RRule } from "rrule";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
allEvent: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const type = ref("month");
|
||||
const types = [
|
||||
{ type: "day", text: "День" },
|
||||
{ type: "week", text: "Неделя" },
|
||||
{ type: "month", text: "Месяц" },
|
||||
// { type: "modntdh", text: "Год" },
|
||||
{ type: "modnth", text: "Расписание" },
|
||||
];
|
||||
|
||||
const switchCalendar = (t) => {
|
||||
type.value = t;
|
||||
};
|
||||
|
||||
const propsAllEvent = computed({
|
||||
get: () => props.allEvent,
|
||||
set: (value) => emit("update:allEvent", value),
|
||||
});
|
||||
|
||||
const returnPeriod = computed({
|
||||
get() {
|
||||
let select = [];
|
||||
|
||||
propsAllEvent.value.forEach((e) => {
|
||||
e.events.forEach((i) => {
|
||||
if (i.period == null && new Date(i.date_end) > dayNextMonth.value)
|
||||
i.date_end = dayNextMonth.value;
|
||||
|
||||
let objRule = JSON.parse(i.period);
|
||||
|
||||
|
||||
if (objRule != null) {
|
||||
let startnew =
|
||||
objRule.origOptions.dtstart.split("T")[1].split(":")[0] != 21 &&
|
||||
i.allday == false
|
||||
? new Date(objRule.origOptions.dtstart)
|
||||
: new Date(objRule.origOptions.dtstart.split("T")[0]);
|
||||
|
||||
let rule = new RRule({
|
||||
...objRule.origOptions,
|
||||
|
||||
dtstart: new Date(startnew),
|
||||
until:
|
||||
"until" in objRule.origOptions
|
||||
? new Date(objRule.origOptions.until)
|
||||
: dayNextMonth.value,
|
||||
});
|
||||
|
||||
let actRule = rule.all();
|
||||
|
||||
let lastDateMonth = new Date(
|
||||
new Date(dayNextMonth.value).setDate(
|
||||
new Date(dayNextMonth.value).getDate() - 1
|
||||
)
|
||||
);
|
||||
|
||||
actRule
|
||||
.filter(
|
||||
(date) =>
|
||||
new Date(date).getMonth() ===
|
||||
new Date(lastDateMonth).getMonth() &&
|
||||
new Date(date).getYear() ===
|
||||
new Date(lastDateMonth).getYear()
|
||||
)
|
||||
.forEach((r) => {
|
||||
let ev = {
|
||||
rule: objRule.origOptions,
|
||||
title: i.name,
|
||||
color: e.cl_color,
|
||||
start: new Date(r),
|
||||
start_event: new Date(i.date_start),
|
||||
end: new Date(i.date_end),
|
||||
id: i.id,
|
||||
disable:
|
||||
new Date(r).setHours(0, 0, 0, 0) ==
|
||||
new Date(i.date_end).setHours(0, 0, 0, 0),
|
||||
};
|
||||
|
||||
select.push(ev);
|
||||
});
|
||||
} else {
|
||||
let dates = getDatesBetweenDates(
|
||||
new Date(i.date_start),
|
||||
new Date(i.date_end)
|
||||
);
|
||||
|
||||
dates.forEach((d) => {
|
||||
let ev = {
|
||||
rule: "",
|
||||
title: i.name,
|
||||
color: e.cl_color,
|
||||
start: new Date(d),
|
||||
end: new Date(i.date_end),
|
||||
id: i.id,
|
||||
disable:
|
||||
new Date(d).setHours(0, 0, 0, 0) ==
|
||||
new Date(i.date_end).setHours(0, 0, 0, 0),
|
||||
};
|
||||
select.push(ev);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return select;
|
||||
},
|
||||
});
|
||||
|
||||
const getDatesBetweenDates = (startDate, endDate) => {
|
||||
let dates = [];
|
||||
let currentDate = new Date(startDate);
|
||||
|
||||
while (currentDate <= endDate) {
|
||||
dates.push(new Date(currentDate));
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
}
|
||||
|
||||
return dates;
|
||||
};
|
||||
|
||||
const selectDay = ref([new Date()]);
|
||||
const monthNow = ref(new Date().getMonth());
|
||||
const YearNow = ref(new Date().getFullYear());
|
||||
const endWeek = computed({
|
||||
get() {
|
||||
return 8 - new Date(selectDay.value).getDay();
|
||||
},
|
||||
});
|
||||
|
||||
const returnDate = () => {
|
||||
if (type.value == "month") {
|
||||
if (monthNow.value != 0) {
|
||||
monthNow.value--;
|
||||
} else {
|
||||
monthNow.value = 11;
|
||||
YearNow.value -= 1;
|
||||
}
|
||||
} else if (type.value == "day") {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() - 1
|
||||
)
|
||||
);
|
||||
} else {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() - endWeek.value
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const nextDay = () => {
|
||||
if (type.value == "month") {
|
||||
if (monthNow.value < 11) {
|
||||
monthNow.value++;
|
||||
} else {
|
||||
monthNow.value = 0;
|
||||
YearNow.value += 1;
|
||||
}
|
||||
} else if (type.value == "day") {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() + 1
|
||||
)
|
||||
);
|
||||
} else {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() + endWeek.value
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const todayDay = () => {
|
||||
monthNow.value = new Date().getMonth();
|
||||
YearNow.value = new Date().getFullYear();
|
||||
selectDay.value = new Date();
|
||||
};
|
||||
|
||||
const getMonthName = (monthNumber) => {
|
||||
const date = new Date();
|
||||
date.setMonth(monthNumber - 1);
|
||||
|
||||
return date.toLocaleString("ru", {
|
||||
month: "long",
|
||||
});
|
||||
};
|
||||
|
||||
const whatDay = (e) => {
|
||||
emit("getEvent", e.id);
|
||||
};
|
||||
|
||||
const zeroTime = (date) => {
|
||||
return new Date(date).setHours(0, 0, 0, 0);
|
||||
};
|
||||
|
||||
const funRoundet = (ev, day) => {
|
||||
|
||||
if (ev.rule.freq == 3) {
|
||||
if (
|
||||
zeroTime(day.date) != zeroTime(ev.start_event) &&
|
||||
zeroTime(day.date) != zeroTime(ev.end)
|
||||
) {
|
||||
return "rounded-sm";
|
||||
} else if (
|
||||
zeroTime(day.date) == zeroTime(ev.start_event) &&
|
||||
zeroTime(day.date) == zeroTime(ev.end)
|
||||
) {
|
||||
return "";
|
||||
} else if (zeroTime(day.date) != zeroTime(ev.start_event)) {
|
||||
return "rounded-s-lg";
|
||||
} else if (zeroTime(day.date) == zeroTime(ev.start_event)) {
|
||||
return "rounded-e-lg";
|
||||
}
|
||||
}
|
||||
|
||||
if (ev.rule.freq == 2) {
|
||||
let weeknumS =
|
||||
ev.rule.byweekday[0].weekday == 6
|
||||
? 0
|
||||
: ev.rule.byweekday[0].weekday + 1;
|
||||
let weeknumE =
|
||||
ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday == 6
|
||||
? 0
|
||||
: ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday + 1;
|
||||
|
||||
if (day.date.getDay() == weeknumS && weeknumS != weeknumE) {
|
||||
return "rounded-e-lg";
|
||||
} else if (day.date.getDay() == weeknumE && weeknumS != weeknumE) {
|
||||
return "rounded-s-lg";
|
||||
} else if (
|
||||
day.date.getDay() != weeknumS &&
|
||||
day.date.getDay() != weeknumE
|
||||
) {
|
||||
return "rounded-sm";
|
||||
} else {
|
||||
return "rounded-lg";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (ev.rule.freq == 0) {
|
||||
if (zeroTime(day.date) == zeroTime(ev.start_event)) {
|
||||
return "rounded-e-lg"
|
||||
}
|
||||
// let weeknumS =
|
||||
// ev.rule.byweekday[0].weekday == 6
|
||||
// ? 0
|
||||
// : ev.rule.byweekday[0].weekday + 1;
|
||||
// let weeknumE =
|
||||
// ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday == 6
|
||||
// ? 0
|
||||
// : ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday + 1;
|
||||
|
||||
// if (day.date.getDay() == weeknumS && weeknumS != weeknumE) {
|
||||
// return "rounded-e-lg";
|
||||
// } else if (day.date.getDay() == weeknumE && weeknumS != weeknumE) {
|
||||
// return "rounded-s-lg";
|
||||
// } else if (
|
||||
// day.date.getDay() != weeknumS &&
|
||||
// day.date.getDay() != weeknumE
|
||||
// ) {
|
||||
// return "rounded-sm";
|
||||
// } else {
|
||||
// return "rounded-lg";
|
||||
// }
|
||||
|
||||
return "rounded-sm"
|
||||
}
|
||||
};
|
||||
|
||||
const dayNextMonth = computed({
|
||||
get() {
|
||||
const firstDayOfNextMonth = new Date(
|
||||
YearNow.value,
|
||||
monthNow.value + 1,
|
||||
1
|
||||
);
|
||||
|
||||
return firstDayOfNextMonth;
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
type,
|
||||
types,
|
||||
switchCalendar,
|
||||
|
||||
monthNow,
|
||||
YearNow,
|
||||
returnDate,
|
||||
getMonthName,
|
||||
propsAllEvent,
|
||||
whatDay,
|
||||
nextDay,
|
||||
todayDay,
|
||||
selectDay,
|
||||
returnPeriod,
|
||||
funRoundet,
|
||||
dayNextMonth,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.v-calendar__container {
|
||||
overflow: auto;
|
||||
height: 87vh;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-card min-height="436" max-height="80%" class="pa-3" max-width="50vw">
|
||||
<v-card min-height="436" max-height="80%" class="pa-2" max-width="50vw">
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
{{ title }}
|
||||
<v-icon
|
||||
|
||||
@@ -1,768 +0,0 @@
|
||||
<template>
|
||||
<dialog-create
|
||||
:title="titleCard"
|
||||
:newOrOld="isNewEvent"
|
||||
@postData="postData"
|
||||
@closeDialog="$emit('closeDialog')"
|
||||
@delObject="delEvent(propsEvent?.event?.id)"
|
||||
ref="createDialog"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Название </v-col>
|
||||
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Добавить название"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsEvent.event.name"
|
||||
:rules="rules.name"
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Участники </v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:staff="newStaff"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
:authorID="currentCalendarAuthorId"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Календарь</v-col>
|
||||
<v-col>
|
||||
<v-autocomplete
|
||||
v-model="myCalendar"
|
||||
:items="safeCalendars"
|
||||
label="Выберите календарь или найдите по названию"
|
||||
item-title="cl_name"
|
||||
item-value="id"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
class="py-3"
|
||||
return-object
|
||||
:rules="rules.calendar"
|
||||
:disabled="'id' in propsEvent.event"
|
||||
auto-select-first
|
||||
>
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-avatar class="cursor-pointer" size="8" :color="item.raw.cl_color" />
|
||||
<span class="pl-2">
|
||||
{{ item.title }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item="{ item, props }">
|
||||
<v-list-item
|
||||
:key="item.raw.id"
|
||||
:value="item"
|
||||
color="primary"
|
||||
v-bind="props"
|
||||
@click.stop="myCalendar = item.raw"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar class="cursor-pointer" size="8" :color="item.raw.cl_color" />
|
||||
</template>
|
||||
<!-- {{ item.title }} -->
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-col></v-row
|
||||
>
|
||||
<v-row no-gutters class="align-top">
|
||||
<v-col class="text-body-2 text-text_grey pt-3" lg="2"> Дата и время </v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
<time-select
|
||||
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
||||
:chek="propsEvent.event.allday"
|
||||
:order="[2, 1]"
|
||||
:dateEvent="String(propsEvent.event.date_start)"
|
||||
:limitation="String(propsEvent.event.date_end)"
|
||||
@update:dateEvent="updateDateStart"
|
||||
@adjustEndDate="handleAutoAdjustEnd"
|
||||
/>
|
||||
<v-col class="order-3 flex-grow-0">
|
||||
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||
</v-col>
|
||||
<time-select
|
||||
:rule="selectedRule.rule ? selectedRule.rule.freq : -1"
|
||||
:chek="propsEvent.event.allday"
|
||||
:order="[4, 5]"
|
||||
:dateEvent="String(propsEvent.event.date_end)"
|
||||
:limitation="String(propsEvent.event.date_start)"
|
||||
@update:dateEvent="updateDateEnd"
|
||||
@adjustEndDate="handleAutoAdjustEnd"
|
||||
/>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<period-events
|
||||
:dateEventStart="propsEvent.event"
|
||||
@update:dateEventStart="propsEvent.event = $event"
|
||||
/>
|
||||
<v-col lg="7" class="pt-2 ml-5">
|
||||
<v-autocomplete
|
||||
v-model="selectedRule"
|
||||
:items="repeatRules"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
return-object
|
||||
item-title="type"
|
||||
item-value="id"
|
||||
@update:model-value="updatePeriodRule"
|
||||
>
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-row no-gutters class="align-top" style="height: 50px">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Окончание события </v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row class="gap" no-gutters>
|
||||
<v-checkbox
|
||||
v-model="showRepeatEnd"
|
||||
:disabled="isRepeatEndDisabled"
|
||||
density="compact"
|
||||
hide-details
|
||||
class="pr-3 pb-3"
|
||||
/>
|
||||
<time-select
|
||||
:showTime="false"
|
||||
v-if="showRepeatEnd"
|
||||
:chek="false"
|
||||
:order="[1, 2]"
|
||||
:dateEvent="repeatEndDate ? String(repeatEndDate) : new Date()"
|
||||
@update:dateEvent="updateRepeatEndDate"
|
||||
/>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row
|
||||
no-gutters
|
||||
class="align-start d-flex pt-3 mb-3"
|
||||
style="height: auto; min-height: 100px; max-height: 300px"
|
||||
>
|
||||
<v-col class="text-body-2 text-text_grey pb-5 pt-3" lg="2"> Файлы </v-col>
|
||||
|
||||
<uploading-file
|
||||
v-model:new-files="newFiles"
|
||||
:files="propsEvent.event.files"
|
||||
@update:files="handleFilesUpdate"
|
||||
@postFiles="postFiles"
|
||||
/>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center pt-6">
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Дополнительное описание"
|
||||
rows="3"
|
||||
variant="outlined"
|
||||
auto-grow
|
||||
v-model="propsEvent.event.description"
|
||||
class="scrollable-textarea pt-3"
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
</v-row>
|
||||
</template>
|
||||
</dialog-create>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import DialogCreate from '@/components/calendar_of_events/UI_calendar/dialogCreate.vue';
|
||||
import calendarCreateSelect from '@/components/calendar_of_events/calendar-create-select.vue';
|
||||
import TimeSelect from '@/components/calendar_of_events/UI_calendar/timeSelect.vue';
|
||||
import UploadingFile from '@/components/UI/defaultportal/uploading-file.vue';
|
||||
import ReminderEvent from '@/components/calendar_of_events/UI_calendar/reminderEvent.vue';
|
||||
import PeriodEvents from '@/components/calendar_of_events/UI_calendar/periodEvents.vue';
|
||||
import { useAlertStore } from '@/store/UseAlertStore';
|
||||
import { RRule } from 'rrule';
|
||||
import { useRecurrence } from '@/components/calendar_of_events/composables/useReccurrence';
|
||||
import { useCalendarStore } from '../../store/calendarStore';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
calendarCreateSelect,
|
||||
DialogCreate,
|
||||
TimeSelect,
|
||||
UploadingFile,
|
||||
ReminderEvent,
|
||||
PeriodEvents,
|
||||
},
|
||||
|
||||
props: {
|
||||
eventCalendar: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
allCalendars: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
selectedRule: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const accountStore = useAccountStore();
|
||||
const calendarStore = useCalendarStore();
|
||||
const createDialog = ref(null);
|
||||
|
||||
const { parseRecurrenceOptions, isRecurringEvent } = useRecurrence();
|
||||
|
||||
const propsEvent = computed({
|
||||
get: () => {
|
||||
return props.eventCalendar;
|
||||
},
|
||||
|
||||
set: (value) => emit('update:eventCalendar', value),
|
||||
});
|
||||
|
||||
const currentCalendarAuthorId = computed(() => {
|
||||
if (isNewEvent.value) {
|
||||
// Для нового события - автор текущего выбранного календаря
|
||||
return myCalendar.value?.author;
|
||||
} else {
|
||||
// Для существующего события - автор календаря события
|
||||
const eventCalendarId = propsEvent.value.event.calendar;
|
||||
const currentCalendar = propsEvent.value.mycalendars?.find(
|
||||
(cal) => parseInt(cal.id) === parseInt(eventCalendarId),
|
||||
);
|
||||
return currentCalendar?.author;
|
||||
}
|
||||
});
|
||||
|
||||
const newStaff = computed({
|
||||
get() {
|
||||
let filteredStaff = [];
|
||||
|
||||
if (isNewEvent.value) {
|
||||
if (myCalendar.value == null) return [];
|
||||
const participants = myCalendar.value.participant || [];
|
||||
const calendarParticipantIds = new Set(participants.map((p) => p.participant_calendar));
|
||||
|
||||
// Мутируем И фильтруем для НОВОГО события
|
||||
filteredStaff = calendarStore.employees
|
||||
.map((department) => {
|
||||
// ФИЛЬТРУЕМ сотрудников - оставляем только тех, кто в календаре
|
||||
const filteredEmployees = department.employees.filter((employee) =>
|
||||
calendarParticipantIds.has(employee.id),
|
||||
);
|
||||
|
||||
// МУТАЦИЯ: устанавливаем selected=true для отфильтрованных сотрудников
|
||||
filteredEmployees.forEach((employee) => {
|
||||
employee.selected = true;
|
||||
});
|
||||
|
||||
return {
|
||||
...department,
|
||||
employees: filteredEmployees,
|
||||
};
|
||||
})
|
||||
.filter((dept) => dept.employees.length > 0);
|
||||
} else {
|
||||
// СУЩЕСТВУЮЩЕЕ СОБЫТИЕ - фильтр по календарю
|
||||
const eventCalendarId = propsEvent.value.event.calendar;
|
||||
const currentCalendar = propsEvent.value.mycalendars?.find(
|
||||
(cal) => parseInt(cal.id) === parseInt(eventCalendarId),
|
||||
);
|
||||
|
||||
if (!currentCalendar?.participant) return [];
|
||||
|
||||
const calendarParticipantIds = new Set(currentCalendar.participant.map((p) => p.id));
|
||||
const eventParticipantIds = new Set(propsEvent.value.event.participant || []);
|
||||
|
||||
// Мутируем И фильтруем для СУЩЕСТВУЮЩЕГО события
|
||||
filteredStaff = calendarStore.employees
|
||||
.map((department) => {
|
||||
// ФИЛЬТРУЕМ сотрудников - оставляем только тех, кто в календаре
|
||||
const filteredEmployees = department.employees.filter((employee) =>
|
||||
calendarParticipantIds.has(employee.id),
|
||||
);
|
||||
|
||||
// МУТАЦИЯ: устанавливаем selected на основе участников события
|
||||
filteredEmployees.forEach((employee) => {
|
||||
employee.selected =
|
||||
employee.id === accountStore.user.is_idEmployee ||
|
||||
eventParticipantIds.has(employee.id);
|
||||
});
|
||||
|
||||
return {
|
||||
...department,
|
||||
employees: filteredEmployees,
|
||||
};
|
||||
})
|
||||
.filter((dept) => dept.employees.length > 0);
|
||||
}
|
||||
|
||||
return filteredStaff;
|
||||
},
|
||||
});
|
||||
|
||||
// ВАЛИДАЦИЯ
|
||||
const rules = {
|
||||
name: [
|
||||
(val) => !!val || 'Поле обязательно для заполнения',
|
||||
(val) => (val && val.length >= 3) || 'Минимум 3 символа',
|
||||
(val) => (val && val.length <= 100) || 'Максимум 100 символов',
|
||||
],
|
||||
calendar: [(val) => !!val || 'Выберите календарь'],
|
||||
};
|
||||
|
||||
const repeatRules = [
|
||||
{ type: 'Не повторять', rule: null, id: 1 },
|
||||
{
|
||||
type: 'Каждый день',
|
||||
rule: { freq: RRule.DAILY },
|
||||
id: 2,
|
||||
},
|
||||
{
|
||||
type: 'Каждую неделю',
|
||||
rule: { freq: RRule.WEEKLY },
|
||||
// По умолчанию - в тот же день недели, что и начальная дата
|
||||
getRule: (startDate) => {
|
||||
const day = new Date(startDate).getDay();
|
||||
// Преобразуем день недели в формат RRule (0 — понедельник)
|
||||
const byweekday = [day === 0 ? RRule.SU : day - 1];
|
||||
return { freq: RRule.WEEKLY, byweekday };
|
||||
},
|
||||
id: 3,
|
||||
},
|
||||
|
||||
{
|
||||
type: 'Каждый месяц',
|
||||
rule: { freq: RRule.MONTHLY },
|
||||
// По умолчанию - в тот же день месяца
|
||||
getRule: (startDate) => ({
|
||||
freq: RRule.MONTHLY,
|
||||
bymonthday: [new Date(startDate).getDate()],
|
||||
}),
|
||||
id: 4,
|
||||
},
|
||||
{
|
||||
type: 'Каждый квартал',
|
||||
rule: { freq: RRule.MONTHLY, interval: 3 },
|
||||
getRule: (startDate) => {
|
||||
const date = new Date(startDate);
|
||||
return {
|
||||
freq: RRule.MONTHLY,
|
||||
interval: 3, // каждые 3 месяца
|
||||
bymonthday: [date.getDate()],
|
||||
};
|
||||
},
|
||||
id: 6,
|
||||
},
|
||||
|
||||
{
|
||||
type: 'Каждый год',
|
||||
rule: { freq: RRule.YEARLY },
|
||||
// По умолчанию - в тот же день и месяц
|
||||
getRule: (startDate) => {
|
||||
const date = new Date(startDate);
|
||||
return {
|
||||
freq: RRule.YEARLY,
|
||||
bymonth: [date.getMonth() + 1],
|
||||
bymonthday: [date.getDate()],
|
||||
};
|
||||
},
|
||||
id: 5,
|
||||
},
|
||||
];
|
||||
|
||||
const selectedRule = ref(repeatRules[0]);
|
||||
const showRepeatEnd = ref(false);
|
||||
const repeatEndDate = ref(new Date());
|
||||
|
||||
// Инициализация повторов при редактировании
|
||||
const initializeRule = () => {
|
||||
if (!propsEvent.value.event.period) {
|
||||
selectedRule.value = repeatRules[0]; // "Не повторять"
|
||||
repeatEndDate.value = propsEvent.value.event.date_end
|
||||
? new Date(propsEvent.value.event.date_end)
|
||||
: new Date();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Используем isRecurringEvent для проверки
|
||||
if (isRecurringEvent(propsEvent.value.event)) {
|
||||
// Парсим period с использованием parseRecurrenceOptions
|
||||
const rruleOptions = parseRecurrenceOptions(
|
||||
propsEvent.value.event.period,
|
||||
propsEvent.value.event.date_start,
|
||||
);
|
||||
|
||||
if (rruleOptions) {
|
||||
// ОБНОВЛЕННЫЙ ПОИСК ПРАВИЛА С ПОДДЕРЖКОЙ КВАРТАЛОВ
|
||||
let foundRule;
|
||||
|
||||
// Для квартальных событий (MONTHLY с interval=3)
|
||||
if (rruleOptions.freq === RRule.MONTHLY && rruleOptions.interval === 3) {
|
||||
foundRule = repeatRules.find((rule) => rule.id === 6); // ID квартального правила
|
||||
} else {
|
||||
// Для остальных типов - ищем по freq
|
||||
foundRule = repeatRules.find((rule) => rule.rule?.freq === rruleOptions.freq);
|
||||
}
|
||||
|
||||
selectedRule.value = foundRule || repeatRules[0];
|
||||
|
||||
// ВАЖНО: инициализируем repeatEndDate и showRepeatEnd
|
||||
if (rruleOptions.until) {
|
||||
// Если в RRULE есть UNTIL, используем эту дату
|
||||
repeatEndDate.value = new Date(rruleOptions.until);
|
||||
showRepeatEnd.value = true;
|
||||
} else {
|
||||
// Если нет UNTIL, используем date_end события
|
||||
repeatEndDate.value = propsEvent.value.event.date_end
|
||||
? new Date(propsEvent.value.event.date_end)
|
||||
: new Date();
|
||||
showRepeatEnd.value = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedRule.value = repeatRules[0];
|
||||
showRepeatEnd.value = false;
|
||||
repeatEndDate.value = propsEvent.value.event.date_end
|
||||
? new Date(propsEvent.value.event.date_end)
|
||||
: new Date();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing period:', error, 'Raw period:', propsEvent.value.event.period);
|
||||
selectedRule.value = repeatRules[0];
|
||||
showRepeatEnd.value = false;
|
||||
repeatEndDate.value = propsEvent.value.event.date_end
|
||||
? new Date(propsEvent.value.event.date_end)
|
||||
: new Date();
|
||||
}
|
||||
};
|
||||
|
||||
const isRepeatEndDisabled = computed(() => {
|
||||
return !selectedRule.value.rule; // disabled если правило null (не повторять)
|
||||
});
|
||||
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const titleCard = computed(() => {
|
||||
if (propsEvent.value.event.hasOwnProperty('id')) {
|
||||
return 'Редактирование события';
|
||||
} else {
|
||||
return 'Новое событие';
|
||||
}
|
||||
});
|
||||
|
||||
const isNewEvent = computed(() => !propsEvent.value.event.hasOwnProperty('id'));
|
||||
|
||||
const myCalendar = ref(null);
|
||||
// const isNewEvent = computed(() => !propsEvent.value.event.id);
|
||||
|
||||
// Computed property с защитой от undefined
|
||||
// const safeCalendars = computed(() => props.allCalendars || []);
|
||||
|
||||
|
||||
const safeCalendars = computed(() => {
|
||||
const userId = accountStore.user.is_idEmployee;
|
||||
|
||||
return (props.allCalendars || []).filter((calendar) => {
|
||||
// Пользователь - автор календаря (полные права)
|
||||
if (calendar.author === userId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Пользователь - участник с правами редактора
|
||||
const participant = calendar.participant?.find((p) => p.participant_calendar === userId);
|
||||
|
||||
return participant?.editor === true;
|
||||
});
|
||||
});
|
||||
|
||||
const isCalendarsReady = computed(() => safeCalendars.value.length > 0);
|
||||
|
||||
// Computed для календаря события
|
||||
const eventCalendar = computed(() => {
|
||||
if (!propsEvent.value?.event?.calendar || !safeCalendars.value.length) return null;
|
||||
return safeCalendars.value.find((cal) => cal.id === propsEvent.value.event.calendar);
|
||||
});
|
||||
|
||||
// Единоразовая инициализация при монтировании/получении данных
|
||||
const initializeCalendar = () => {
|
||||
if (myCalendar.value) return; // Уже инициализирован
|
||||
|
||||
// Приоритет 1: календарь из события (редактирование)
|
||||
if (eventCalendar.value) {
|
||||
myCalendar.value = eventCalendar.value;
|
||||
return;
|
||||
}
|
||||
|
||||
// Приоритет 2: первый доступный календарь (создание)
|
||||
if (safeCalendars.value.length > 0) {
|
||||
myCalendar.value = safeCalendars.value[0];
|
||||
}
|
||||
};
|
||||
|
||||
// Инициализируем когда все готово
|
||||
watch(
|
||||
[() => safeCalendars.value.length, () => propsEvent.value],
|
||||
() => {
|
||||
initializeCalendar();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// Дополнительная защита - вотчер только на смену самого календаря
|
||||
watch(eventCalendar, (newCalendar) => {
|
||||
if (newCalendar && newCalendar.id !== myCalendar.value?.id) {
|
||||
myCalendar.value = newCalendar;
|
||||
}
|
||||
});
|
||||
|
||||
const delEvent = (idev) => {
|
||||
axiosApiInstance.delete(`api/calendar_of_events/my_events/?delid=${idev}`).then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = 'mdi-check';
|
||||
feedalert.color = 'orange-accent-1';
|
||||
emit('getCalendar');
|
||||
});
|
||||
emit('closeDialog');
|
||||
};
|
||||
|
||||
const newFiles = ref([]);
|
||||
|
||||
const handleFilesUpdate = (updatedExistingFiles) => {
|
||||
// Сохраняем новые файлы во временную переменную
|
||||
const currentNewFiles = [...newFiles.value];
|
||||
|
||||
// Обновляем существующие файлы
|
||||
propsEvent.value.event.files = updatedExistingFiles;
|
||||
|
||||
// Восстанавливаем новые файлы
|
||||
newFiles.value = currentNewFiles;
|
||||
};
|
||||
|
||||
const postFiles = (updatedFiles) => {
|
||||
newFiles.value = updatedFiles;
|
||||
};
|
||||
|
||||
const returnIdParticant = (idPart) => {
|
||||
idPart.staff.forEach((e) => {
|
||||
if (e.selected == true && !propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
} else {
|
||||
let ind = propsEvent.value.event.participant.findIndex((l) => l == e.id);
|
||||
|
||||
if (ind != -1) {
|
||||
propsEvent.value.event.participant.splice(ind, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const cbSelect = (item, arr) => {
|
||||
item.forEach((e) => {
|
||||
if (!('employees' in e)) {
|
||||
if (!propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
}
|
||||
}
|
||||
if ('employees' in e) {
|
||||
cbSelect(e.employees);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const menudate = ref(false);
|
||||
|
||||
const postData = (validate) => {
|
||||
if (validate) {
|
||||
updatePeriodRule(selectedRule.value);
|
||||
propsEvent.value.event.calendar = myCalendar.value.id;
|
||||
|
||||
let postEvent = new FormData();
|
||||
|
||||
postEvent.append(
|
||||
'event',
|
||||
JSON.stringify({ ...propsEvent.value.event, files: propsEvent.value.event.files }),
|
||||
);
|
||||
|
||||
if (propsEvent.value.event.files !== null) {
|
||||
// newFiles.value.forEach((e) => postEvent.append('files', e));
|
||||
newFiles.value.forEach((file) => {
|
||||
postEvent.append('files', file, file.name);
|
||||
});
|
||||
}
|
||||
|
||||
axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = 'mdi-check';
|
||||
feedalert.color = 'green-darken-4';
|
||||
emit('getCalendar');
|
||||
emit('closeDialog');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleAutoAdjustEnd = (newEndDate) => {
|
||||
propsEvent.value.event.date_end = newEndDate;
|
||||
};
|
||||
|
||||
const updateRepeatEndDate = (date) => {
|
||||
repeatEndDate.value = date;
|
||||
updatePeriodRule(selectedRule.value); // Пересоздаем правило с новой датой
|
||||
};
|
||||
|
||||
watch(selectedRule, (newRule) => {
|
||||
if (!newRule.rule) {
|
||||
showRepeatEnd.value = false;
|
||||
repeatEndDate.value = null;
|
||||
}
|
||||
});
|
||||
|
||||
const updateDateStart = (newDate) => {
|
||||
// Нормализуем к ISO строке
|
||||
const normalizedDate = new Date(newDate).toISOString();
|
||||
propsEvent.value.event.date_start = normalizedDate;
|
||||
|
||||
// При изменении даты начала - обновляем правило повторений
|
||||
const startDate = new Date(normalizedDate);
|
||||
const endDate = new Date(propsEvent.value.event.date_end);
|
||||
|
||||
if (startDate > endDate) {
|
||||
const adjustedEnd = new Date(startDate);
|
||||
adjustedEnd.setHours(startDate.getHours() + 1);
|
||||
propsEvent.value.event.date_end = adjustedEnd.toISOString(); // Тоже ISO
|
||||
}
|
||||
|
||||
if (selectedRule.value.rule) {
|
||||
updatePeriodRule(selectedRule.value);
|
||||
}
|
||||
};
|
||||
|
||||
const updateDateEnd = (newDate) => {
|
||||
// Нормализуем к ISO строке
|
||||
propsEvent.value.event.date_end = new Date(newDate).toISOString();
|
||||
};
|
||||
|
||||
// функция обновления периода
|
||||
const updatePeriodRule = (rule) => {
|
||||
selectedRule.value = rule;
|
||||
|
||||
if (!rule.rule) {
|
||||
propsEvent.value.event.period = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const dtstart = new Date(propsEvent.value.event.date_start);
|
||||
|
||||
const ruleOptions = {
|
||||
...rule.rule,
|
||||
dtstart: dtstart,
|
||||
};
|
||||
|
||||
if (showRepeatEnd.value && repeatEndDate.value) {
|
||||
ruleOptions.until = new Date(repeatEndDate.value);
|
||||
}
|
||||
|
||||
if (rule.rule.freq === RRule.WEEKLY) {
|
||||
const day = new Date(propsEvent.value.event.date_start).getDay();
|
||||
// Преобразуем день недели в формат RRule (0 — понедельник)
|
||||
const byweekday = [day === 0 ? RRule.SU : day - 1];
|
||||
ruleOptions.byweekday = byweekday;
|
||||
}
|
||||
if (rule.rule.freq === RRule.MONTHLY) {
|
||||
ruleOptions.bymonthday = [new Date(propsEvent.value.event.date_start).getDate()];
|
||||
}
|
||||
if (rule.rule.freq === RRule.YEARLY) {
|
||||
const date = new Date(propsEvent.value.event.date_start);
|
||||
ruleOptions.bymonth = [date.getMonth() + 1];
|
||||
ruleOptions.bymonthday = [date.getDate()];
|
||||
}
|
||||
const rrule = new RRule(ruleOptions);
|
||||
|
||||
propsEvent.value.event.period = rrule.toString();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => propsEvent.value.event?.period,
|
||||
(newPeriod) => {
|
||||
if (newPeriod) {
|
||||
initializeRule();
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
return {
|
||||
menudate,
|
||||
titleCard,
|
||||
propsEvent,
|
||||
newStaff,
|
||||
returnIdParticant,
|
||||
postFiles,
|
||||
postData,
|
||||
rules,
|
||||
delEvent,
|
||||
myCalendar,
|
||||
safeCalendars,
|
||||
isCalendarsReady,
|
||||
isNewEvent,
|
||||
currentCalendarAuthorId,
|
||||
isRepeatEndDisabled,
|
||||
|
||||
repeatRules,
|
||||
updatePeriodRule,
|
||||
selectedRule,
|
||||
updateDateEnd,
|
||||
updateDateStart,
|
||||
initializeRule,
|
||||
|
||||
createDialog,
|
||||
handleAutoAdjustEnd,
|
||||
newFiles,
|
||||
handleFilesUpdate,
|
||||
initializeCalendar,
|
||||
updateRepeatEndDate,
|
||||
showRepeatEnd,
|
||||
repeatEndDate,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.scrollable-textarea {
|
||||
overflow-y: auto;
|
||||
max-height: 160px;
|
||||
}
|
||||
|
||||
.scrollable-textarea::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.scrollable-textarea::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.scrollable-textarea::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.scrollable-textarea::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
</style>
|
||||
@@ -1,28 +1,4 @@
|
||||
<template>
|
||||
<!-- Карусель: Компонент для отображения изображений и видео с сервера в виде карусели -->
|
||||
<v-carousel
|
||||
v-model="currentslide"
|
||||
:interval="interval"
|
||||
cover
|
||||
cycle
|
||||
height="450"
|
||||
hide-delimiters
|
||||
hide-delimiter-background
|
||||
:show-arrows="carous.length < 2 ? false : 'hover'"
|
||||
color="teal-darken-4"
|
||||
@update:modelValue="slidechanged"
|
||||
>
|
||||
<template v-for="(x, i) in carous" :key="i">
|
||||
<v-carousel-item v-if="!x.link.endsWith('mp4')" :src="`${burl}${x.link}`" cover eager>
|
||||
<v-container fill-height fluid pa-0 ma-0 pb-3 class="flex-column h-100 d-flex">
|
||||
<v-card
|
||||
v-if="x.text !== '' || x.title != null"
|
||||
class="bgCard h-100 d-flex flex-column"
|
||||
style="background: rgba(255, 255, 255, 0.3) !important; background-color: rgba(255, 255, 255, 0.3) !important;"
|
||||
>
|
||||
<v-card-title
|
||||
v-if="x.title != null"
|
||||
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
|
||||
<!-- Карусель -->
|
||||
<div
|
||||
class="news-carousel"
|
||||
|
||||
@@ -1,128 +1,101 @@
|
||||
<template>
|
||||
<v-row class="">
|
||||
<v-col class="flex-column d-flex pa-0">
|
||||
<v-row class="mt-0 mx-3 h-0 overflow-auto ">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
class="py-1"
|
||||
lg=12
|
||||
md=6
|
||||
sm=6
|
||||
>
|
||||
<NewsCard :news="x"/>
|
||||
|
||||
<v-row class="">
|
||||
<v-col class="flex-column d-flex pa-0">
|
||||
<v-row class="mt-0 mx-3 h-0 overflow-auto">
|
||||
<v-col v-for="(x, key) in newsAll" :key="key" class="py-1" lg="12" md="6" sm="6">
|
||||
<NewsCard :news="x" />
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfotoOne"
|
||||
width="w-100"
|
||||
height="900"
|
||||
class="flex-column "
|
||||
>
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-dialog v-model="dialogfotoOne" width="w-100" height="900" class="flex-column">
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-row class="flex-grow-0 justify-end">
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfotoOne = false"
|
||||
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img
|
||||
class="d-flex"
|
||||
:src="`${burl}${galleryimges}`"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfotoOne = false"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mt-3"/>
|
||||
<v-row class="flex-grow-0 ma-0 align-items-center">
|
||||
<v-col class="flex-column d-flex pa-0 align-end">
|
||||
<v-btn
|
||||
size="small"
|
||||
variant="text"
|
||||
icon="mdi-newspaper"
|
||||
color="teal-darken-4"
|
||||
:to='`/news`'
|
||||
/>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img class="d-flex" :src="`${burl}${galleryimges}`" />
|
||||
</v-col>
|
||||
<v-col class="py-0 pl-0 flex-grow-0 text-end align-self-center text-caption font-weight-bold text-no-wrap">
|
||||
Всего новостей: {{countetnews}}
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
<v-divider class="mt-3" />
|
||||
<v-row class="flex-grow-0 ma-0 align-items-center">
|
||||
<v-col class="flex-column d-flex pa-0 align-end">
|
||||
<v-btn
|
||||
size="small"
|
||||
variant="text"
|
||||
icon="mdi-newspaper"
|
||||
color="teal-darken-4"
|
||||
:to="`/news`"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
class="py-0 pl-0 flex-grow-0 text-end align-self-center text-caption font-weight-bold text-no-wrap"
|
||||
>
|
||||
Всего новостей: {{ countetnews }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import NewsCard from './UI/NewsCard.vue'
|
||||
import { ref } from 'vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
import { useRoute } from 'vue-router';
|
||||
import NewsCard from './UI/NewsCard.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
NewsCard,
|
||||
},
|
||||
|
||||
components: {
|
||||
NewsCard
|
||||
},
|
||||
setup() {
|
||||
const newsAll = ref([]);
|
||||
const countetnews = ref(0);
|
||||
const page = ref(1);
|
||||
const countpage = ref(8);
|
||||
const route = useRoute();
|
||||
const galleryimges = ref('');
|
||||
const dialogfotoOne = ref(false);
|
||||
|
||||
setup(){
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance
|
||||
.get(
|
||||
`api/navigation/newscrossroad/?name=${route.path}&page=${page.value - 1}&countpage=${countpage.value}`,
|
||||
)
|
||||
.then((result) => {
|
||||
newsAll.value = result.data.result;
|
||||
countetnews.value = result.data.countpage;
|
||||
});
|
||||
};
|
||||
|
||||
const newsAll=ref([])
|
||||
const countetnews = ref(0)
|
||||
const page = ref(1)
|
||||
const countpage = ref(8)
|
||||
const route = useRoute()
|
||||
const galleryimges=ref('')
|
||||
const dialogfotoOne = ref(false)
|
||||
loadNewsAll();
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
loadNewsAll()
|
||||
|
||||
const openOneImg = (idimg) => {
|
||||
dialogfotoOne.value = true
|
||||
galleryimges.value = idimg
|
||||
|
||||
|
||||
}
|
||||
const openOneImg = (idimg) => {
|
||||
dialogfotoOne.value = true;
|
||||
galleryimges.value = idimg;
|
||||
};
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
loadNewsAll,
|
||||
galleryimges,
|
||||
dialogfotoOne,
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newsAll,
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
loadNewsAll,
|
||||
galleryimges,
|
||||
dialogfotoOne,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
@@ -1,9 +1,26 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<v-app-bar v-if="accountStore.cod2user" density="compact" color="#263f40" class="pl-4" style="box-shadow: none">
|
||||
<v-icon class="px-3" size="20"
|
||||
:icon="rail ? 'mdi-chevron-right' : 'mdi-chevron-left'" @click="rail = !rail" />
|
||||
<v-card class="bg-transparent" density="compact" :prepend-avatar="imageSrc" title="Портал МИ ФНС России по ЦОД № 2" variant="text" :to="'/'" />
|
||||
<v-app-bar
|
||||
v-if="accountStore.cod2user"
|
||||
density="compact"
|
||||
color="#263f40"
|
||||
class="pl-4"
|
||||
style="box-shadow: none"
|
||||
>
|
||||
<v-icon
|
||||
class="px-3"
|
||||
size="20"
|
||||
:icon="rail ? 'mdi-chevron-right' : 'mdi-chevron-left'"
|
||||
@click="rail = !rail"
|
||||
/>
|
||||
<v-card
|
||||
class="bg-transparent"
|
||||
density="compact"
|
||||
:prepend-avatar="imageSrc"
|
||||
title="Портал МИ ФНС России по ЦОД № 2"
|
||||
variant="text"
|
||||
:to="'/'"
|
||||
/>
|
||||
<template v-slot:append>
|
||||
<div class="fns-actions">
|
||||
<vcard-user :author="accountStore.user" />
|
||||
@@ -62,18 +79,19 @@
|
||||
permanent
|
||||
v-model="drawer"
|
||||
class="text-white px-2"
|
||||
style="background-color: #335455 !important;"
|
||||
style="background-color: #335455 !important"
|
||||
>
|
||||
|
||||
<v-row class="my-0 h-100">
|
||||
<v-col class="flex-column d-flex pa-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-list nav density="compact" class="fns-nav-list">
|
||||
<template v-for="(x, key) in navigations" :key="key">
|
||||
|
||||
<v-list-item
|
||||
v-if="(x.path === '/portal' ? accountStore.user.is_superuser : true) && !('submenu' in x)"
|
||||
v-if="
|
||||
(x.path === '/portal' ? accountStore.user.is_superuser : true) &&
|
||||
!('submenu' in x)
|
||||
"
|
||||
:key="x.key"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
@@ -87,7 +105,9 @@
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="17" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{ x.name }}</v-tooltip>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{
|
||||
x.name
|
||||
}}</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
@@ -106,7 +126,9 @@
|
||||
class="fns-nav-item"
|
||||
rounded="lg"
|
||||
>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{ x.name }}</v-tooltip>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{
|
||||
x.name
|
||||
}}</v-tooltip>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-list-item
|
||||
@@ -121,7 +143,9 @@
|
||||
class="fns-nav-item fns-nav-item--child"
|
||||
rounded="lg"
|
||||
>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{ child.name }}</v-tooltip>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{
|
||||
child.name
|
||||
}}</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
</template>
|
||||
@@ -143,7 +167,9 @@
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.imagecode" size="17" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{ x.name }}</v-tooltip>
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">{{
|
||||
x.name
|
||||
}}</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -167,7 +193,7 @@
|
||||
</v-row>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-main v-if="accountStore.cod2user" class="d-flex" style="background-color: #f4f9f9;">
|
||||
<v-main v-if="accountStore.cod2user" class="d-flex" style="background-color: #f4f9f9">
|
||||
<router-view />
|
||||
<alert-default />
|
||||
</v-main>
|
||||
@@ -187,7 +213,6 @@
|
||||
>
|
||||
<Online-users />
|
||||
</v-navigation-drawer>
|
||||
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
@@ -206,9 +231,10 @@ import PageCounter from '@/components/UI/defaultportal/page-counter.vue';
|
||||
import AdminMenu from '@/layouts/default/AdminMenu.vue';
|
||||
import { useDisplay } from 'vuetify';
|
||||
import LoginPage from '../../views/LoginPage.vue';
|
||||
import alertDefault from './alertDefault.vue';
|
||||
|
||||
export default {
|
||||
components: { LoginPage, AuthForm, OnlineUsers, CardLike, VcardUser, PageCounter, AdminMenu },
|
||||
components: { LoginPage, AuthForm, OnlineUsers, CardLike, VcardUser, PageCounter, AdminMenu, alertDefault },
|
||||
mixins: [uf],
|
||||
|
||||
setup() {
|
||||
@@ -297,9 +323,25 @@ export default {
|
||||
};
|
||||
|
||||
return {
|
||||
theme, mainmenuStore, accountStore, drawer, drawer_right, toggleTheme,
|
||||
navigations, imageSrc, LikeDialog, scrimg, rail, showTooltip,
|
||||
menuTruncated, alert, burl, name, closeinfo, baseURL, message,
|
||||
theme,
|
||||
mainmenuStore,
|
||||
accountStore,
|
||||
drawer,
|
||||
drawer_right,
|
||||
toggleTheme,
|
||||
navigations,
|
||||
imageSrc,
|
||||
LikeDialog,
|
||||
scrimg,
|
||||
rail,
|
||||
showTooltip,
|
||||
menuTruncated,
|
||||
alert,
|
||||
burl,
|
||||
name,
|
||||
closeinfo,
|
||||
baseURL,
|
||||
message,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -332,7 +374,7 @@ export default {
|
||||
transition: background var(--fns-transition);
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.10);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +507,7 @@ export default {
|
||||
padding: 3px 8px 3px 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.90);
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
@@ -567,7 +609,6 @@ export default {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
|
||||
/* Герб */
|
||||
.fns-login-emblem {
|
||||
width: 72px;
|
||||
@@ -612,7 +653,7 @@ export default {
|
||||
|
||||
.fns-login-footer {
|
||||
font-size: 10.5px;
|
||||
color: rgba(255, 255, 255, 0.40);
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
text-align: center;
|
||||
letter-spacing: 0.02em;
|
||||
margin: 4px 0 0;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class="flex-grow-1 ma-0"
|
||||
style="min-height: 0; margin: 0;"
|
||||
>
|
||||
<v-col cols="12" md="8" lg="6" class="d-flex flex-column pa-1" style="min-height: 0;">
|
||||
<v-col cols="12" md="8" lg="6" class="d-flex flex-column" style="min-height: 0;">
|
||||
<div class="modern-card flex-grow-1 d-flex flex-column" style="overflow: hidden;">
|
||||
<news-home />
|
||||
</div>
|
||||
@@ -32,10 +32,10 @@
|
||||
|
||||
<v-col
|
||||
cols="12" md="4" lg="6"
|
||||
class="d-flex flex-column pa-0"
|
||||
class="d-flex flex-column"
|
||||
style="min-height: 0; margin: 0;"
|
||||
>
|
||||
<div class="flex-grow-1" style="overflow: hidden;">
|
||||
<div class="flex-grow-1 d-flex flex-column" style="overflow: hidden;">
|
||||
<HomeCalendarWidget />
|
||||
</div>
|
||||
</v-col>
|
||||
|
||||
Reference in new issue
Block a user