[WIP] Добавил отображение текста при выборе даты и выбор employee

This commit is contained in:
megavrilinvv
2022-12-26 13:31:03 +03:00
parent f8e82c64b4
commit 1dd0c79360
3 changed files with 95 additions and 45 deletions

View File

@@ -13,9 +13,11 @@
:serialized="serialized",
:data-schedule="dataSchedule",
:buttons="buttons",
:start-month="startMonth"
:start-month="startMonth",
:clear-employee="clearEmployee",
@new-date="createNewDate"
)
schedule-bar(:data-schedule="dataSchedule", :select-work="selectWork", :buttons="buttons")
schedule-bar(:data-schedule="dataSchedule", :buttons="buttons")
</template>
<script>
@@ -31,6 +33,7 @@ export default {
return {
employeeList: [],
scheduleList: [],
clearEmployee: [],
serialized: [],
dataSchedule: {
status: "",
@@ -45,7 +48,7 @@ export default {
work: "WORKS",
active: false,
color: "#55CD76",
text: "Р",
text: "'Р'",
},
{
class: "button-status",
@@ -53,7 +56,7 @@ export default {
work: "VACATION",
active: false,
color: "#D7D9FF",
text: "О",
text: "'О'",
},
{
class: "button-free",
@@ -61,7 +64,7 @@ export default {
work: "DAY_OFF",
active: false,
color: "#9294A7",
text: "В",
text: "'В'",
},
],
startMonth: moment().startOf("month"),
@@ -94,6 +97,14 @@ export default {
)
.then((data) => {
this.scheduleList.push(...data.results);
if (!data.count)
this.clearEmployee.push({
first_name: e.first_name,
id: e.id,
last_name: e.last_name,
patronymic: e.patronymic,
schedules: [],
});
})
.then(() => this.filterScheduleEmployee());
});
@@ -134,8 +145,29 @@ export default {
});
this.serialized = serialized;
},
selectWork(work) {
this.dataSchedule.status = work;
postCreateSchedule() {
fetchWrapper
.post("accounts/schedules/create/", {
employee: "582b6557-33f4-480f-b578-984bbca0a925",
active_flg: true,
start_date: "2019-08-24",
end_date: "2019-08-24",
title: "string",
name: "string",
start_time: "string",
end_time: "string",
status: "string",
work_template: 0,
holiday_template: 0,
})
.then(() => this.fetchSchedules());
},
createNewDate(e) {
let res = this.clearEmployee.find((elem) => elem.id === e.id);
res.schedules.push({
start_date: e.start,
end_date: e.end,
});
},
switchPreviousMonth() {
this.startMonth = this.startMonth.clone().subtract(1, "M");