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