feat [P-227]: дата окончания для каждого из сотрудников
This commit is contained in:
1 parent
04840193e2
commit
332260113c
2 files changed
+18
-6
No files matched your search
@@ -56,7 +56,12 @@
|
|||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
<span class="text-orange-darken-2">{{ employee.fio }}</span>
|
<div>
|
||||||
|
<span class="text-orange-darken-2">{{ employee.fio }}</span>
|
||||||
|
<div class="text-caption text-grey-darken-1" v-if="employee.completion_date">
|
||||||
|
Дата окончания: {{ new Date(employee.completion_date).toLocaleDateString('ru-RU') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon="mdi-close"
|
icon="mdi-close"
|
||||||
variant="text"
|
variant="text"
|
||||||
|
|||||||
@@ -276,17 +276,24 @@ export default {
|
|||||||
const response = await getTestToUser(id);
|
const response = await getTestToUser(id);
|
||||||
console.log('Получены назначения теста:', response);
|
console.log('Получены назначения теста:', response);
|
||||||
|
|
||||||
const uniqueAssignments = response.reduce((acc, testing) => {
|
// Сгруппируем тесты по пользователям и возьмем самую позднюю дату для каждого
|
||||||
if (testing.user_details && testing.is_active && !acc.some(a => a.id === testing.user_details.id)) {
|
const assignmentsByUser = response.reduce((acc, testing) => {
|
||||||
acc.push(testing.user_details);
|
if (testing.user_details && testing.is_active) {
|
||||||
|
const existingUser = acc.find(u => u.id === testing.user_details.id);
|
||||||
|
if (!existingUser) {
|
||||||
|
acc.push({
|
||||||
|
...testing.user_details,
|
||||||
|
completion_date: testing.completion_date
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
assignedEmployees.value = uniqueAssignments.map(user => user.id);
|
assignedEmployees.value = assignmentsByUser.map(user => user.id);
|
||||||
console.log('ID назначенных сотрудников:', assignedEmployees.value);
|
console.log('ID назначенных сотрудников:', assignedEmployees.value);
|
||||||
|
|
||||||
assignedEmployeesDetails.value = uniqueAssignments.sort((a, b) => a.fio.localeCompare(b.fio));
|
assignedEmployeesDetails.value = assignmentsByUser.sort((a, b) => a.fio.localeCompare(b.fio));
|
||||||
console.log('Детали назначенных сотрудников:', assignedEmployeesDetails.value);
|
console.log('Детали назначенных сотрудников:', assignedEmployeesDetails.value);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in new issue
Block a user