This commit is contained in:
Nukeap committed 2025-02-04 13:16:50 +03:00
1 parent 50eefccda2
commit b34ce38324
2 files changed
+52 -67

No files matched your search

+2 -2
View File
@@ -21,8 +21,8 @@
"vitepress": "^1.6.3" "vitepress": "^1.6.3"
}, },
"lint-staged": { "lint-staged": {
"*.{js,ts,vue}": [ "*.{js,ts,vue}": ["prettier --write",
"eslint --fix","prettier --write" "eslint --fix"
] ]
} }
} }
@@ -10,10 +10,7 @@
<v-row no-gutters class="flex-column"> <v-row no-gutters class="flex-column">
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-row no-gutters class="align-center"> <v-row no-gutters class="align-center">
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> <v-col class="text-body-2 text-text_grey pb-5" lg="2"> Название </v-col>
Название
</v-col>
<v-col> <v-col>
<v-textarea <v-textarea
density="compact" density="compact"
@@ -37,8 +34,8 @@
propsCalendar.cl_color === null propsCalendar.cl_color === null
? 'flat' ? 'flat'
: propsCalendar.cl_color === x : propsCalendar.cl_color === x
? 'flat' ? 'flat'
: 'tonal' : 'tonal'
" "
/> </v-col /> </v-col
></v-row> ></v-row>
@@ -80,8 +77,8 @@
<v-icon v-bind="props" icon="mdi-help-circle-outline" /> <v-icon v-bind="props" icon="mdi-help-circle-outline" />
</template> </template>
<div class="custom-tooltip"> <div class="custom-tooltip">
Участники с доступом редактирования смогут изменять поля Участники с доступом редактирования смогут изменять поля календаря, а также
календаря, а также редактировать и удалять события редактировать и удалять события
</div> </div>
</v-tooltip> </v-tooltip>
</v-col> </v-col>
@@ -92,12 +89,12 @@
</template> </template>
<script> <script>
import { computed, ref } from "vue"; import { computed, ref } from 'vue';
import { axiosApiInstance } from "@/utils/axios-api"; import { axiosApiInstance } from '@/utils/axios-api';
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue"; import calendarCreateSelect from '@/components/calendar_of_events/calendar-create-select.vue';
import { useAlertStore } from "@/store/useAlertStore"; import { useAlertStore } from '@/store/useAlertStore';
import DialogCreate from "./UI_calendar/dialogCreate.vue"; import DialogCreate from './UI_calendar/dialogCreate.vue';
import { useAccountStore } from "@/store/AccountStore"; import { useAccountStore } from '@/store/AccountStore';
export default { export default {
components: { calendarCreateSelect, DialogCreate }, components: { calendarCreateSelect, DialogCreate },
@@ -105,7 +102,7 @@ export default {
props: { props: {
calendar: { calendar: {
type: Object, type: Object,
default: {}, default: () => {},
}, },
}, },
@@ -113,15 +110,10 @@ export default {
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const returnIdParticant = (idPart) => { const returnIdParticant = (idPart) => {
idPart.staff.forEach((e) => { idPart.staff.forEach((e) => {
let indx = propsCalendar.value.participant.findIndex( let indx = propsCalendar.value.participant.findIndex((l) => l.participant_calendar == e.id);
(l) => l.participant_calendar == e.id let ind = propsCalendar.value.participant.find((l) => l.participant_calendar == e.id);
); if (idPart.okey == 'editor') {
let ind = propsCalendar.value.participant.find(
(l) => l.participant_calendar == e.id
);
if (idPart.okey == "editor") {
ind.editor = e.editor; ind.editor = e.editor;
} else { } else {
if (e.selected == true) { if (e.selected == true) {
@@ -135,7 +127,7 @@ export default {
} }
} else { } else {
let ind = propsCalendar.value.participant.findIndex( let ind = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id (l) => l.participant_calendar == e.id,
); );
if (ind != -1) { if (ind != -1) {
@@ -144,32 +136,29 @@ export default {
} }
} }
}); });
}; };
const propsCalendar = computed({ const propsCalendar = computed({
get: () => props.calendar, get: () => props.calendar,
set: (value) => emit("update:calendar", value), set: (value) => emit('update:calendar', value),
}); });
const feedalert = useAlertStore().alert; const feedalert = useAlertStore().alert;
const rules = { const rules = {
cl_name: [(val) => req(val)], cl_name: [(val) => req(val)],
cl_descr: [(val) => req(val)], cl_descr: [(val) => req(val)],
}; };
const titleCard = ref(""); const titleCard = ref('');
const newCalendar = ref(false); const newCalendar = ref(false);
const calendarNewOrOld = () => { const calendarNewOrOld = () => {
if (propsCalendar.value.hasOwnProperty("id")) { if ('id' in propsCalendar.value) {
titleCard.value = "Редактирование календаря"; titleCard.value = 'Редактирование календаря';
if (propsCalendar.value.author != accountStore.user.is_idEmployee) if (propsCalendar.value.author != accountStore.user.is_idEmployee) newCalendar.value = true;
newCalendar.value = true;
} else { } else {
titleCard.value = "Новый календарь"; titleCard.value = 'Новый календарь';
newCalendar.value = true; newCalendar.value = true;
} }
@@ -186,22 +175,19 @@ export default {
.then((result) => { .then((result) => {
feedalert.alert = true; feedalert.alert = true;
feedalert.text = result.data.mess; feedalert.text = result.data.mess;
feedalert.ico = "mdi-check"; feedalert.ico = 'mdi-check';
feedalert.color = "green-darken-4"; feedalert.color = 'green-darken-4';
emit("getCalendar"); emit('getCalendar');
emit("closeDialog"); emit('closeDialog');
}); });
} }
}; };
const staff = ref([]); const staff = ref([]);
axiosApiInstance axiosApiInstance.get('api/calendar_of_events/get_employees/').then((res) => {
staff.value = res.data.filter((e) => e.employees.length > 0);
.get("api/calendar_of_events/get_employees/") });
.then((res) => {
staff.value = res.data.filter((e) => e.employees.length > 0);
});
const newStaff = computed({ const newStaff = computed({
get() { get() {
@@ -209,7 +195,7 @@ export default {
if (propsCalendar.value.participant.length > 0) { if (propsCalendar.value.participant.length > 0) {
e.employees.forEach((empl) => { e.employees.forEach((empl) => {
let ab = propsCalendar.value.participant.find( let ab = propsCalendar.value.participant.find(
(a) => a.participant_calendar === empl.id (a) => a.participant_calendar === empl.id,
); );
if (ab) { if (ab) {
empl.selected = true; empl.selected = true;
@@ -227,21 +213,21 @@ export default {
}); });
const color = [ const color = [
"red", 'red',
"pink", 'pink',
"deep-orange", 'deep-orange',
"amber", 'amber',
"yellow", 'yellow',
"lime", 'lime',
"light-green", 'light-green',
"green", 'green',
"light-blue", 'light-blue',
"blue", 'blue',
"indigo", 'indigo',
"deep-purple", 'deep-purple',
"purple", 'purple',
"blue-grey", 'blue-grey',
"brown", 'brown',
]; ];
const colorPik = (col) => { const colorPik = (col) => {
@@ -258,16 +244,15 @@ export default {
.then((result) => { .then((result) => {
feedalert.alert = true; feedalert.alert = true;
feedalert.text = result.data.mess; feedalert.text = result.data.mess;
feedalert.ico = "mdi-check"; feedalert.ico = 'mdi-check';
feedalert.color = "orange-accent-1"; feedalert.color = 'orange-accent-1';
emit("getCalendar"); emit('getCalendar');
}); });
emit("closeDialog"); emit('closeDialog');
}; };
const req = (val) => { const req = (val) => {
return !!val || 'Поле обязательно';
return !!val || "Поле обязательно";
}; };
return { return {