P-47 Доделать датепикер
This commit is contained in:
1 parent
f001cc75fe
commit
794e4a9b25
4 files changed
+241
-57
No files matched your search
@@ -119,7 +119,8 @@ export default {
|
|||||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||||
const calendarForMy = ref([]);
|
const calendarForMy = ref([]);
|
||||||
const eventFromCalendar = ref({})
|
const eventFromCalendar = ref({})
|
||||||
const idEvent = ref(null)
|
// const idEvent = ref(null)
|
||||||
|
const idEvent = ref(2)
|
||||||
|
|
||||||
const getMonth = (month) => {
|
const getMonth = (month) => {
|
||||||
MyMonth.value = month + 1;
|
MyMonth.value = month + 1;
|
||||||
@@ -151,7 +152,7 @@ export default {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
eventFromCalendar.value = res.data
|
eventFromCalendar.value = res.data
|
||||||
if (idEvent.value==null) {
|
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(
|
// res.data.forEach(
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<template v-slot:selection="{ item }">
|
<template v-slot:selection="{ item }">
|
||||||
<v-chip>
|
<v-chip>
|
||||||
<span> {{ item.title }}</span>
|
<span> {{ item.title }}</span>
|
||||||
{{ item }}
|
|
||||||
<v-icon
|
<v-icon
|
||||||
v-if="item.value != accountStore.user.is_idEmployee"
|
v-if="item.value != accountStore.user.is_idEmployee"
|
||||||
icon="mdi-close-circle"
|
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) => {
|
const cbstaff = (item, value) => {
|
||||||
item.forEach((e) => {
|
item.forEach((e) => {
|
||||||
// account(e);
|
|
||||||
if (e.id != accountStore.user.is_idEmployee) {
|
if (e.id != accountStore.user.is_idEmployee) {
|
||||||
e[props.okey] = value;
|
e[props.okey] = value;
|
||||||
}
|
}
|
||||||
@@ -210,9 +201,10 @@ export default {
|
|||||||
cbstaff(e.employees, value);
|
cbstaff(e.employees, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(item, "item");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function onFilter(item, itemText) {
|
function onFilter(item, itemText) {
|
||||||
return (
|
return (
|
||||||
item.includes(filtered.value) ||
|
item.includes(filtered.value) ||
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ export default {
|
|||||||
const staff = ref([]);
|
const staff = ref([]);
|
||||||
|
|
||||||
axiosApiInstance
|
axiosApiInstance
|
||||||
|
|
||||||
.get("api/calendar_of_events/get_employees/")
|
.get("api/calendar_of_events/get_employees/")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||||
@@ -266,7 +267,7 @@ export default {
|
|||||||
rules,
|
rules,
|
||||||
titleCard,
|
titleCard,
|
||||||
newCalendar,
|
newCalendar,
|
||||||
newStaff
|
newStaff,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<v-row no-gutters class="flex-column">
|
<v-row no-gutters class="flex-column">
|
||||||
<v-col class="d-flex flex-column">
|
<v-col class="d-flex flex-column">
|
||||||
<v-row no-gutters class="align-center">
|
<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">
|
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||||
Название
|
Название
|
||||||
@@ -23,6 +23,18 @@
|
|||||||
v-model="propsEvent.event.name"
|
v-model="propsEvent.event.name"
|
||||||
></v-textarea> </v-col
|
></v-textarea> </v-col
|
||||||
></v-row>
|
></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-row no-gutters class="align-center pb-3">
|
||||||
<v-col class="text-body-2 text-text_grey" lg="2"> Календарь</v-col>
|
<v-col class="text-body-2 text-text_grey" lg="2"> Календарь</v-col>
|
||||||
<v-col>
|
<v-col>
|
||||||
@@ -48,7 +60,7 @@
|
|||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item="{ props, item }">
|
<template v-slot:item="{ item }">
|
||||||
<v-list-item
|
<v-list-item
|
||||||
:key="item.title"
|
:key="item.title"
|
||||||
:value="item"
|
:value="item"
|
||||||
@@ -63,65 +75,138 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
<!-- {{ item}} -->
|
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</template>
|
</template>
|
||||||
</v-autocomplete>
|
</v-autocomplete>
|
||||||
</v-col></v-row
|
</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"
|
||||||
|
>
|
||||||
|
|
||||||
<!-- <v-row no-gutters class="align-center pb-3">
|
<template v-slot:prepend-inner>
|
||||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
|
||||||
Участники
|
</template>
|
||||||
</v-col>
|
</v-textarea>
|
||||||
<v-col>
|
</template>
|
||||||
<calendar-create-select
|
<v-locale-provider locale="ru">
|
||||||
:participant="propsCalendar.participant"
|
<v-date-picker
|
||||||
@returnIdParticant="returnIdParticant"
|
v-model="dateEvent"
|
||||||
/> </v-col
|
show-adjacent-months
|
||||||
></v-row> -->
|
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-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>
|
||||||
<!-- <v-col class="d-flex flex-grow-0">
|
|
||||||
|
<v-row no-gutters class="align-center">
|
||||||
|
<v-col>
|
||||||
<v-textarea
|
<v-textarea
|
||||||
density="compact"
|
density="compact"
|
||||||
label="Описание"
|
label="Дополнительное описание"
|
||||||
row-height="25"
|
row-height="25"
|
||||||
rows="4"
|
rows="3"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
shaped
|
v-model="propsEvent.event.description"
|
||||||
no-resize
|
></v-textarea> </v-col
|
||||||
:rules="rules.cl_descr"
|
></v-row>
|
||||||
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-row>
|
</v-row>
|
||||||
<!-- {{propsEvent}} -->
|
|
||||||
</template>
|
</template>
|
||||||
</dialog-create>
|
</dialog-create>
|
||||||
<!-- @delObject="delCalendar(propsCalendar.id)"
|
|
||||||
@postData="postCalendar" -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { axiosApiInstance } from "@/utils/axios-api";
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
import DialogCreate from "./UI_calendar/dialogCreate.vue";
|
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 {
|
export default {
|
||||||
components: { DialogCreate },
|
components: { calendarCreateSelect, DialogCreate },
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
eventCalendar: {
|
eventCalendar: {
|
||||||
@@ -136,6 +221,42 @@ export default {
|
|||||||
set: (value) => emit("update:eventCalendar", value),
|
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({
|
const calendar = computed({
|
||||||
get() {
|
get() {
|
||||||
let selected = [];
|
let selected = [];
|
||||||
@@ -160,14 +281,83 @@ export default {
|
|||||||
const titleCard = ref("");
|
const titleCard = ref("");
|
||||||
const newEvent = ref(false);
|
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 {
|
return {
|
||||||
|
menudate,
|
||||||
titleCard,
|
titleCard,
|
||||||
newEvent,
|
newEvent,
|
||||||
propsEvent,
|
propsEvent,
|
||||||
nameCalendar,
|
dateEvent,
|
||||||
calendar,
|
calendar,
|
||||||
|
staff,
|
||||||
|
newStaff,
|
||||||
|
returnIdParticant,
|
||||||
|
timeEvent,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user