[WIP] Изменил конфиг, исправил отображение статусов в селекте календаря

This commit is contained in:
megavrilinvv
2023-03-07 17:29:43 +03:00
parent f60eea81fe
commit c61cc487d6
5 changed files with 84 additions and 71 deletions

View File

@@ -26,7 +26,8 @@
</template>
<script>
import { statusesDictionary } from "../utils/statusesDictionary.js";
import { statusesDictionary } from "@/pages/calendar/utils/statusesDictionary";
export default {
name: "CalendarEventDescriptionCard",
props: {
@@ -47,12 +48,14 @@ export default {
return {
isCertainType: true,
position: {},
calendarConfig: statusesDictionary,
};
},
computed: {
status() {
return this.ownerEvent.status
? statusesDictionary[this.ownerEvent.status]
? this.calendarConfig.find((e) => e.value === this.ownerEvent.status)
.label
: "";
},
typeColor() {

View File

@@ -1,11 +1,16 @@
<template lang="pug">
base-modal(v-model="value", :title="!selectedEventData.id ? 'Запись на прием' : 'Изменение записи'", draggable, hide-overlay )
base-modal(
v-model="value",
:title="!selectedEventData.id ? 'Запись на прием' : 'Изменение записи'",
draggable,
hide-overlay
)
.event-form.flex.flex-col.gap-y-6.pt-8
.flex.flex-col.gap-y-8
base-select(
v-if="selectedEventData.id"
v-model="status",
:items="eventStatuses",
:items="statusesList",
label="Статус приема"
)
base-input(
@@ -75,9 +80,9 @@ import { fetchWrapper } from "@/shared/fetchWrapper.js";
import BaseInput from "@/components/base/BaseInput.vue";
import BaseSelect from "@/components/base/BaseSelect.vue";
import * as moment from "moment/moment";
import { statusesDictionary } from "../utils/statusesDictionary.js";
import BaseModal from "@/components/base/BaseModal.vue";
import { v_model } from "@/shared/mixins/v-model";
import { statusesDictionary } from "@/pages/calendar/utils/statusesDictionary";
export default {
name: "FormChangeEvent",
@@ -127,12 +132,13 @@ export default {
members: {},
employees: {},
eventDate: Date,
status: {},
status: { label: "Планируется прием", id: null },
id: null,
ifClearedForm: true,
membersData: [],
ownersData: [],
WORKING_STATUS: "WORKS",
calendarConfig: statusesDictionary,
};
},
computed: {
@@ -170,6 +176,16 @@ export default {
}
return [];
},
statusesList() {
let filteredArray = [];
this.calendarConfig.forEach((elem) => {
filteredArray.push({
id: elem.id,
label: elem.label,
});
});
return filteredArray;
},
disabledCreateButton() {
if (
this.eventDate &&
@@ -267,26 +283,29 @@ export default {
role: this.MEMBER_TYPE,
};
},
eventId() {
return this.selectedEventData.id ? this.selectedEventData.id : "";
},
eventStatus() {
return this.selectedEventData.status
? {
label: statusesDictionary[this.selectedEventData.status],
id: null,
label: this.calendarConfig.find(
(e) => e.value === this.selectedEventData.status
).label,
id: this.calendarConfig.find(
(e) => e.value === this.selectedEventData.status
).id,
}
: {
label: statusesDictionary["PLANNED"],
id: null,
label: this.calendarConfig.find((e) => e.value === "PLANNED").id,
id: 0,
};
},
eventId() {
return this.selectedEventData.id ? this.selectedEventData.id : "";
},
},
methods: {
findStatus(value) {
return Object.keys(statusesDictionary).find(
(key) => statusesDictionary[key] === value
);
return this.calendarConfig.find((e) => e.label === value)?.value;
},
checkTimeLimits(eventTime, scheduleTime, timeType) {
if (timeType === "start")