P-47 Рабочая версия, но небольшие проблемы с пропсами
редактирование календаря, передача участников в объект
This commit is contained in:
1 parent
8864216778
commit
b982e01c16
5 files changed
+100
-104
No files matched your search
@@ -40,6 +40,7 @@ class MyCalendars(APIView):
|
||||
|
||||
'''
|
||||
try:
|
||||
|
||||
ob=MyCalendarPostParameters(data=request.data)
|
||||
if ob.is_valid():
|
||||
ob = ob.data
|
||||
|
||||
@@ -105,11 +105,17 @@ export default {
|
||||
setup(props, { emit }) {
|
||||
const filtered = ref("");
|
||||
const staff = ref([]);
|
||||
|
||||
const calendarParticipant = computed({
|
||||
get: () => props.participant,
|
||||
set: (value) => emit("update:participant", value),
|
||||
});
|
||||
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
if (props.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
@@ -125,18 +131,38 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
const selectedStaff = computed(() => {
|
||||
|
||||
let selected = [];
|
||||
// let idEmployees = props.participant
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
|
||||
e.employees
|
||||
.filter((n) => n.selected == true)
|
||||
.map((res) => {
|
||||
calendarParticipant.value.push({ participant_calendar: res.id });
|
||||
});
|
||||
if (e.employees.every((n) => n.selected == true)) {
|
||||
e.selected = true;
|
||||
selected.push(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
e.selected = false;
|
||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// calendarParticipant.value = idEmployees
|
||||
|
||||
return selected;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_create_calendar" min-width="636" max-width="800">
|
||||
<v-card min-height="436" class="pa-3">
|
||||
{{calendar}}
|
||||
{{ calendar }}
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
Новый календарь
|
||||
|
||||
|
||||
<v-icon
|
||||
icon="mdi-close cursor-pointer"
|
||||
size="small"
|
||||
@@ -45,8 +45,7 @@
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/>
|
||||
</v-col
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
@@ -54,7 +53,11 @@
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select :participant = calendar.participant />
|
||||
<calendar-create-select
|
||||
:participant="calendar.participant"
|
||||
@update:participant="props.calendar.participant = $event"
|
||||
/>
|
||||
<!-- upParticant-->
|
||||
</v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
@@ -78,15 +81,17 @@
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="dialog_create_calendar = false"
|
||||
|
||||
>Отменить</v-btn
|
||||
>
|
||||
<!-- @click="dialog_create_calendar = false" -->
|
||||
<v-btn
|
||||
class="text-subtitle-1 font-weight-regular"
|
||||
color="btn_text"
|
||||
variant="flat"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="postCalendar"
|
||||
>Создать</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
@@ -120,6 +125,7 @@
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
|
||||
export default {
|
||||
components: { calendarCreateSelect },
|
||||
@@ -132,59 +138,35 @@ export default {
|
||||
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: {cl_name:'', participant: []},
|
||||
default: { cl_name: "", participant: [] },
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
console.log('-1111111111111')
|
||||
|
||||
|
||||
const dialog_create_calendar = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
// const calendar = ref([
|
||||
// {
|
||||
// cl_color: "#F44336",
|
||||
// cl_descr: "Малюсенький календарь",
|
||||
// cl_name: "Мой первый календарь",
|
||||
// editor: true,
|
||||
// participant: [
|
||||
// { editor: 0, user: 107 },
|
||||
// { editor: 1, user: 125 },
|
||||
// ],
|
||||
// events: {
|
||||
// date_end: "2024-06-29T12:20:28+03:00",
|
||||
// date_start: "2024-05-29T12:20:24+03:00",
|
||||
// description: "Описание такое описание",
|
||||
// event: 1,
|
||||
// id: 1,
|
||||
// name: "Первое событие в календаре",
|
||||
// period: null,
|
||||
// },
|
||||
// id: 1,
|
||||
// },
|
||||
// ]);
|
||||
|
||||
// const getMyCalendar = () => {
|
||||
// axiosApiInstance
|
||||
// .get(`api/calendar_of_events/get_calendars/`)
|
||||
// .then((data) => {
|
||||
// console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
// });
|
||||
// };
|
||||
|
||||
// getMyCalendar();
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
// get_calendars
|
||||
// const confirmation = () => {
|
||||
// axiosApiInstance
|
||||
// .get(`api/calendar_of_events/employee/`)
|
||||
// .then((data) => {
|
||||
// console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
// });
|
||||
// };
|
||||
|
||||
|
||||
// confirmation()
|
||||
const postCalendar = () => {
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/my_calendars/`, props.calendar)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "green-darken-4";
|
||||
});
|
||||
};
|
||||
|
||||
const color = [
|
||||
"red",
|
||||
@@ -212,16 +194,18 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const upParticant = () => {
|
||||
console.log('hi')
|
||||
props.calendar.participant = $event
|
||||
}
|
||||
|
||||
return {
|
||||
dialog_create_calendar,
|
||||
|
||||
|
||||
postCalendar,
|
||||
color,
|
||||
colorPik,
|
||||
|
||||
upParticant
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
@update:opendialog="showDialog = $event"
|
||||
:opendialog="showDialog"
|
||||
:calendar="calendar"
|
||||
|
||||
/>
|
||||
</v-expansion-panels>
|
||||
</template>
|
||||
|
||||
@@ -1,63 +1,47 @@
|
||||
<template>
|
||||
<v-snackbar
|
||||
:timeout="2000"
|
||||
v-model="feedalert.alert"
|
||||
:color=feedalert.color
|
||||
:icon=feedalert.ico
|
||||
>
|
||||
|
||||
<v-snackbar
|
||||
:timeout="3000"
|
||||
v-model="feedalert.alert"
|
||||
:color="feedalert.color"
|
||||
:icon="feedalert.ico"
|
||||
variant="outlined"
|
||||
>
|
||||
<v-icon :icon="feedalert.ico" />
|
||||
<span class="pl-2 text-body-2">
|
||||
{{ feedalert.text }}
|
||||
</span>
|
||||
|
||||
{{feedalert.text}}
|
||||
</v-snackbar>
|
||||
<!-- <v-alert
|
||||
:color=feedalert.color
|
||||
:icon=feedalert.ico
|
||||
theme="dark"
|
||||
min-height="40"
|
||||
|
||||
position="fixed"
|
||||
location = "bottom"
|
||||
class="mb-2"
|
||||
v-model="feedalert.alert"
|
||||
:text=feedalert.text
|
||||
|
||||
density="compact"
|
||||
>
|
||||
</v-alert> -->
|
||||
</v-snackbar>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { watch} from 'vue'
|
||||
import { useAlertStore } from '@/store/useAlertStore'
|
||||
import { watch } from "vue";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
|
||||
export default {
|
||||
name: "AlertDefault",
|
||||
setup() {
|
||||
name: "AlertDefault",
|
||||
setup() {
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const feedalert = useAlertStore().alert
|
||||
watch(
|
||||
() => feedalert,
|
||||
() => {
|
||||
setTimeout(function () {
|
||||
feedalert.text = "";
|
||||
feedalert.ico = "";
|
||||
feedalert.color = "";
|
||||
feedalert.alert = false;
|
||||
}, 8000);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(()=>feedalert ,()=>{
|
||||
|
||||
setTimeout(function() {
|
||||
feedalert.text=""
|
||||
feedalert.ico=""
|
||||
feedalert.color=""
|
||||
feedalert.alert = false
|
||||
}, 8000)
|
||||
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
|
||||
return {
|
||||
feedalert
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return {
|
||||
feedalert,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
Reference in new issue
Block a user