diff --git a/src/front/src/components/calendar_of_events/calendar-create-select copy.vue b/src/front/src/components/calendar_of_events/calendar-create-select copy.vue
new file mode 100644
index 000000000..263ee45e0
--- /dev/null
+++ b/src/front/src/components/calendar_of_events/calendar-create-select copy.vue
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+ {{ item.value }}
+
+
+
+
+
+
+ ВСЕ СОТРУДНИКИ
+
+
+ {{selectedStaff}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ x.fio }}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/front/src/components/calendar_of_events/calendar-create-select.vue b/src/front/src/components/calendar_of_events/calendar-create-select.vue
index 9d81693fd..f45be7143 100644
--- a/src/front/src/components/calendar_of_events/calendar-create-select.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create-select.vue
@@ -12,39 +12,23 @@
class="max-height-select"
return-object
>
-
-
-
- {{ item.value }}
+ {{ item.title }}
-
-
+
@@ -55,7 +39,6 @@
density="compact"
class="text-body-2"
>
-
@@ -69,15 +52,6 @@
{{ x.fio }}
-
@@ -87,18 +61,29 @@ import { ref, onMounted, computed } from "vue";
export default {
setup() {
-
-
const staff = ref([
{
department: "ОКТП",
id: 1,
- staff: [{ fio: "ГИС", id: 1 }, { fio: "СВВ", id: 2 }, { fio: "ФА", id: 3 }, { fio: "АА", id: 4 }],
+ staff: [
+ { fio: "ГИС", id: 1 },
+ { fio: "СВВ", id: 2 },
+ { fio: "ФА", id: 3 },
+ { fio: "АА", id: 4 },
+ ],
+ },
+ {
+ department: "ОВТП",
+ id: 2,
+ staff: [
+ { fio: "ЩВ", id: 1 },
+ { fio: "ДК", id: 2 },
+ ],
},
- { department: "ОВТП", id: 2, staff: [{ fio: "ЩВ", id: 1 }, { fio: "ДК", id: 2 }] },
]);
const selectedStaff = ref([]);
+ const selectDepartnment = ref({});
const allStaff = computed(
() => selectedStaff.value.length === staff.value.length
@@ -115,16 +100,89 @@ export default {
}
function selectFIO(user, dep) {
- let ob = staff.value.find(el => el.id == dep)
+ staff.value.forEach((e) => {
+ if (!selectDepartnment.value[e.id]) {
+ selectDepartnment.value[e.id] = [];
+ }
+ });
+ // selectDepartnment.forEach((e) => {
- ob['chek'] = false
- let indx = selectedStaff.value.findIndex((i) => i.id == dep)
- if (indx ==-1) {
- selectedStaff.value.push(ob)
- }
-
-
- console.log(ob, 'ki')
+ // if (!ob[e.author.id]) {
+ // ob[e.author.id] = 0
+ // }
+ // ob[e.author.id] += 1
+ // })
+
+ let ob = staff.value.find((el) => el.id == dep);
+
+ if(selectDepartnment.value[dep].includes(user.fio)) {
+ let inddep = selectDepartnment.value[dep].indexOf(user.fio)
+ selectDepartnment.value[dep].splice(inddep, 1);
+ }
+ else {
+ selectDepartnment.value[dep].push(user.fio)
+
+ // if(selectDepartnment.value[dep].length == ob.staff.length){
+ // selectDepartnment.value[dep]['dep'] = ob.department
+ // }
+ // else {
+ // selectDepartnment.value[dep]['dep'] = ''
+ // }
+
+ }
+
+ if (selectedStaff.value.includes(user.fio)) {
+ let index = selectedStaff.value.indexOf(user.fio);
+ selectedStaff.value.splice(index, 1);
+ }
+ else {
+ if (selectDepartnment.value[dep].length == ob.staff.length) {
+ selectedStaff.value.filter( ( el ) => !~selectDepartnment.value[dep].indexOf( el ) )
+ selectedStaff.value.push(ob.department)
+
+ }
+ else {
+ selectedStaff.value.push(user.fio);
+ }
+ //
+ }
+ // selectedStaff.value = selectDepartnment.value[dep]
+ // console.log(selectedStaff.value, '------------');
+ // selectedStaff.value.push(selectDepartnment.value[dep])
+
+ // if (selectedStaff.value.includes(user.fio)) {
+
+ // let index = selectedStaff.value.indexOf(user.fio);
+ // selectedStaff.value.splice(index, 1);
+
+ // let inddep = selectDepartnment.value[dep].indexOf(user.fio)
+ // selectDepartnment.value[dep].splice(inddep, 1);
+
+
+ // } else {
+ // selectDepartnment.value[dep].push(user.fio);
+ // if (selectDepartnment.value[dep].length == ob.staff.length) {
+ // selectDepartnment.value[dep] = []
+ // selectedStaff.value.push(ob.department);
+
+ // } else {
+ // selectedStaff.value.push(user.fio);
+ // }
+ // }
+ console.log(selectedStaff.value, 'selectedStaff.valueselectedStaff.value')
+ console.log(selectDepartnment.value, selectDepartnment.value[dep].length == ob.staff.length, "11111111111111111");
+ //
+ // userDep.department = ob.department
+ // userDep.staff = user
+
+ // ob['chek'] = false
+ // let indx = selectedStaff.value.findIndex((i) => i.id == dep)
+ // if (indx ==-1) {
+
+ // selectedStaff.value.push(ob)
+ // }
+
+ // console.log(userDep, 'ki')
}
return {
@@ -133,10 +191,8 @@ export default {
allStaff,
onePlusStaff,
selectFIO,
-
+ selectDepartnment,
toggle,
-
-
};
},
};