P-47 Рабочая версия, но небольшие проблемы с пропсами
редактирование календаря, передача участников в объект
This commit is contained in:
1 parent
8864216778
commit
b982e01c16
5 files changed
+90
-94
No files matched your search
@@ -40,6 +40,7 @@ class MyCalendars(APIView):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
|
|
||||||
ob=MyCalendarPostParameters(data=request.data)
|
ob=MyCalendarPostParameters(data=request.data)
|
||||||
if ob.is_valid():
|
if ob.is_valid():
|
||||||
ob = ob.data
|
ob = ob.data
|
||||||
|
|||||||
@@ -105,6 +105,12 @@ export default {
|
|||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const filtered = ref("");
|
const filtered = ref("");
|
||||||
const staff = ref([]);
|
const staff = ref([]);
|
||||||
|
|
||||||
|
const calendarParticipant = computed({
|
||||||
|
get: () => props.participant,
|
||||||
|
set: (value) => emit("update:participant", value),
|
||||||
|
});
|
||||||
|
|
||||||
axiosApiInstance
|
axiosApiInstance
|
||||||
.get("api/calendar_of_events/get_employees/")
|
.get("api/calendar_of_events/get_employees/")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -125,18 +131,38 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const selectedStaff = computed(() => {
|
const selectedStaff = computed(() => {
|
||||||
|
|
||||||
let selected = [];
|
let selected = [];
|
||||||
|
// let idEmployees = props.participant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
staff.value.forEach((e) => {
|
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)) {
|
if (e.employees.every((n) => n.selected == true)) {
|
||||||
e.selected = true;
|
e.selected = true;
|
||||||
selected.push(e);
|
selected.push(e);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
e.selected = false;
|
e.selected = false;
|
||||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// calendarParticipant.value = idEmployees
|
||||||
|
|
||||||
return selected;
|
return selected;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-dialog v-model="dialog_create_calendar" min-width="636" max-width="800">
|
<v-dialog v-model="dialog_create_calendar" min-width="636" max-width="800">
|
||||||
<v-card min-height="436" class="pa-3">
|
<v-card min-height="436" class="pa-3">
|
||||||
{{calendar}}
|
{{ calendar }}
|
||||||
<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">
|
||||||
Новый календарь
|
Новый календарь
|
||||||
|
|
||||||
@@ -45,8 +45,7 @@
|
|||||||
? 'flat'
|
? 'flat'
|
||||||
: 'tonal'
|
: 'tonal'
|
||||||
"
|
"
|
||||||
/>
|
/> </v-col
|
||||||
</v-col
|
|
||||||
></v-row>
|
></v-row>
|
||||||
|
|
||||||
<v-row no-gutters class="align-center">
|
<v-row no-gutters class="align-center">
|
||||||
@@ -54,7 +53,11 @@
|
|||||||
Участники
|
Участники
|
||||||
</v-col>
|
</v-col>
|
||||||
<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-col
|
||||||
></v-row>
|
></v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -78,15 +81,17 @@
|
|||||||
class="text-subtitle-1"
|
class="text-subtitle-1"
|
||||||
elevation="0"
|
elevation="0"
|
||||||
width="150"
|
width="150"
|
||||||
@click="dialog_create_calendar = false"
|
|
||||||
>Отменить</v-btn
|
>Отменить</v-btn
|
||||||
>
|
>
|
||||||
|
<!-- @click="dialog_create_calendar = false" -->
|
||||||
<v-btn
|
<v-btn
|
||||||
class="text-subtitle-1 font-weight-regular"
|
class="text-subtitle-1 font-weight-regular"
|
||||||
color="btn_text"
|
color="btn_text"
|
||||||
variant="flat"
|
variant="flat"
|
||||||
elevation="0"
|
elevation="0"
|
||||||
width="150"
|
width="150"
|
||||||
|
@click="postCalendar"
|
||||||
>Создать</v-btn
|
>Создать</v-btn
|
||||||
>
|
>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
@@ -120,6 +125,7 @@
|
|||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { axiosApiInstance } from "@/utils/axios-api";
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||||
|
import { useAlertStore } from "@/store/useAlertStore";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { calendarCreateSelect },
|
components: { calendarCreateSelect },
|
||||||
@@ -132,59 +138,35 @@ export default {
|
|||||||
|
|
||||||
calendar: {
|
calendar: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {cl_name:'', participant: []},
|
default: { cl_name: "", participant: [] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
|
console.log('-1111111111111')
|
||||||
|
|
||||||
|
|
||||||
const dialog_create_calendar = computed({
|
const dialog_create_calendar = computed({
|
||||||
get: () => props.opendialog,
|
get: () => props.opendialog,
|
||||||
set: (value) => emit("update:opendialog", value),
|
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 = [
|
const color = [
|
||||||
"red",
|
"red",
|
||||||
@@ -212,16 +194,18 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const upParticant = () => {
|
||||||
|
console.log('hi')
|
||||||
|
props.calendar.participant = $event
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dialog_create_calendar,
|
dialog_create_calendar,
|
||||||
|
|
||||||
|
postCalendar,
|
||||||
color,
|
color,
|
||||||
colorPik,
|
colorPik,
|
||||||
|
upParticant
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
@update:opendialog="showDialog = $event"
|
@update:opendialog="showDialog = $event"
|
||||||
:opendialog="showDialog"
|
:opendialog="showDialog"
|
||||||
:calendar="calendar"
|
:calendar="calendar"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,63 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-snackbar
|
<v-snackbar
|
||||||
:timeout="2000"
|
:timeout="3000"
|
||||||
v-model="feedalert.alert"
|
v-model="feedalert.alert"
|
||||||
:color=feedalert.color
|
:color="feedalert.color"
|
||||||
:icon=feedalert.ico
|
: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-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> -->
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { watch} from 'vue'
|
import { watch } from "vue";
|
||||||
import { useAlertStore } from '@/store/useAlertStore'
|
import { useAlertStore } from "@/store/useAlertStore";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AlertDefault",
|
name: "AlertDefault",
|
||||||
setup() {
|
setup() {
|
||||||
|
const feedalert = useAlertStore().alert;
|
||||||
|
|
||||||
const feedalert = useAlertStore().alert
|
watch(
|
||||||
|
() => feedalert,
|
||||||
watch(()=>feedalert ,()=>{
|
() => {
|
||||||
|
setTimeout(function () {
|
||||||
setTimeout(function() {
|
feedalert.text = "";
|
||||||
feedalert.text=""
|
feedalert.ico = "";
|
||||||
feedalert.ico=""
|
feedalert.color = "";
|
||||||
feedalert.color=""
|
feedalert.alert = false;
|
||||||
feedalert.alert = false
|
}, 8000);
|
||||||
}, 8000)
|
},
|
||||||
|
{ deep: true }
|
||||||
}, {deep:true})
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
feedalert
|
feedalert,
|
||||||
}
|
};
|
||||||
|
},
|
||||||
}
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
Reference in new issue
Block a user