P-47 Доделать датепикер
This commit is contained in:
1 parent
f001cc75fe
commit
794e4a9b25
5 files changed
+242
-58
No files matched your search
@@ -119,7 +119,8 @@ export default {
|
||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||
const calendarForMy = ref([]);
|
||||
const eventFromCalendar = ref({})
|
||||
const idEvent = ref(null)
|
||||
// const idEvent = ref(null)
|
||||
const idEvent = ref(2)
|
||||
|
||||
const getMonth = (month) => {
|
||||
MyMonth.value = month + 1;
|
||||
@@ -151,7 +152,7 @@ export default {
|
||||
.then((res) => {
|
||||
eventFromCalendar.value = res.data
|
||||
if (idEvent.value==null) {
|
||||
eventFromCalendar.value.event = {name:'', participant: [], files: [], date_start: "", date_end: "", period: null, description: '', calendar: null}
|
||||
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: "", date_end: "", period: null, description: '', calendar: null}
|
||||
}
|
||||
|
||||
// res.data.forEach(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-chip>
|
||||
<span> {{ item.title }}</span>
|
||||
{{ item }}
|
||||
|
||||
<v-icon
|
||||
v-if="item.value != accountStore.user.is_idEmployee"
|
||||
icon="mdi-close-circle"
|
||||
@@ -186,19 +186,10 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
// const account = (val) => {
|
||||
// if (props.okey == "selected") {
|
||||
// if (val.id != accountStore.user.is_idEmployee) {
|
||||
// val.selected = !val.selected;
|
||||
// } else {
|
||||
// val.editor = !val.editor;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
const cbstaff = (item, value) => {
|
||||
item.forEach((e) => {
|
||||
// account(e);
|
||||
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
e[props.okey] = value;
|
||||
}
|
||||
@@ -210,9 +201,10 @@ export default {
|
||||
cbstaff(e.employees, value);
|
||||
}
|
||||
});
|
||||
console.log(item, "item");
|
||||
|
||||
};
|
||||
|
||||
|
||||
function onFilter(item, itemText) {
|
||||
return (
|
||||
item.includes(filtered.value) ||
|
||||
|
||||
@@ -185,6 +185,7 @@ export default {
|
||||
const staff = ref([]);
|
||||
|
||||
axiosApiInstance
|
||||
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
@@ -266,7 +267,7 @@ export default {
|
||||
rules,
|
||||
titleCard,
|
||||
newCalendar,
|
||||
newStaff
|
||||
newStaff,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<my-helper :pretext="propsEvent" />
|
||||
<my-helper :pretext="propsEvent.event" />
|
||||
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
@@ -23,6 +23,18 @@
|
||||
v-model="propsEvent.event.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"
|
||||
/> </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>
|
||||
@@ -48,7 +60,7 @@
|
||||
{{ item.title }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item="{ props, item }">
|
||||
<template v-slot:item="{ item }">
|
||||
<v-list-item
|
||||
:key="item.title"
|
||||
:value="item"
|
||||
@@ -63,65 +75,138 @@
|
||||
/>
|
||||
</template>
|
||||
{{ item.title }}
|
||||
<!-- {{ item}} -->
|
||||
</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">
|
||||
<v-col lg="2">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="timeEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col lg="3">
|
||||
<v-menu
|
||||
v-model="menudate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-textarea
|
||||
v-model="dateEvent"
|
||||
:value="dateEvent"
|
||||
no-resize
|
||||
class="my-textarea"
|
||||
rows="1"
|
||||
hide-details
|
||||
style="width: 119px"
|
||||
variant="plain"
|
||||
density="compact"
|
||||
v-bind="props"
|
||||
>
|
||||
|
||||
<template v-slot:prepend-inner>
|
||||
|
||||
</template>
|
||||
</v-textarea>
|
||||
</template>
|
||||
<v-locale-provider locale="ru">
|
||||
<v-date-picker
|
||||
v-model="dateEvent"
|
||||
show-adjacent-months
|
||||
hide-header
|
||||
border
|
||||
no-time
|
||||
|
||||
/>
|
||||
</v-locale-provider>
|
||||
</v-menu>
|
||||
<!-- <v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea> -->
|
||||
</v-col>
|
||||
|
||||
<!-- <v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:participant="propsCalendar.participant"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/> </v-col
|
||||
></v-row> -->
|
||||
<v-icon icon="mdi-minus" color="text_grey" class="pt-4" />
|
||||
|
||||
<v-col lg="3">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col lg="2">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Добавить название"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsEvent.event.name"
|
||||
></v-textarea
|
||||
></v-col>
|
||||
</v-row> </v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<!-- <v-col class="d-flex flex-grow-0">
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
label="Дополнительное описание"
|
||||
row-height="25"
|
||||
rows="4"
|
||||
rows="3"
|
||||
variant="outlined"
|
||||
shaped
|
||||
no-resize
|
||||
:rules="rules.cl_descr"
|
||||
v-model="propsCalendar.cl_descr"
|
||||
></v-textarea>
|
||||
</v-col> -->
|
||||
<!-- <v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Редакторы </v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:editor="true"
|
||||
:participant="
|
||||
propsCalendar.participant.filter((e) => e.editor == 1)
|
||||
"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
</v-row> -->
|
||||
v-model="propsEvent.event.description"
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
</v-row>
|
||||
<!-- {{propsEvent}} -->
|
||||
</template>
|
||||
</dialog-create>
|
||||
<!-- @delObject="delCalendar(propsCalendar.id)"
|
||||
@postData="postCalendar" -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "./UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
components: { DialogCreate },
|
||||
components: { calendarCreateSelect, DialogCreate },
|
||||
|
||||
props: {
|
||||
eventCalendar: {
|
||||
@@ -136,6 +221,42 @@ export default {
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
});
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
axiosApiInstance
|
||||
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
});
|
||||
|
||||
const newStaff = computed({
|
||||
get() {
|
||||
staff.value.forEach((e) => {
|
||||
if (propsEvent.value.event.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
let ab = propsEvent.value.event.participant.find(
|
||||
(a) => a === empl.id
|
||||
);
|
||||
if (ab) {
|
||||
empl.selected = true;
|
||||
} else {
|
||||
empl.selected = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return staff.value;
|
||||
},
|
||||
});
|
||||
|
||||
// const getTime = computed({
|
||||
// get() {
|
||||
|
||||
// }
|
||||
// })
|
||||
|
||||
const calendar = computed({
|
||||
get() {
|
||||
let selected = [];
|
||||
@@ -160,14 +281,83 @@ export default {
|
||||
const titleCard = ref("");
|
||||
const newEvent = ref(false);
|
||||
|
||||
const nameCalendar = ref([]);
|
||||
const calendarNewOrOld = () => {
|
||||
if (propsEvent.value.event.hasOwnProperty("id")) {
|
||||
titleCard.value = "Редактирование события";
|
||||
} else {
|
||||
titleCard.value = "Новое событие";
|
||||
newEvent.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
calendarNewOrOld();
|
||||
|
||||
const returnIdParticant = (idPart) => {
|
||||
idPart.staff.forEach(
|
||||
(e) => {
|
||||
if (e.selected == true) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
} else {
|
||||
let ind = propsEvent.value.event.participant.findIndex(
|
||||
(l) => l == e.id
|
||||
);
|
||||
propsEvent.value.event.participant.splice(ind, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// propsEvent.value.event.participant.push(e.id)
|
||||
);
|
||||
console.log(idPart, "idPart");
|
||||
};
|
||||
|
||||
const timeEvent = computed({
|
||||
get() {
|
||||
return `${new Date(
|
||||
propsEvent.value.event.date_start
|
||||
).getHours()}:${String(
|
||||
new Date(propsEvent.value.event.date_start).getMinutes()
|
||||
).padStart(2, "0")}`;
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
let timeParts = newValue.split(":");
|
||||
let h = new Date(propsEvent.value.event.date_start).setHours(
|
||||
parseInt(timeParts[0], 10),
|
||||
parseInt(timeParts[1], 10)
|
||||
);
|
||||
propsEvent.value.event.date_start = new Date(h);
|
||||
},
|
||||
});
|
||||
|
||||
const dateEvent = computed({
|
||||
get() {
|
||||
|
||||
return formatComa(new Date(propsEvent.value.event.date_start))
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
let dateParts = newValue.split(".");
|
||||
|
||||
// let d = new Date(propsEvent.value.event.date_start).setFullYear(parseInt(dateParts[2], 10), parseInt(dateParts[1], 10), parseInt(dateParts[0], 10))
|
||||
// let d = new Date(propsEvent.value.event.date_start).setDate(new Date(2024,01,01))
|
||||
// propsEvent.value.event.date_start = new Date(2024,01,01);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const menudate = ref(false);
|
||||
|
||||
return {
|
||||
menudate,
|
||||
titleCard,
|
||||
newEvent,
|
||||
propsEvent,
|
||||
nameCalendar,
|
||||
dateEvent,
|
||||
calendar,
|
||||
staff,
|
||||
newStaff,
|
||||
returnIdParticant,
|
||||
timeEvent,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
v-model="dataToEdit.bigname"
|
||||
rows="1"
|
||||
placeholder="Название календаря"
|
||||
/> -->
|
||||
/> -->
|
||||
|
||||
<v-text-field v-model="dataToEdit.name" placeholder="Заголовок" />
|
||||
</v-card-title>
|
||||
|
||||
Reference in new issue
Block a user