P-42
This commit is contained in:
1 parent
83b8fa27cf
commit
fc4f4cbc2d
2 files changed
+33
-21
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
{{selected}}
|
||||
<v-autocomplete
|
||||
v-model="selectedStaff"
|
||||
:items="staff"
|
||||
@@ -93,25 +94,40 @@
|
||||
import { ref, computed } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { splitname } from "@/utils/universal_functions";
|
||||
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
props : {
|
||||
participant: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
}},
|
||||
|
||||
|
||||
setup(props, { emit }) {
|
||||
const filtered = ref("");
|
||||
const staff = ref([]);
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
console.log(staff.value, 'staff.value');
|
||||
});
|
||||
|
||||
const selectedStaff = computed(() => {
|
||||
let selected = [];
|
||||
//
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
|
||||
|
||||
if (e.employees.every((n) => n.selected == true)) {
|
||||
e.selected = true;
|
||||
selected.push(e);
|
||||
} else {
|
||||
e.selected = false;
|
||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||
|
||||
selected.push(...e.employees.filter((n) => {n.selected == true }));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
hide-details0
|
||||
hide-details
|
||||
v-model="calendar.cl_name"
|
||||
></v-textarea></v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center pt-3">
|
||||
@@ -38,13 +39,14 @@
|
||||
size="x-small"
|
||||
:color="x"
|
||||
:variant="
|
||||
newcalendar.cl_color === null
|
||||
calendar.cl_color === null
|
||||
? 'flat'
|
||||
: newcalendar.cl_color === x
|
||||
: calendar.cl_color === x
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/> </v-col
|
||||
/>
|
||||
</v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
@@ -52,7 +54,8 @@
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select /> </v-col
|
||||
<calendar-create-select :participant = calendar.participant />
|
||||
</v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
@@ -128,7 +131,7 @@ export default {
|
||||
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: {},
|
||||
default: {cl_name:'', participant: []},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -201,27 +204,20 @@ export default {
|
||||
];
|
||||
|
||||
const colorPik = (col) => {
|
||||
if (newcalendar.value.cl_color === col) {
|
||||
newcalendar.value.cl_color = null;
|
||||
if (props.calendar.cl_color === col) {
|
||||
props.calendar.cl_color = null;
|
||||
} else {
|
||||
newcalendar.value.cl_color = col;
|
||||
props.calendar.cl_color = col;
|
||||
}
|
||||
};
|
||||
|
||||
// почему запрос запускается при загрузке
|
||||
// confirmation();
|
||||
|
||||
const newcalendar = ref({
|
||||
cl_name: "",
|
||||
// Почему тут этот цвет? ЧЕМ ОН ОТЛИЧАЕТСЯ ОТ COLOR[0]?
|
||||
cl_color: "#F44336",
|
||||
cl_descr: "",
|
||||
participant_calendar: [],
|
||||
});
|
||||
|
||||
|
||||
|
||||
return {
|
||||
dialog_create_calendar,
|
||||
newcalendar,
|
||||
|
||||
color,
|
||||
colorPik,
|
||||
|
||||
|
||||
Reference in new issue
Block a user