[WIP] Добавил отображение расписания

This commit is contained in:
megavrilinvv
2022-12-22 13:37:06 +03:00
parent 40e0c71347
commit 838266c0e9

View File

@@ -19,12 +19,12 @@
.flex.icon-edit .flex.icon-edit
.name-employee.flex.justify-center.items-center.cursor-pointer(@click="openSelect") .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)}} 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( .cell.flex.flex-col.items-center.justify-center.w-11(
v-for="item in scheduleList", v-for="day in result",
:style="{backgroundColor: day.format('YYYY-MM-DD') === item.date ? choiceColor(item.status) : ''}" :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 .schedule-body.flex.w-full
.edit.flex.items-center.justify-center.h-9.w-9 .edit.flex.items-center.justify-center.h-9.w-9
.flex.items-center.gap-x-8 .flex.items-center.gap-x-8
@@ -112,11 +112,13 @@ export default {
this.currentEmployee.label = ""; this.currentEmployee.label = "";
this.currentEmployee.id = null; this.currentEmployee.id = null;
}, },
choiceWorks(work) { choiceWorks(day) {
return this.works.find((e) => e.work === work).text; let a = this.scheduleList.find((e) => e.date === day).status;
return this.works.find((e) => e.work === a).text;
}, },
choiceColor(work) { choiceColor(day) {
return this.works.find((e) => e.work === work).color; let a = this.scheduleList.find((e) => e.date === day).status;
return this.works.find((e) => e.work === a).color;
}, },
changeDays() { changeDays() {
this.days = moment().daysInMonth(); this.days = moment().daysInMonth();
@@ -138,6 +140,9 @@ export default {
this.employee.push(this.employeeList[index]); this.employee.push(this.employeeList[index]);
} }
}, },
choiceDay(day) {
return this.scheduleList.find((e) => day === e.date)?.date;
},
}, },
mounted() { mounted() {