From 838266c0e96f5bced6ef3c23d95bb1a46408445b Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Thu, 22 Dec 2022 13:37:06 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=80=D0=B0=D1=81=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/components/ScheduleBody.vue | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/pages/schedule/components/ScheduleBody.vue b/src/pages/schedule/components/ScheduleBody.vue index 7e6668f..c4e4461 100644 --- a/src/pages/schedule/components/ScheduleBody.vue +++ b/src/pages/schedule/components/ScheduleBody.vue @@ -19,12 +19,12 @@ .flex.icon-edit .name-employee.flex.justify-center.items-center.cursor-pointer(@click="openSelect") span {{trimOwnerName(this.scheduleList[0]?.employee.last_name, this.scheduleList[0]?.employee.first_name, this.scheduleList[0]?.employee.patronymic)}} - .flex(v-for="day in result") + .flex .cell.flex.flex-col.items-center.justify-center.w-11( - v-for="item in scheduleList", - :style="{backgroundColor: day.format('YYYY-MM-DD') === item.date ? choiceColor(item.status) : ''}" + v-for="day in result", + :style="{backgroundColor: day.format('YYYY-MM-DD') === choiceDay(day.format('YYYY-MM-DD')) ? choiceColor(day.format('YYYY-MM-DD')) : ''}" ) - .flex {{day.format("YYYY-MM-DD") === item.date ? choiceWorks(item.status) : ''}} + .flex {{day.format("YYYY-MM-DD") === choiceDay(day.format("YYYY-MM-DD")) ? choiceWorks(day.format('YYYY-MM-DD')) : ''}} .schedule-body.flex.w-full .edit.flex.items-center.justify-center.h-9.w-9 .flex.items-center.gap-x-8 @@ -112,11 +112,13 @@ export default { this.currentEmployee.label = ""; this.currentEmployee.id = null; }, - choiceWorks(work) { - return this.works.find((e) => e.work === work).text; + choiceWorks(day) { + let a = this.scheduleList.find((e) => e.date === day).status; + return this.works.find((e) => e.work === a).text; }, - choiceColor(work) { - return this.works.find((e) => e.work === work).color; + choiceColor(day) { + let a = this.scheduleList.find((e) => e.date === day).status; + return this.works.find((e) => e.work === a).color; }, changeDays() { this.days = moment().daysInMonth(); @@ -138,6 +140,9 @@ export default { this.employee.push(this.employeeList[index]); } }, + choiceDay(day) { + return this.scheduleList.find((e) => day === e.date)?.date; + }, }, mounted() {