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