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