This commit is contained in:
iriska-gri committed 2024-07-10 11:03:39 +03:00
1 parent 0d0984cc61
commit 565848b226
6 files changed
+80 -44

No files matched your search

@@ -60,13 +60,14 @@
:color="'indigo-darken-4'" :color="'indigo-darken-4'"
:true-value="true" :true-value="true"
:false-value="false" :false-value="false"
:disabled="okey == 'editor' ? disable(item.raw) : false" disabled
: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="item.raw[okey]" :model-value="item.raw[okey]"
></v-checkbox-btn> ></v-checkbox-btn>
<!-- :disabled="disable(item.raw)" -->
</template> </template>
</v-list-item> </v-list-item>
</template> </template>
@@ -77,13 +78,14 @@
)" )"
:key="x.id" :key="x.id"
:value="x.title" :value="x.title"
:disabled="x.id == accountStore.user.is_idEmployee" disabled
@click.stop="selectedStaff = x" @click.stop="selectedStaff = x"
density="compact" density="compact"
> >
<!-- :disabled="x.id == accountStore.user.is_idEmployee" -->
<template v-slot:prepend> <template v-slot:prepend>
<v-checkbox-btn <v-checkbox-btn
:disabled="x.id == accountStore.user.is_idEmployee" disabled
color="indigo-darken-4" color="indigo-darken-4"
:model-value="x[okey]" :model-value="x[okey]"
></v-checkbox-btn> ></v-checkbox-btn>
@@ -137,7 +139,6 @@ export default {
}, },
}); });
const selectedStaff = computed({ const selectedStaff = computed({
get() { get() {
let selected = []; let selected = [];
props.staff.forEach((e) => { props.staff.forEach((e) => {
@@ -149,33 +150,53 @@ export default {
selected.push(...e.employees.filter((n) => n[props.okey] == true)); selected.push(...e.employees.filter((n) => n[props.okey] == true));
} }
}); });
emit("returnIdParticant", {
okey: props.okey,
select: selected,
staff: [],
});
return selected; return selected;
}, },
set(item) { set(item) {
if ("employees" in item) { console.log(item, '----------------------')
item.employees.forEach((e) => { emitUp(item);
},
});
const emitUp = (part) => {
if ("employees" in part) {
part.employees.forEach((e) => {
if (e.id != accountStore.user.is_idEmployee) { if (e.id != accountStore.user.is_idEmployee) {
e[props.okey] = !item[props.okey]; e[props.okey] = !part[props.okey];
} }
}); });
emit("returnIdParticant", { emit("returnIdParticant", {
okey: props.okey, okey: props.okey,
staff: item.employees, staff: part.employees,
select: [],
});
} else if (part.length) {
if (part[0].id != accountStore.user.is_idEmployee) {
let val = part.every((e) => e[props.okey] == true) ? false : true;
cbstaff(part, val);
emit("returnIdParticant", {
okey: props.okey,
staff: back.value,
select: [],
}); });
} else if (item.length) {
if (item[0].id != accountStore.user.is_idEmployee) {
let val = item.every((e) => e[props.okey] == true) ? false : true;
cbstaff(item, val);
emit("returnIdParticant", { okey: props.okey, staff: back.value });
back.value = []; back.value = [];
} }
} else { } else {
item[props.okey] = !item[props.okey]; part[props.okey] = !part[props.okey];
emit("returnIdParticant", { okey: props.okey, staff: [item] }); emit("returnIdParticant", {
} okey: props.okey,
}, staff: [part],
select: [],
}); });
}
};
const cbstaff = (item, value) => { const cbstaff = (item, value) => {
item.forEach((e) => { item.forEach((e) => {
@@ -11,7 +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> <my-helper :pretext= "propsCalendar " />
Название Название
</v-col> </v-col>
<v-col> <v-col>
@@ -113,6 +113,7 @@ export default {
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const returnIdParticant = (idPart) => { const returnIdParticant = (idPart) => {
// console.log(idPart, '2222222222222222222222')
idPart.staff.forEach((e) => { idPart.staff.forEach((e) => {
let indx = propsCalendar.value.participant.findIndex( let indx = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id (l) => l.participant_calendar == e.id
@@ -47,7 +47,7 @@
</template> </template>
<template v-slot:append> <template v-slot:append>
<!-- <my-helper :pretext = x /> -->
<transition name="fade"> <transition name="fade">
<v-btn <v-btn
v-if=" v-if="
@@ -2,7 +2,6 @@
<v-row> <v-row>
<v-col class="flex-column pr-0"> <v-col class="flex-column pr-0">
<v-card class="h-100"> <v-card class="h-100">
<!-- <my-helper :pretext="events" /> q -->
<vue-cal <vue-cal
locale="ru" locale="ru"
@@ -9,7 +9,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">
Название Название
@@ -31,21 +31,12 @@
</v-col> </v-col>
<v-col> <v-col>
<calendar-create-select <calendar-create-select
v-if="calendar.length > 0"
:staff="newStaff" :staff="newStaff"
@returnIdParticant="returnIdParticant" @returnIdParticant="returnIdParticant"
/> />
<v-autocomplete </v-col
v-else
label="Выберите из списка или найдите по ФИО"
variant="outlined"
density="compact"
hide-details
class="max-height-select py-3"
disabled
return-object
/> </v-col
></v-row> ></v-row>
<v-row no-gutters class="align-center pb-3"> <v-row no-gutters class="align-center pb-3">
@@ -66,7 +57,7 @@
<template v-slot:selection="{ item }"> <template v-slot:selection="{ item }">
<v-avatar <v-avatar
class="cursor-pointer" class="cursor-pointer"
size="9" size="8"
:color="item.raw.cl_color" :color="item.raw.cl_color"
/> />
<span class="pl-2"> <span class="pl-2">
@@ -219,14 +210,12 @@ export default {
const newStaff = computed({ const newStaff = computed({
get() { get() {
console.log(propsEvent.value);
console.log(calendar.value, 'calendar')
let ns = []; let ns = [];
let indCal = propsEvent.value.mycalendars.findIndex( let indCal = propsEvent.value.mycalendars.findIndex(
(e) => e.id == calendar.value[0].id (e) => e.id == calendar.value[0].id
); );
// console.log(indCal);
// let indCal = 0
staff.value.forEach((e) => { staff.value.forEach((e) => {
let emp = { ...e }; let emp = { ...e };
emp.employees = e.employees.filter((n) => { emp.employees = e.employees.filter((n) => {
@@ -314,6 +303,8 @@ export default {
const calendar = computed({ const calendar = computed({
get() { get() {
// propsEvent.value.event.participant = [accountStore.user.is_idEmployee]
let selected = []; let selected = [];
if (propsEvent.value.event.calendar) { if (propsEvent.value.event.calendar) {
let ind = propsEvent.value.mycalendars.findIndex( let ind = propsEvent.value.mycalendars.findIndex(
@@ -364,23 +355,47 @@ export default {
calendarNewOrOld(); calendarNewOrOld();
const part = new Set()
const returnIdParticant = (idPart) => { const returnIdParticant = (idPart) => {
if (idPart.select.length > 0){
part.clear()
cbSelect(idPart.select)
}
else {
console.log(idPart.staff, idPart.staff.length, 'e-----------------------------------------------------')
idPart.staff.forEach( idPart.staff.forEach(
(e) => { (e) => {
if (e.selected == true) { if (e.selected == true) {
propsEvent.value.event.participant.push(e.id); console.log(e, 'eeeeeeeeeeeeeeeeee')
part.add(e.id)
} else { } else {
let ind = propsEvent.value.event.participant.findIndex( part.delete(e.id)
(l) => l == e.id
);
propsEvent.value.event.participant.splice(ind, 1);
} }
} }
// propsEvent.value.event.participant.push(e.id)
); );
}
propsEvent.value.event.participant = [...part]
}; };
const cbSelect = (item) => {
console.log(item, '-----------------------------------------------------')
item.forEach((e)=> {
if (!("employees" in e)) {
part.add(e.id)
}
if ("employees" in e) {
cbSelect(e.employees);
}
})
}
const dateEvent = computed({ const dateEvent = computed({
get() { get() {
return formatComa(new Date(propsEvent.value.event.date_start)); return formatComa(new Date(propsEvent.value.event.date_start));
@@ -1,7 +1,7 @@
<template> <template>
<v-dialog v-model="mydialog" max-width="700"> <v-dialog v-model="mydialog" max-width="700">
<v-card> <v-card>
<!-- <my-helper :pretext="event" /> -->
<v-card-title> <v-card-title>
<v-icon <v-icon
:icon="editEvent ? 'mdi-book-open-variant' : 'mdi-pencil'" :icon="editEvent ? 'mdi-book-open-variant' : 'mdi-pencil'"