[WIP] Добавил отображение времени текущей даты при замене смен, скрыл отображение выделенной ячейки при сохранении/удалении

This commit is contained in:
megavrilinvv
2023-01-25 17:03:01 +03:00
parent 082f92937d
commit 48f78626c1
5 changed files with 70 additions and 33 deletions

View File

@@ -16,6 +16,7 @@
:replacement-sheet="replacementSheet",
:employees="employees",
:change-shift="changeShift"
:set-active-cell="setActiveCell"
)
schedule-table-select(
v-if="employees.length > 0",
@@ -24,7 +25,7 @@
:result="result",
:choice-cell="choiceCell",
:choice-state="choiceState",
:trim-owner-name="trimOwnerName",
:trim-owner-name="trimOwnerName"
)
</template>
@@ -47,16 +48,18 @@ export default {
scheduleList: Array,
serialized: Array,
buttons: Array,
template: Object,
employees: Array,
showTime: Boolean,
activeCell: Boolean,
clearSelect: Function,
selectEmployee: Object,
startMonth: Object,
trimOwnerName: Function,
openForm: Function,
replacementSheet: Object,
changeShift: Function,
setActiveCell: Function,
template: Object,
selectEmployee: Object,
startMonth: Object,
replacementSheet: Object,
},
data() {
return {
@@ -71,7 +74,6 @@ export default {
},
activeButton: null,
choiceMonth: null,
act: null,
};
},
computed: {
@@ -79,9 +81,10 @@ export default {
this.setActiveButton();
return {
"--bg-color-status": this.activeButton?.color,
"--text-status": !this.template.item?.symbol
? this.activeButton?.text
: this.template.item?.symbol,
"--text-status":
!this.template.item?.symbol && this.activeCell
? this.activeButton?.text
: this.template.item?.symbol,
};
},
},
@@ -89,14 +92,14 @@ export default {
setActiveButton() {
this.activeButton = this.buttons.find((e) => e.active);
},
setActiveCell() {
setActiveTemplate() {
return (this.buttons.find((e) => e.work === "WORKS").active = true);
},
choiceCell(day, id, schedule) {
if (this.showTime) return;
let formatTime = day.format("YYYY-MM-DD");
if (this.dateInterval.id !== id) {
if (this.dateInterval.id !== id || !this.activeCell) {
this.dateInterval.start = "";
this.dateInterval.end = "";
this.dateInterval.id = "";
@@ -150,7 +153,7 @@ export default {
this.$emit("schedules", insideSchedules, outsideSchedules);
},
choiceState(day, id) {
let formatDay = day.format("YYYY-MM-DD");
let formatDay = day?.format("YYYY-MM-DD");
let resStart =
this.dateInterval.start &&
formatDay === this.dateInterval.start &&
@@ -162,16 +165,18 @@ export default {
this.dateInterval.id === id;
let resMiddle =
day.isBefore(this.dateInterval.end) &&
day?.isBefore(this.dateInterval.end) &&
this.dateInterval.id === id &&
day.isAfter(this.dateInterval.start);
day?.isAfter(this.dateInterval.start);
if (resStart || resMiddle || resEnd)
if (resStart || resMiddle || resEnd) {
return {
"set-template": !!this.template.item?.label && this.setActiveCell(),
status: !!this.activeButton,
"set-date": !this.activeButton,
"set-template":
!!this.template.item?.label && this.setActiveTemplate(),
status: !!this.activeButton && this.activeCell,
"set-date": !this.activeButton && this.activeCell,
};
}
},
changeDays() {
this.days = moment(this.choiceMonth, "YYYY-MM-DD").daysInMonth();