This commit is contained in:
iriska-gri committed 2024-07-09 13:48:37 +03:00
1 parent ce57f376d6
commit 6d359eeeb0
4 files changed
+86 -49

No files matched your search

@@ -119,8 +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 idEvent = ref(2)
const getMonth = (month) => { const getMonth = (month) => {
MyMonth.value = month + 1; MyMonth.value = month + 1;
@@ -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>
<!-- не тут --> <!-- не тут -->
<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"
@@ -26,6 +26,7 @@
@click.stop="selectedStaff = item.raw" @click.stop="selectedStaff = item.raw"
/> />
</v-chip> </v-chip>
<!-- @click.stop="selectedStaff = item.raw" -->
</template> </template>
<!-- <!--
посчитать количество что я тут один и добавить условие --> посчитать количество что я тут один и добавить условие -->
@@ -33,9 +34,11 @@
<!-- не тут --> <!-- не тут -->
<v-list-item <v-list-item
@click="selectedStaff = staffed" @click="selectedStaff = staffed"
:disabled="disable()"
class="text-body-2" class="text-body-2"
> >
<!-- @click="selectedStaff = staffed" -->
<span class="text-body-2"> ВСЕ СОТРУДНИКИ </span> <span class="text-body-2"> ВСЕ СОТРУДНИКИ </span>
<template v-slot:prepend> <template v-slot:prepend>
@@ -56,7 +59,7 @@
@click.stop="" @click.stop=""
density="compact" density="compact"
class="text-body-2" class="text-body-2"
:disabled="disable()"
> >
<template v-slot:prepend> <template v-slot:prepend>
<!-- не тут --> <!-- не тут -->
@@ -65,36 +68,37 @@
:color="'indigo-darken-4'" :color="'indigo-darken-4'"
:true-value="true" :true-value="true"
:false-value="false" :false-value="false"
:indeterminate=" :indeterminate="
item.raw.employees.some((e) => e[okey] == true) && item.raw.employees.some((e) => e[okey] == true) &&
!item.raw.employees.every((e) => e[okey] == true) !item.raw.employees.every((e) => e[okey] == true)
" "
:model-value="disable() ? true : item.raw[okey]" :model-value="item.raw[okey]"
></v-checkbox-btn> ></v-checkbox-btn>
<!-- @click.stop="selectedStaff = item.raw" -->
</template> </template>
</v-list-item> </v-list-item>
</template> </template>
<!-- не тут --> <!-- не тут -->
<v-list-item <v-list-item
v-for="x in item.raw.employees.filter((e) => v-for="x in item.raw.employees.filter((e) =>
e.title.toLowerCase().includes(filtered.toLowerCase()) e.title.toLowerCase().includes(filtered.toLowerCase())
)" )"
:key="x.id" :key="x.id"
:value="x.title" :value="x.title"
:disabled="x.id == accountStore.user.is_idEmployee" :disabled ="x.id ==accountStore.user.is_idEmployee "
@click.stop="selectedStaff = x" @click.stop="selectedStaff = x"
density="compact" density="compact"
> >
<!-- <!-- @click.stop="selectedStaff = x" -->
@click.stop="selectedStaff = x" <template v-slot:prepend>
<template v-slot:prepend>
<v-checkbox-btn <v-checkbox-btn
:disabled ="x.id ==accountStore.user.is_idEmployee "
color="indigo-darken-4" color="indigo-darken-4"
:model-value="x[okey]" :model-value="x[okey]"
:disabled="x.id == accountStore.user.is_idEmployee"
></v-checkbox-btn> ></v-checkbox-btn>
</template> --> </template>
<span class="text-body-2"> {{ x.title }} </span> <span class="text-body-2"> {{ x.title }} </span>
</v-list-item> </v-list-item>
</v-list-group> </v-list-group>
@@ -125,6 +129,7 @@ export default {
const back = ref([]); const back = ref([]);
const staffed = computed({ const staffed = computed({
get() { get() {
if (props.okey == "editor") { if (props.okey == "editor") {
let ns = []; let ns = [];
props.staff.forEach((e) => { props.staff.forEach((e) => {
@@ -142,47 +147,60 @@ export default {
return ns; return ns;
} }
return props.staff; return props.staff;
}, },
}); });
const selectedStaff = computed({ const selectedStaff = computed({
get() { get() {
let selected = []; let selected = [];
props.staff.forEach((e) => { props.staff.forEach((e) => {
console.log(e, 'да гдееееееее') if (e.employees.every((n) => n[props.okey] == true)) {
// if (e.employees.every((n) => n[props.okey] == true)) { e[props.okey] = true;
// e[props.okey] = true; selected.push(e);
// selected.push(e); } else {
// } else { e[props.okey] = false;
// e[props.okey] = false; selected.push(...e.employees.filter((n) => n[props.okey] == true));
// selected.push(...e.employees.filter((n) => n[props.okey] == true)); }
// }
}); });
return selected; return selected;
}, },
set(item) { set(item) {
console.log(item, '0')
if ("employees" in item) { if ("employees" in item) {
item.employees.forEach((e) => { item.employees.forEach((e) => {
if (e.id != accountStore.user.is_idEmployee) { if (e.id != accountStore.user.is_idEmployee) {
e[props.okey] = !e[props.okey]; e[props.okey] = !e[props.okey];
} }
}); });
console.log(item, '1')
emit("returnIdParticant", { emit("returnIdParticant", {
okey: props.okey, okey: props.okey,
staff: item.employees, staff: item.employees,
}); });
} else if (item.length) { } else if (item.length) {
console.log(item, 'newvalue') console.log(item, '2')
let val = item.every((e) => e[props.okey] == true) ? false : true; let val = item.every((e) => e[props.okey] == true) ? false : true;
cbstaff(item, val); cbstaff(item, val);
console.log(back.value, '1111back.value')
emit("returnIdParticant", { okey: props.okey, staff: back.value }); emit("returnIdParticant", { okey: props.okey, staff: back.value });
back.value = []
// if (val == true) {
// back.value = []
// console.log(back.value, 'b1111111111111111111111111ack.value')
// }
console.log(back.value.length, 'back.value')
} else { } else {
console.log(item, '3')
item[props.okey] = !item[props.okey]; item[props.okey] = !item[props.okey];
emit("returnIdParticant", { okey: props.okey, staff: [item] }); emit("returnIdParticant", { okey: props.okey, staff: [item] });
@@ -191,13 +209,16 @@ export default {
}); });
const cbstaff = (item, value) => { const cbstaff = (item, value) => {
item.forEach((e) => { item.forEach((e) => {
if (e.id != accountStore.user.is_idEmployee) { if (e.id != accountStore.user.is_idEmployee) {
e[props.okey] = value; e[props.okey] = value;
} }
if (!("employees" in e)) { if (!("employees" in e)) {
console.log(e, '---------------------------------------------------')
back.value.push(e); back.value.push(e);
} }
if ("employees" in e) { if ("employees" in e) {
cbstaff(e.employees, value); cbstaff(e.employees, value);
@@ -206,6 +227,7 @@ export default {
}; };
function onFilter(item, itemText) { function onFilter(item, itemText) {
return ( return (
item.includes(filtered.value) || item.includes(filtered.value) ||
itemText.raw.employees.some((e) => itemText.raw.employees.some((e) =>
@@ -214,13 +236,15 @@ export default {
); );
} }
const disable = () => { const disable = (empl) => {
console.log(empl, 'empl')
let d = (staffed.value.length == 1 && staffed.value[0].employees.length == 1)
return ( return false
staffed.value.length == 1 && staffed.value[0].employees.length == 1
);
// return false // return false
}; };
return { return {
staffed, staffed,
@@ -229,7 +253,7 @@ export default {
selectedStaff, selectedStaff,
splitname, splitname,
onFilter, onFilter,
disable, disable
}; };
}, },
}; };
@@ -11,6 +11,7 @@
<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">
<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">
<my-helper :pretext="propsCalendar"></my-helper>
Название Название
</v-col> </v-col>
<v-col> <v-col>
@@ -113,26 +114,41 @@ export default {
const returnIdParticant = (idPart) => { const returnIdParticant = (idPart) => {
idPart.staff.forEach((e) => { idPart.staff.forEach((e) => {
let indx = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id
);
let ind = propsCalendar.value.participant.find(
(l) => l.participant_calendar == e.id
);
if (idPart.okey == "editor") { if (idPart.okey == "editor") {
let ind = propsCalendar.value.participant.find(
(l) => l.participant_calendar == e.id
);
ind.editor = e.editor; ind.editor = e.editor;
} else { } else {
if (e.selected == true) { if (e.selected == true) {
propsCalendar.value.participant.push({ if (e.id != accountStore.user.is_idEmployee) {
editor: false, if (indx == -1) {
participant_calendar: e.id, propsCalendar.value.participant.push({
}); editor: false,
participant_calendar: e.id,
});
}
}
} else { } else {
let ind = propsCalendar.value.participant.findIndex( let ind = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id (l) => l.participant_calendar == e.id
); );
propsCalendar.value.participant.splice(ind, 1);
if (ind != -1) {
propsCalendar.value.participant.splice(ind, 1);
}
} }
} }
}); });
// if (propsCalendar.value.participant.length == 0) {
// propsCalendar.value.participant.push({
// editor: true,
// participant_calendar: accountStore.user.is_idEmployee,
// });
// }
}; };
const propsCalendar = computed({ const propsCalendar = computed({
@@ -160,9 +176,7 @@ export default {
newCalendar.value = true; newCalendar.value = true;
} }
} };
;
calendarNewOrOld(); calendarNewOrOld();
const postCalendar = (val) => { const postCalendar = (val) => {
@@ -275,9 +289,7 @@ export default {
</script> </script>
<style> <style>
.custom-tooltip { .custom-tooltip {
max-width: 350px; /* Установка максимальной ширины для подсказки */ max-width: 350px; /* Установка максимальной ширины для подсказки */
} }
</style> </style>
@@ -121,6 +121,7 @@ export default {
cl_descr: "", cl_descr: "",
}; };
} else { } else {
calendar.value = cal; calendar.value = cal;
} }
showDialog.value = true; showDialog.value = true;