P-51 Логику для разных вариантов периода

This commit is contained in:
iriska-gri committed 2024-07-17 15:16:29 +03:00
1 parent 33dbb9c772
commit 9235ab9983
6 files changed
+71 -79

No files matched your search

@@ -82,7 +82,7 @@ export default {
}
emit("postFiles", newFile);
console.log(newValue, arrFiles.value, "newValue");
},
});
@@ -102,10 +102,7 @@ export default {
return new File([u8arr], filename, { type: mime });
}
const proverka = () => {
console.log('h');
}
// const eventFiles = computed({
// get() {
// if (propsFiles.value.length > 0) {
@@ -145,7 +142,7 @@ export default {
return {
eventFiles,
arrFiles,
proverka
};
},
};
+40 -36
View File
@@ -1,61 +1,65 @@
<template>
<div class="pa-0 align-self-center">
<div class="pa-0 align-self-center">
<v-menu
v-model="menu"
:close-on-content-click="false"
:max-width="800"
offset-x
>
>
<template v-slot:activator="{ on, attrs }">
<v-icon
v-bind="attrs"
<v-icon
v-bind="attrs"
v-on="on"
size="large"
color="indigo"
icon="mdi-owl"
@click="menu=!menu"
></v-icon>
size="large"
color="indigo"
icon="mdi-owl"
@click="menu = !menu"
></v-icon>
</template>
<v-card
class="whmy overflow-auto overflow-x-hidden">
<v-row class="ma-3">
<v-col >
<pre>
{{pretext}}
</pre>
</v-col>
</v-row>
<v-card class="whmy overflow-auto overflow-x-hidden">
<v-row class="ma-3">
<v-col>
<pre
>{{ pretext }}
</pre
>
</v-col>
</v-row>
</v-card>
</v-menu>
</div>
</template>
<script>
import { ref } from "vue";
export default {
name: "myHelper",
props: {
pretext: {
}
name: "myHelper",
props: {
pretext: {
type: Object,
default: () => {},
},
},
data: () => ({
fav: true,
menu: false,
message: false,
hints: true,
}),
}
setup() {
const menu = ref(false);
return { menu };
},
// data: () => ({
// menu: false,
// }),
};
</script>
<style>
.whmy {
height: 950px!important;
height: 950px !important;
}
</style>
</style>
@@ -98,6 +98,7 @@
<event-create
@closeDialog="showDialog = false"
:eventCalendar="eventFromCalendar"
@update:eventCalendar="eventFromCalendar =$event"
@getCalendar="getCalendar"
/>
</v-dialog>
@@ -167,17 +168,18 @@ export default {
getCalendar();
const getEvents = (idEvent) => {
console.log(idEvent, 'idEvent-------------------')
console.log(idEvent, 'idEvent2 раза');
axiosApiInstance
.get(
`api/calendar_of_events/my_events/${
idEvent == null ? "" : `?id=${idEvent}`
idEvent == undefined ? "" : `?id=${idEvent}`
}`
)
.then((res) => {
eventFromCalendar.value = res.data;
if (idEvent == null) {
if (idEvent == undefined) {
eventFromCalendar.value.event = {
name: "",
participant: [accountStore.user.is_idEmployee],
@@ -195,9 +197,12 @@ export default {
getEvents();
const createEvent = (idEv) => {
console.log(idEv, '222222222222')
showDialog.value = true;
getEvents(idEv);
if (idEv) {
getCalendar()
}
};
const weekendsData = () => {
@@ -274,18 +274,7 @@ export default {
emit("getEvent", e.id);
};
// const controlDate = computed({
// get() {
// // let yearOfDate = new Date(dayNow.value).getFullYear();
// // let monthOfDate = new Date(dayNow.value).getMonth();
// return dayNow.value
// },
// set(newValue) {
// }
// })
return {
type,
@@ -1,7 +1,7 @@
<template>
<v-card min-height="436" class="pa-3">
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
{{ title }}
{{ title }} {{newOrOld}}
<v-icon
icon="mdi-close cursor-pointer"
size="small"
@@ -93,8 +93,8 @@
<time-select
:chek="allDay"
:order="[2, 1]"
:dateEvent="propsEvent.event.date_start"
:limitation="propsEvent.event.date_end"
:dateEvent="String(propsEvent.event.date_start)"
:limitation="String(propsEvent.event.date_end)"
@update:dateEvent="propsEvent.event.date_start = $event"
/>
<v-col class="order-3 flex-grow-0">
@@ -103,8 +103,8 @@
<time-select
:chek="allDay"
:order="[4, 5]"
:dateEvent="propsEvent.event.date_end"
:limitation="propsEvent.event.date_start"
:dateEvent="String(propsEvent.event.date_end)"
:limitation="String(propsEvent.event.date_start)"
@update:dateEvent="propsEvent.event.date_end = $event"
/>
</v-row>
@@ -207,6 +207,11 @@ export default {
},
setup(props, { emit }) {
const propsEvent = computed({
get: () => props.eventCalendar,
set: (value) => emit("update:eventCalendar", value),
});
const repeatRules = [
{ type: "Не повторять", rule: {} },
{ type: "Каждый день", rule: { freq: 3 } },
@@ -215,10 +220,8 @@ export default {
{ type: "Каждый год", rule: { freq: 0 } },
];
const returnPeriod = computed({
get() {
console.log(propsEvent.value, 'propsEvent.value');
let select = [];
let objRule = JSON.parse(propsEvent.value.event.period);
@@ -236,10 +239,12 @@ export default {
: 0
]
);
calendarNewOrOld();
return select;
},
set(newValue) {
console.log('Обновление пропса на период')
let newRulse = new RRule({
...newValue.rule,
dtstart: new Date(propsEvent.value.event.date_start),
@@ -248,25 +253,17 @@ export default {
Object.keys(newValue.rule).length == 0
? null
: (propsEvent.value.event.period = JSON.stringify(
newRulse
));
// : (propsEvent.value.event.period = JSON.stringify(
// newRulse.origOptions
// ));
: (propsEvent.value.event.period = JSON.stringify(newRulse));
},
});
const allDay = ref(false);
const propsEvent = computed({
get: () => props.eventCalendar,
set: (value) => emit("update:eventCalendar", value),
});
const feedalert = useAlertStore().alert;
const req = (val) => {
return !!val || "Поле обязательно";
if (newEvent.value == true) {
return !!val || "Поле обязательно";
}
};
const rules = {
@@ -381,14 +378,13 @@ export default {
const calendarNewOrOld = () => {
if (propsEvent.value.event.hasOwnProperty("id")) {
titleCard.value = "Редактирование события";
newEvent.value = false;
} else {
titleCard.value = "Новое событие";
newEvent.value = true;
}
};
calendarNewOrOld();
const part = new Set();
const returnIdParticant = (idPart) => {
@@ -440,6 +436,7 @@ export default {
const menudate = ref(false);
const postData = (validate) => {
console.log(validate, "validate");
if (validate) {
let postEvent = new FormData();
postEvent.append(