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

No files matched your search

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