P-42 Насадить рыбу на v-select
This commit is contained in:
1 parent
ab8811773f
commit
b6f0b33d9f
6 files changed
+308
-101
No files matched your search
@@ -1,21 +1,20 @@
|
||||
<template>
|
||||
<v-row no-gutters>
|
||||
<v-col class="flex-grow-0 d-flex flex-column ">
|
||||
<v-col class="flex-grow-0 d-flex flex-column">
|
||||
<v-card class="h-100 rounded-0 d-flex flex-colmn" width="250">
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="flex-grow-0">
|
||||
<v-text-field
|
||||
density="compact"
|
||||
clearable
|
||||
append-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
class="py-3"
|
||||
label="Найти событие"
|
||||
rows="1"
|
||||
no-resize
|
||||
variant="outlined"
|
||||
|
||||
/>
|
||||
density="compact"
|
||||
clearable
|
||||
append-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
class="py-3"
|
||||
label="Найти событие"
|
||||
rows="1"
|
||||
no-resize
|
||||
variant="outlined"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0">
|
||||
<v-btn
|
||||
@@ -97,6 +96,8 @@ export default {
|
||||
const MyYear = ref(selectdate.value.getFullYear());
|
||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||
|
||||
|
||||
|
||||
function getWeekend() {
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/exclusionDatas/?year=${MyYear.value}`, {})
|
||||
@@ -106,6 +107,11 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getcalendar() {
|
||||
|
||||
}
|
||||
|
||||
const getMonth = (month) => {
|
||||
MyMonth.value = month + 1;
|
||||
};
|
||||
@@ -161,6 +167,7 @@ export default {
|
||||
week,
|
||||
CheckingStore,
|
||||
showDialog,
|
||||
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<v-select
|
||||
v-model="selectedStaff"
|
||||
:items="staff"
|
||||
label="Выберите из списка или найдите по ФИО"
|
||||
|
||||
multiple
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
class="max-height-select"
|
||||
>
|
||||
|
||||
<template v-slot:selection="{ item, index }">
|
||||
{{item}}
|
||||
<v-chip v-if="(index < 1) && likesAllFruit">
|
||||
<span>Выбраны все сотрудники</span>
|
||||
</v-chip>
|
||||
<!-- <span
|
||||
v-if="index === 2"
|
||||
class="text-grey text-caption align-self-center"
|
||||
>
|
||||
(+{{ selectedFruits.length - 2 }} others)
|
||||
</span> -->
|
||||
</template>
|
||||
|
||||
<template v-slot:prepend-item>
|
||||
<v-list-item title="Выбрать всех сотрудников" @click="toggle">
|
||||
<template v-slot:prepend>
|
||||
<v-checkbox-btn
|
||||
:color="likesSomeFruit ? 'indigo-darken-4' : undefined"
|
||||
:indeterminate="likesSomeFruit && !likesAllFruit"
|
||||
:model-value="likesAllFruit"
|
||||
></v-checkbox-btn>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
<v-divider class="mt-2"></v-divider>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- <template v-slot:append-item>
|
||||
<v-divider class="mb-2"></v-divider>
|
||||
|
||||
<v-list-item :subtitle="subtitle" :title="title" disabled>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar color="primary" icon="mdi-food-apple"></v-avatar>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</template> -->
|
||||
</v-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const items = ref(['foo', 'bar', 'fizz', 'buzz', 'fizzbuzz', 'foobar'])
|
||||
const value = ref(['foo', 'bar', 'fizz'])
|
||||
|
||||
|
||||
const staff = ref([
|
||||
{department: "ОКТП",
|
||||
id: 1,
|
||||
staff: [
|
||||
{fio: 'ГИС'},
|
||||
{fio: 'СВВ'},
|
||||
{fio: 'ФА'},
|
||||
{fio: 'АА'},
|
||||
]
|
||||
},
|
||||
{department: "ОВТП",
|
||||
id: 2,
|
||||
staff: [
|
||||
{fio: 'ЩВ'},
|
||||
{fio: 'ДК'},
|
||||
|
||||
]
|
||||
},
|
||||
]);
|
||||
|
||||
const selectedStaff = ref([]);
|
||||
// const mydialog = computed({
|
||||
// get: () => props.opendialog,
|
||||
// set: (value) => emit('update:opendialog', value)
|
||||
// })
|
||||
|
||||
|
||||
|
||||
const likesAllFruit = computed(() => selectedStaff.value.length === staff.value.length
|
||||
);
|
||||
|
||||
const likesSomeFruit = computed(() => selectedStaff.value.length > 0);
|
||||
|
||||
const title = computed(() => {
|
||||
if (likesAllFruit.value)
|
||||
return "Holy smokes, someone call the fruit police!";
|
||||
if (likesSomeFruit.value) return "Fruit Count";
|
||||
return "How could you not like fruit?";
|
||||
});
|
||||
const subtitle = computed(() => {
|
||||
if (likesAllFruit.value) return undefined;
|
||||
if (likesSomeFruit.value) return selectedStaff.value.length;
|
||||
return "Go ahead, make a selection above!";
|
||||
});
|
||||
|
||||
function toggle() {
|
||||
|
||||
if (likesAllFruit.value) {
|
||||
selectedStaff.value = [];
|
||||
} else {
|
||||
selectedStaff.value = staff.value.slice();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
staff,
|
||||
selectedStaff,
|
||||
likesAllFruit,
|
||||
likesSomeFruit,
|
||||
title,
|
||||
subtitle,
|
||||
toggle,
|
||||
|
||||
items,
|
||||
value
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.max-height-select .v-field__input {
|
||||
max-height: 60px; /* Установите желаемую максимальную высоту */
|
||||
overflow-y: auto; /* Добавьте прокрутку, если список превышает максимальную высоту */
|
||||
overflow-x: hidden;
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_create_event" max-width="636">
|
||||
<v-dialog v-model="dialog_create_calendar" max-width="636">
|
||||
<v-card height="436" class="pa-3">
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
Новый календарь
|
||||
@@ -7,7 +7,7 @@
|
||||
icon="mdi-close cursor-pointer"
|
||||
size="small"
|
||||
color="grey"
|
||||
@click="dialog_create_event = false"
|
||||
@click="dialog_create_calendar = false"
|
||||
></v-icon>
|
||||
</v-card-title>
|
||||
<v-card-text class="d-flex py-0 px-3">
|
||||
@@ -32,27 +32,25 @@
|
||||
<v-col v-for="(x, key) in color" :key="key">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@click="colorPik(x.color, key)"
|
||||
@click="colorPik(x, key)"
|
||||
size="x-small"
|
||||
:color="x.color"
|
||||
:variant="newcalendar.cl_color===null?'flat': newcalendar.cl_color===x.color ?'flat': 'tonal'"
|
||||
:color="x"
|
||||
:variant="
|
||||
newcalendar.cl_color === null
|
||||
? 'flat'
|
||||
: newcalendar.cl_color === x
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
{{color}}
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<!-- <v-select
|
||||
v-model="value"
|
||||
:items="items"
|
||||
label="Выберите из списка или найдите по ФИО"
|
||||
chips
|
||||
multiple
|
||||
hide-details
|
||||
></v-select> -->
|
||||
</v-col
|
||||
<calendar-create-select /> </v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
@@ -74,7 +72,7 @@
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="dialog_create_event = false"
|
||||
@click="dialog_create_calendar = false"
|
||||
>Отменить</v-btn
|
||||
>
|
||||
<v-btn
|
||||
@@ -115,8 +113,11 @@
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
|
||||
export default {
|
||||
components: { calendarCreateSelect },
|
||||
|
||||
props: {
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
@@ -125,91 +126,98 @@ export default {
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
// 1. ПОчему фигурируют эвенты при создании календарей?
|
||||
// 2. Мне кажется, должен быть цвет по умолчанию в любом случае -- как без цвета отрисовывать потом на календаре? Но то ладно
|
||||
const dialog_create_event = computed({
|
||||
const dialog_create_calendar = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
// get_calendars
|
||||
// const confirmation = () => {
|
||||
|
||||
const calendar = ref([
|
||||
{
|
||||
cl_color: "#F44336",
|
||||
cl_descr: "Малюсенький календарь",
|
||||
cl_name: "Мой первый календарь",
|
||||
editor: true,
|
||||
participant: [
|
||||
{ editor: 0, user: 107 },
|
||||
{ editor: 1, user: 125 },
|
||||
],
|
||||
events: {
|
||||
date_end: "2024-06-29T12:20:28+03:00",
|
||||
date_start: "2024-05-29T12:20:24+03:00",
|
||||
description: "Описание такое описание",
|
||||
event: 1,
|
||||
id: 1,
|
||||
name: "Первое событие в календаре",
|
||||
period: null,
|
||||
},
|
||||
id: 1,
|
||||
},
|
||||
]);
|
||||
|
||||
// const getMyCalendar = () => {
|
||||
// axiosApiInstance
|
||||
// .get(`api/calendar_of_events/createEvents/`)
|
||||
// .get(`api/calendar_of_events/get_calendars/`)
|
||||
// .then((data) => {
|
||||
// console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
// });
|
||||
// };
|
||||
// я бы убрал наверное объект в просто массив цветов без ключей
|
||||
const color = ref([
|
||||
{ color: "#F44336", ton: false },
|
||||
{ color: "#E91E63", ton: false },
|
||||
{ color: "#FF5722", ton: false },
|
||||
{ color: "#FFC107", ton: false },
|
||||
{ color: "#FFEB3B", ton: false },
|
||||
{ color: "#CDDC39", ton: false },
|
||||
{ color: "#8BC34A", ton: false },
|
||||
{ color: "#4CAF50", ton: false },
|
||||
{ color: "#00BCD4", ton: false },
|
||||
{ color: "#03A9F4", ton: false },
|
||||
{ color: "#2196F3", ton: false },
|
||||
{ color: "#3F51B5", ton: false },
|
||||
{ color: "#673AB7", ton: false },
|
||||
{ color: "#9C27B0", ton: false },
|
||||
{ color: "#607D8B", ton: false },
|
||||
{ color: "#795548", ton: false },
|
||||
]);
|
||||
// Лишнее усложнение
|
||||
// const colorPik = (col, key) => {
|
||||
|
||||
// color.value.map((e, k) => {
|
||||
// // e.ton = false
|
||||
|
||||
// if (k != key ) {
|
||||
// e.ton = !color.value[k].ton;
|
||||
// }
|
||||
|
||||
|
||||
// else if ((k == key) && color.value[k].ton == true ) {
|
||||
// e.ton = false
|
||||
// console.log(k, key, color.value[k].ton, 'kuku');
|
||||
// }
|
||||
// console.log(k, key, color.value[k].ton)
|
||||
|
||||
// });
|
||||
// getMyCalendar();
|
||||
|
||||
// console.log(color, key, "col");
|
||||
// get_calendars
|
||||
// const confirmation = () => {
|
||||
// axiosApiInstance
|
||||
// .get(`api/calendar_of_events/employee/`)
|
||||
// .then((data) => {
|
||||
// console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
// });
|
||||
// };
|
||||
|
||||
// вместо этого
|
||||
const colorPik = (col)=>{
|
||||
|
||||
if(newcalendar.value.cl_color===col){
|
||||
newcalendar.value.cl_color=null
|
||||
}else{newcalendar.value.cl_color=col
|
||||
// confirmation()
|
||||
|
||||
const color = ref([
|
||||
"#F44336",
|
||||
"#E91E63",
|
||||
"#FF5722",
|
||||
"#FFC107",
|
||||
"#FFEB3B",
|
||||
"#CDDC39",
|
||||
"#8BC34A",
|
||||
"#4CAF50",
|
||||
"#00BCD4",
|
||||
"#03A9F4",
|
||||
"#2196F3",
|
||||
"#3F51B5",
|
||||
"#673AB7",
|
||||
"#9C27B0",
|
||||
"#607D8B",
|
||||
"#795548",
|
||||
]);
|
||||
|
||||
const colorPik = (col) => {
|
||||
if (newcalendar.value.cl_color === col) {
|
||||
newcalendar.value.cl_color = null;
|
||||
} else {
|
||||
newcalendar.value.cl_color = col;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// почему запрос запускается при загрузке
|
||||
// confirmation();
|
||||
|
||||
const newcalendar = ref({
|
||||
cl_name: "",
|
||||
cl_color: null,
|
||||
cl_color: "#F44336",
|
||||
cl_descr: "",
|
||||
patrcipant_calendar: [],
|
||||
});
|
||||
|
||||
return {
|
||||
dialog_create_event,
|
||||
dialog_create_calendar,
|
||||
newcalendar,
|
||||
color,
|
||||
colorPik,
|
||||
calendar,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-list density="compact">
|
||||
<v-list density="compact" class="calen">
|
||||
<v-list-group value="Admin">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-bind="props">
|
||||
@@ -19,18 +19,28 @@
|
||||
</template>
|
||||
|
||||
<v-list-item
|
||||
v-for="(x, i) in mycalendar"
|
||||
v-for="(x, i) in calendar"
|
||||
:key="i"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:title="x.cl_name"
|
||||
:value="x.cl_name"
|
||||
@click.stop=""
|
||||
>
|
||||
<template v-slot:prepend="{ isActive }">
|
||||
<template v-slot:append>
|
||||
|
||||
<v-btn
|
||||
size="x-small"
|
||||
icon="mdi-pen"
|
||||
variant="text"
|
||||
@click.stop="editCreatedCalendar(x.id)"
|
||||
></v-btn>
|
||||
</template>
|
||||
<!-- <template v-slot:prepend="{ isActive }">
|
||||
<v-checkbox-btn
|
||||
:color="x.color"
|
||||
:model-value="isActive"
|
||||
v-model="x.chek"
|
||||
/>
|
||||
</template>
|
||||
</template> -->
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
<calendar-create
|
||||
@@ -42,7 +52,7 @@
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import calendarCreate from "./calendar-create.vue";
|
||||
import calendarCreate from "@/components/calendar_of_events/calendar-create.vue";
|
||||
|
||||
export default {
|
||||
components: { calendarCreate },
|
||||
@@ -53,6 +63,34 @@ export default {
|
||||
{ name: "Дни рождения", chek: true, id: 0, color: "yellow" },
|
||||
];
|
||||
|
||||
const editCreatedCalendar = (id) => {
|
||||
console.log(id, '-----------------')
|
||||
showDialog.value = true
|
||||
}
|
||||
|
||||
const calendar = ref([
|
||||
{
|
||||
cl_color: "#F44336",
|
||||
cl_descr: "Малюсенький календарь",
|
||||
cl_name: "Мой первый календарь",
|
||||
editor: true,
|
||||
participant : [
|
||||
{editor:0, user: 107},
|
||||
{editor: 1, user: 125}
|
||||
],
|
||||
events:{
|
||||
date_end: "2024-06-29T12:20:28+03:00",
|
||||
date_start: "2024-05-29T12:20:24+03:00",
|
||||
description: "Описание такое описание",
|
||||
event: 1,
|
||||
id: 1,
|
||||
name: "Первое событие в календаре",
|
||||
period: null
|
||||
},
|
||||
id: 1
|
||||
}]
|
||||
)
|
||||
|
||||
const mycalendar = ref([
|
||||
{ name: "Портал ЦОД2", chek: false, id: 1, color: "red" },
|
||||
{ name: "Личный календарь", chek: true, id: 2, color: "green" },
|
||||
@@ -63,9 +101,21 @@ export default {
|
||||
subscribe,
|
||||
selected,
|
||||
showDialog,
|
||||
calendar,
|
||||
editCreatedCalendar
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style>
|
||||
|
||||
.calen .v-list-group--prepend {
|
||||
--parent-padding: 0px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.calen .v-list-item-title {
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
@@ -22,15 +22,15 @@ export default {
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
const confirmation = () => {
|
||||
axiosApiInstance
|
||||
.get(`api/calendar_of_events/createEvents/`)
|
||||
.then((data) => {
|
||||
console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
});
|
||||
};
|
||||
// const confirmation = () => {
|
||||
// axiosApiInstance
|
||||
// .get(`api/calendar_of_events/createEvents/`)
|
||||
// .then((data) => {
|
||||
// console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
// });
|
||||
// };
|
||||
|
||||
confirmation()
|
||||
// confirmation()
|
||||
|
||||
return {
|
||||
dialog_create_event,
|
||||
|
||||
Reference in new issue
Block a user