P-42
This commit is contained in:
1 parent
f4a442244e
commit
6b6ff8be12
2 files changed
+79
-68
No files matched your search
@@ -27,13 +27,16 @@
|
||||
icon="mdi-close-circle"
|
||||
size="x-small"
|
||||
class="ml-3"
|
||||
@click.stop="cbstaff([item.raw], false)"
|
||||
@click.stop="selectedStaff = item.raw"
|
||||
/>
|
||||
</v-chip>
|
||||
</template>
|
||||
|
||||
<template v-slot:prepend-item>
|
||||
<v-list-item @click="allman" class="text-body-2">
|
||||
<v-list-item
|
||||
@click="staff.forEach((e) => (selectedStaff = e))"
|
||||
class="text-body-2"
|
||||
>
|
||||
<span class="text-body-2"> ВСЕ СОТРУДНИКИ </span>
|
||||
|
||||
<template v-slot:prepend>
|
||||
@@ -57,7 +60,7 @@
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-checkbox-btn
|
||||
@click.stop="toggledep(item.raw)"
|
||||
@click.stop="selectedStaff = item.raw"
|
||||
:color="'indigo-darken-4'"
|
||||
:true-value="true"
|
||||
:false-value="false"
|
||||
@@ -77,11 +80,7 @@
|
||||
)"
|
||||
:key="x.id"
|
||||
:value="x.title"
|
||||
@click.stop="
|
||||
x.id != accountStore.user.is_idEmployee
|
||||
? (x.selected = !x.selected)
|
||||
: ''
|
||||
"
|
||||
@click.stop="selectedStaff = x"
|
||||
density="compact"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
@@ -115,59 +114,52 @@ export default {
|
||||
const filtered = ref("");
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
const selectedStaff = computed(() => {
|
||||
let selected = [];
|
||||
let idEmployees = [];
|
||||
const selectedStaff = computed({
|
||||
get() {
|
||||
let selected = [];
|
||||
let idEmployees = [];
|
||||
|
||||
props.staff.forEach((e) => {
|
||||
e.employees
|
||||
.filter((n) => n.selected == true)
|
||||
.forEach((res) => {
|
||||
idEmployees.push({
|
||||
participant_calendar: res.id,
|
||||
props.staff.forEach((e) => {
|
||||
e.employees
|
||||
.filter((n) => n.selected == true)
|
||||
.forEach((res) => {
|
||||
idEmployees.push({
|
||||
participant_calendar: res.id,
|
||||
});
|
||||
});
|
||||
if (e.employees.every((n) => n.selected == true)) {
|
||||
e.selected = true;
|
||||
selected.push(e);
|
||||
} else {
|
||||
e.selected = false;
|
||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||
}
|
||||
});
|
||||
return selected;
|
||||
},
|
||||
|
||||
set(item) {
|
||||
|
||||
if ("employees" in item) {
|
||||
console.log(item)
|
||||
|
||||
item.employees.forEach((e) => {
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
|
||||
e.selected = !e.selected;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
if (e.employees.every((n) => n.selected == true)) {
|
||||
e.selected = true;
|
||||
selected.push(e);
|
||||
emit("returnIdParticant", item.employees);
|
||||
} else {
|
||||
e.selected = false;
|
||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||
item.selected = !item.selected;
|
||||
|
||||
emit("returnIdParticant", [item]);
|
||||
}
|
||||
});
|
||||
|
||||
emit("returnIdParticant", idEmployees);
|
||||
|
||||
return selected;
|
||||
},
|
||||
});
|
||||
|
||||
const cbstaff = (item, value) => {
|
||||
|
||||
item.forEach((e) => {
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
e.selected = value;
|
||||
}
|
||||
if ("employees" in e) {
|
||||
cbstaff(e.employees, value);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
const allman = () => {
|
||||
let val = props.staff.every((e) => e.selected == true) ? false : true;
|
||||
cbstaff(props.staff, val);
|
||||
};
|
||||
|
||||
function toggledep(item) {
|
||||
item.employees.forEach((e) => {
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
e.selected = !item.selected;
|
||||
}
|
||||
});
|
||||
item.selected = !item.selected;
|
||||
}
|
||||
|
||||
function onFilter(item, itemText) {
|
||||
return (
|
||||
item.includes(filtered.value) ||
|
||||
@@ -181,9 +173,6 @@ export default {
|
||||
filtered,
|
||||
accountStore,
|
||||
selectedStaff,
|
||||
allman,
|
||||
cbstaff,
|
||||
toggledep,
|
||||
splitname,
|
||||
onFilter,
|
||||
};
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Участники </v-col>
|
||||
<v-col>
|
||||
ss {{ propsCalendar.participant }}
|
||||
|
||||
<calendar-create-select
|
||||
:staff="staff"
|
||||
:staff="newStaff"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
<!-- <calendar-create-select
|
||||
@@ -156,10 +156,20 @@ export default {
|
||||
|
||||
// })
|
||||
|
||||
// console.log( staff.value, 'for_edit.value')
|
||||
|
||||
idPart.forEach((e) => {
|
||||
if(e.selected == true) {
|
||||
propsCalendar.value.participant.push({ "editor": false, "participant_calendar": e.id })
|
||||
}
|
||||
else {
|
||||
let ind = propsCalendar.value.participant.findIndex(l => l.participant_calendar == e.id
|
||||
|
||||
postParticant.value = { ...props.calendar, participant: idPart };
|
||||
console.log(postParticant.value, 'postParticant.value')
|
||||
)
|
||||
propsCalendar.value.participant.splice(ind, 1)
|
||||
}
|
||||
})
|
||||
// postParticant.value = { ...props.calendar, participant: propsCalendar.value.participant };
|
||||
// console.log(postParticant.value, 'postParticant.value')
|
||||
};
|
||||
|
||||
const propsCalendar = computed({
|
||||
@@ -191,7 +201,7 @@ export default {
|
||||
const postCalendar = (val) => {
|
||||
if (val) {
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/my_calendars/`, postParticant.value)
|
||||
.post(`api/calendar_of_events/my_calendars/`, { ...props.calendar, participant: propsCalendar.value.participant })
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
@@ -208,10 +218,15 @@ export default {
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
console.log(res.data, "res.data");
|
||||
// console.log(res.data, "res.data");
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
// console.log(staff.value, "propsCalendar.value");
|
||||
staff.value.forEach((e) => {
|
||||
console.log(staff.value, "propsCalendar.value");
|
||||
|
||||
});
|
||||
|
||||
const newStaff = computed({get() {
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
if (propsCalendar.value.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
if (
|
||||
@@ -223,8 +238,14 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
return staff.value
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
|
||||
const color = [
|
||||
"red",
|
||||
@@ -281,6 +302,7 @@ export default {
|
||||
titleCard,
|
||||
newCalendar,
|
||||
staff,
|
||||
newStaff
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user