P-47
This commit is contained in:
1 parent
11f45daf67
commit
41ec40fedb
9 files changed
+199
-101
No files matched your search
@@ -96,7 +96,7 @@ export default {
|
||||
JSON.stringify({ ...form.value, vacancy_id: props.idVacations })
|
||||
);
|
||||
if (file.value !== null) {
|
||||
console.log(file.value, 'file.valuefile.valuefile.value')
|
||||
|
||||
postFile.append("file", file.value[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,14 +152,9 @@ export default {
|
||||
.then((res) => {
|
||||
eventFromCalendar.value = res.data
|
||||
if (idEvent.value==null) {
|
||||
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: "", date_end: "", period: null, description: '', calendar: null}
|
||||
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: new Date(), date_end: new Date(), period: null, description: '', calendar: null}
|
||||
}
|
||||
|
||||
// res.data.forEach(
|
||||
// (e) =>
|
||||
// (e.visible = accountStore.calendar.includes(e.id) ? false : true)
|
||||
// );
|
||||
// calendarForMy.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
border
|
||||
no-time
|
||||
:max="new Date(max_date)"
|
||||
:min="new Date(min_date)"
|
||||
:min="new Date(min_date).setDate(new Date(min_date).getDate()-1)"
|
||||
></v-date-picker>
|
||||
</v-locale-provider>
|
||||
</v-menu>
|
||||
@@ -86,12 +86,12 @@ export default {
|
||||
default: "2024-07-01",
|
||||
},
|
||||
max_date: {
|
||||
type: Date,
|
||||
default: new Date('2555-07-01')
|
||||
type: String,
|
||||
default: '2555-07-01'
|
||||
},
|
||||
min_date: {
|
||||
type: Date,
|
||||
default: new Date("1970-01-01")
|
||||
type: String,
|
||||
default: "1970-01-01"
|
||||
},
|
||||
|
||||
order: {
|
||||
@@ -106,7 +106,8 @@ export default {
|
||||
|
||||
const myDate = computed({
|
||||
get() {
|
||||
return new Date(props.date);
|
||||
|
||||
return props.date;
|
||||
},
|
||||
set(newValue) {
|
||||
// console.log( , 'newValue')
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-chip>
|
||||
<span> {{ item.title }}</span>
|
||||
|
||||
|
||||
<v-icon
|
||||
v-if="item.value != accountStore.user.is_idEmployee"
|
||||
icon="mdi-close-circle"
|
||||
@@ -32,7 +32,7 @@
|
||||
<template v-slot:prepend-item>
|
||||
<v-list-item
|
||||
@click="selectedStaff = staffed"
|
||||
:disabled="staffed.length == 1 && staffed[0][okey] == true"
|
||||
:disabled="disable()"
|
||||
class="text-body-2"
|
||||
>
|
||||
<span class="text-body-2"> ВСЕ СОТРУДНИКИ </span>
|
||||
@@ -55,7 +55,7 @@
|
||||
@click.stop=""
|
||||
density="compact"
|
||||
class="text-body-2"
|
||||
:disabled="staffed.length == 1 && staffed[0][okey] == true"
|
||||
:disabled="disable()"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-checkbox-btn
|
||||
@@ -67,11 +67,7 @@
|
||||
item.raw.employees.some((e) => e[okey] == true) &&
|
||||
!item.raw.employees.every((e) => e[okey] == true)
|
||||
"
|
||||
:model-value="
|
||||
staffed.length == 1 && staffed[0][okey] == true
|
||||
? true
|
||||
: item.raw[okey]
|
||||
"
|
||||
:model-value="disable() ? true : item.raw[okey]"
|
||||
></v-checkbox-btn>
|
||||
</template>
|
||||
</v-list-item>
|
||||
@@ -173,12 +169,12 @@ export default {
|
||||
staff: item.employees,
|
||||
});
|
||||
} else if (item.length) {
|
||||
console.log(item, 'newvalue')
|
||||
let val = item.every((e) => e[props.okey] == true) ? false : true;
|
||||
cbstaff(item, val);
|
||||
|
||||
emit("returnIdParticant", { okey: props.okey, staff: back.value });
|
||||
} else {
|
||||
|
||||
item[props.okey] = !item[props.okey];
|
||||
|
||||
emit("returnIdParticant", { okey: props.okey, staff: [item] });
|
||||
@@ -186,10 +182,8 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const cbstaff = (item, value) => {
|
||||
item.forEach((e) => {
|
||||
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
e[props.okey] = value;
|
||||
}
|
||||
@@ -201,10 +195,8 @@ export default {
|
||||
cbstaff(e.employees, value);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
function onFilter(item, itemText) {
|
||||
return (
|
||||
item.includes(filtered.value) ||
|
||||
@@ -214,6 +206,14 @@ export default {
|
||||
);
|
||||
}
|
||||
|
||||
const disable = () => {
|
||||
|
||||
return (
|
||||
staffed.value.length == 1 && staffed.value[0].employees.length == 1
|
||||
);
|
||||
// return false
|
||||
};
|
||||
|
||||
return {
|
||||
staffed,
|
||||
filtered,
|
||||
@@ -221,6 +221,7 @@ export default {
|
||||
selectedStaff,
|
||||
splitname,
|
||||
onFilter,
|
||||
disable,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
<dialog-create
|
||||
:title="titleCard"
|
||||
:newOrOld="newEvent"
|
||||
@postData="postData"
|
||||
@closeDialog="$emit('closeDialog')"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<my-helper :pretext="propsEvent.event" />
|
||||
<my-helper :pretext="propsEvent" />
|
||||
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
@@ -85,29 +86,26 @@
|
||||
Дата и время
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
|
||||
<time-select
|
||||
:date="propsEvent.event.date_start"
|
||||
:max_date ="new Date(propsEvent.event.date_end)"
|
||||
@update:date="propsEvent.event.date_start = $event"
|
||||
:order="[2,1]"
|
||||
/>
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<v-col class="order-3 flex-grow-0">
|
||||
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||
</v-col>
|
||||
|
||||
<time-select
|
||||
:date="propsEvent.event.date_end"
|
||||
:order="[4,5]"
|
||||
:min_date ="new Date(propsEvent.event.date_start).setDate(new Date(propsEvent.event.date_start).getDate()-1)"
|
||||
@update:date="propsEvent.event.date_end = $event"
|
||||
/>
|
||||
|
||||
|
||||
</v-row>
|
||||
<v-row no-gutters class="gap">
|
||||
<time-select
|
||||
:date="propsEvent.event.date_start"
|
||||
:max_date="propsEvent.event.date_end"
|
||||
@update:date="propsEvent.event.date_start = $event"
|
||||
:order="[2, 1]"
|
||||
/>
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<v-col class="order-3 flex-grow-0">
|
||||
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||
</v-col>
|
||||
|
||||
<time-select
|
||||
:date="propsEvent.event.date_end"
|
||||
:order="[4, 5]"
|
||||
:min_date="propsEvent.event.date_start"
|
||||
@update:date="propsEvent.event.date_end = $event"
|
||||
/>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
@@ -123,18 +121,39 @@
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Файлы
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-file-input
|
||||
label="File input w/ chips"
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Файлы </v-col>
|
||||
<v-col>
|
||||
<v-file-input
|
||||
label="Файлы"
|
||||
chips
|
||||
multiple
|
||||
v-model="eventFiles"
|
||||
variant="outlined"
|
||||
>
|
||||
</v-file-input>
|
||||
<!-- <v-file-input
|
||||
label="Файлы"
|
||||
chips
|
||||
multiple
|
||||
v-model="eventFiles"
|
||||
></v-file-input>
|
||||
</v-col
|
||||
></v-row>
|
||||
>
|
||||
<template v-slot:selection="{ fileNames }">
|
||||
<v-chip v-for="x in fileNames" :key=x>
|
||||
<span> {{ x }}</span>
|
||||
|
||||
<v-icon
|
||||
|
||||
icon="mdi-close-circle"
|
||||
size="x-small"
|
||||
class="ml-3"
|
||||
@click="proverka()"
|
||||
/>
|
||||
</v-chip>
|
||||
</template>
|
||||
|
||||
</v-file-input> -->
|
||||
</v-col></v-row
|
||||
>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col>
|
||||
<v-textarea
|
||||
@@ -156,9 +175,9 @@ import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import { formatComa, get_name } from "@/utils/universal_functions";
|
||||
import TimeSelect from "@/components/calendar_of_events/UI_calendar/timeSelect.vue";
|
||||
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
export default {
|
||||
components: { calendarCreateSelect, DialogCreate, TimeSelect },
|
||||
|
||||
@@ -184,51 +203,99 @@ export default {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
});
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
const newStaff = computed({
|
||||
get() {
|
||||
|
||||
let ns = []
|
||||
let indCal = propsEvent.value.mycalendars.findIndex(e=>e.id ==propsEvent.value.event.calendar )
|
||||
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
if (propsEvent.value.event.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
let ab = propsEvent.value.event.participant.find(
|
||||
(a) => a === empl.id
|
||||
);
|
||||
if (ab) {
|
||||
empl.selected = true;
|
||||
} else {
|
||||
empl.selected = false;
|
||||
}
|
||||
});
|
||||
let emp = { ...e };
|
||||
emp.employees = e.employees.filter((n) =>
|
||||
{
|
||||
if (n.id ==accountStore.user.is_idEmployee) {
|
||||
n.selected = true
|
||||
}
|
||||
|
||||
return propsEvent.value.mycalendars[indCal].participant.some(part => part.id === n.id)
|
||||
// == n.id
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
if (emp.employees.length > 0) ns.push(emp)
|
||||
|
||||
// if (propsEvent.value.event.participant.length > 0) {
|
||||
// e.employees.forEach((empl) => {
|
||||
// let ab = propsEvent.value.event.participant.find(
|
||||
// (a) => a === empl.id
|
||||
// );
|
||||
// if (ab) {
|
||||
// empl.selected = true;
|
||||
// } else {
|
||||
// empl.selected = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
});
|
||||
|
||||
return staff.value;
|
||||
return ns;
|
||||
},
|
||||
});
|
||||
|
||||
function dataURLtoFile(dataurl, filename) {
|
||||
var arr = dataurl.split(","),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]),
|
||||
n = bstr.length,
|
||||
u8arr = new Uint8Array(n);
|
||||
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
}
|
||||
|
||||
return new File([u8arr], filename, { type: mime });
|
||||
}
|
||||
|
||||
const files = ref([]);
|
||||
|
||||
const eventFiles = computed({
|
||||
get() {
|
||||
console.log(propsEvent.value.event.files)
|
||||
return propsEvent.value.event.files
|
||||
if (propsEvent.value.event.files.length > 0) {
|
||||
propsEvent.value.event.files.forEach((e) =>
|
||||
files.value.push(
|
||||
dataURLtoFile(
|
||||
"data:text/plain;base64,aGVsbG8gd29ybGQ=",
|
||||
get_name(decodeURI(e.file))
|
||||
)
|
||||
)
|
||||
);
|
||||
// let file = dataURLtoFile(
|
||||
// "data:text/plain;base64,aGVsbG8gd29ybGQ=",
|
||||
// get_name(
|
||||
// decodeURI(propsEvent.value.event.files[0].file)
|
||||
// )
|
||||
// );
|
||||
|
||||
}
|
||||
,
|
||||
// files.value.push(file);
|
||||
}
|
||||
|
||||
return files.value;
|
||||
},
|
||||
set(newValue) {
|
||||
// propsEvent.value.event.files.push(newValue)
|
||||
newValue.forEach((e) => {
|
||||
let ind = propsEvent.value.event.files.findIndex(f => f.name == e.name)
|
||||
console.log(ind, 'ind')
|
||||
if(ind==-1) {
|
||||
propsEvent.value.event.files.push(e)
|
||||
if (!files.value.some((l) => l.name == e.name.split(" ").join("_"))) {
|
||||
files.value.push(e);
|
||||
}
|
||||
else {
|
||||
propsEvent.value.event.files.slice(ind, 0)
|
||||
}
|
||||
|
||||
})
|
||||
console.log(newValue)
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
if (newValue.length == 0) {
|
||||
files.value = [];
|
||||
propsEvent.value.event.files = [];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const calendar = computed({
|
||||
get() {
|
||||
@@ -280,7 +347,7 @@ export default {
|
||||
|
||||
// propsEvent.value.event.participant.push(e.id)
|
||||
);
|
||||
console.log(idPart, "idPart");
|
||||
|
||||
};
|
||||
|
||||
const dateEvent = computed({
|
||||
@@ -290,7 +357,7 @@ export default {
|
||||
|
||||
set(newValue) {
|
||||
let dateParts = newValue.split(".");
|
||||
console.log(dateParts, timeEvent.value, "1111111111111111111111111111");
|
||||
|
||||
// let d = new Date(propsEvent.value.event.date_start).setFullYear(parseInt(dateParts[2], 10), parseInt(dateParts[1], 10), parseInt(dateParts[0], 10))
|
||||
// let d = new Date(propsEvent.value.event.date_start).setDate(new Date(2024,01,01))
|
||||
// propsEvent.value.event.date_start = new Date(2024,01,01);
|
||||
@@ -299,6 +366,26 @@ export default {
|
||||
|
||||
const menudate = ref(false);
|
||||
|
||||
const postData = (validate) => {
|
||||
let postEvent = new FormData();
|
||||
postEvent.append("event", JSON.stringify({ ...propsEvent.value.event }));
|
||||
if (propsEvent.value.event.files !== null) {
|
||||
|
||||
files.value.forEach((e) => postEvent.append("files", e));
|
||||
// postEvent.append("files", propsEvent.value.event.files[0]);
|
||||
}
|
||||
|
||||
axiosApiInstance
|
||||
.post("api/calendar_of_events/my_events/", postEvent)
|
||||
.then((res) => {
|
||||
console.log(res, "res");
|
||||
});
|
||||
};
|
||||
|
||||
const proverka = () => {
|
||||
console.log("Проверка");
|
||||
};
|
||||
|
||||
return {
|
||||
menudate,
|
||||
titleCard,
|
||||
@@ -309,7 +396,10 @@ export default {
|
||||
staff,
|
||||
newStaff,
|
||||
returnIdParticant,
|
||||
eventFiles
|
||||
eventFiles,
|
||||
postData,
|
||||
files,
|
||||
proverka,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,6 +8,10 @@ import moment from "moment";
|
||||
import { ref, onMounted } from "vue";
|
||||
|
||||
|
||||
export function get_name(namestr) {
|
||||
let arr = namestr.split("/");
|
||||
return arr[arr.length - 1];
|
||||
};
|
||||
|
||||
export function formatComa(date) {
|
||||
return moment(date).format("DD.MM.YYYY");
|
||||
|
||||
@@ -134,7 +134,7 @@ import { ref, computed } from "vue";
|
||||
import { axiosApiInstance, baseURL, spravURLBase } from "@/utils/axios-api";
|
||||
import { saveAs } from "file-saver";
|
||||
import VuePdfEmbed from "vue-pdf-embed";
|
||||
|
||||
import { get_name } from "@/utils/universal_functions";
|
||||
export default {
|
||||
props: {
|
||||
docSections: {
|
||||
@@ -183,10 +183,7 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
const get_name = (namestr) => {
|
||||
let arr = namestr.split("/");
|
||||
return arr[arr.length - 1];
|
||||
};
|
||||
|
||||
|
||||
const closeFile = () => {
|
||||
err.value = "Файл не выбран"
|
||||
|
||||
Reference in new issue
Block a user