P-47 весь объект события до отправки в new FormData()

This commit is contained in:
iriska-gri committed 2024-07-05 15:42:46 +03:00
1 parent d2b6e65d7f
commit 11f45daf67
3 files changed
+114 -67

No files matched your search

@@ -4,7 +4,7 @@
<span class="text-h4">Откликнуться на вакансию</span> <span class="text-h4">Откликнуться на вакансию</span>
</v-card-text> </v-card-text>
<v-card-text class="d-flex flex-column pt-0"> <v-card-text class="d-flex flex-column pt-0">
<v-form ref="form_vacancies" @submit.prevent="submit"> <v-form ref="form_vacancies" @submit.prevent="submit">
<v-row no-gutters class="justify-center"> <v-row no-gutters class="justify-center">
<v-col lg="8"> <v-col lg="8">
<v-text-field <v-text-field
@@ -72,12 +72,12 @@ export default {
fio: [ fio: [
(val) => req(val), (val) => req(val),
(val) => (val) =>
val.match(/^[а-яА-ЯЁё ]+$/) !== null || "хочу имя русскими буквами", val.match(/^[а-яА-ЯЁё ]+$/) !== null || "Имя должно содержать русские буквы",
], ],
email: [(val) => req(val)], email: [(val) => req(val)],
tel: [ tel: [
(val) => req(val), (val) => req(val),
(val) => val.match(/^[[\d-]*\d[\d-]*$/) !== null || "хочу цифрами", (val) => val.match(/^[[\d-]*\d[\d-]*$/) !== null || "Номер должен содержать цифры",
], ],
text: "", text: "",
}; };
@@ -86,6 +86,7 @@ export default {
const form_vacancies = ref(null) const form_vacancies = ref(null)
const submit = () => { const submit = () => {
if(form_vacancies.value.isValid) { if(form_vacancies.value.isValid) {
@@ -95,10 +96,11 @@ export default {
JSON.stringify({ ...form.value, vacancy_id: props.idVacations }) JSON.stringify({ ...form.value, vacancy_id: props.idVacations })
); );
if (file.value !== null) { if (file.value !== null) {
console.log(file.value, 'file.valuefile.valuefile.value')
postFile.append("file", file.value[0]); postFile.append("file", file.value[0]);
} }
// Отправляет сообщение об отправлении при отсутсвии валидации!!!!!!!!!!!!!!!!!!!!!!!!!
clearAxios clearAxios
.post(`api/about_inspection/postresponsevacancy/`, postFile) .post(`api/about_inspection/postresponsevacancy/`, postFile)
.then((data) => { .then((data) => {
@@ -115,6 +117,7 @@ export default {
file, file,
rules, rules,
submit, submit,
form_vacancies
}; };
}, },
}; };
@@ -1,44 +1,7 @@
<template> <template>
<v-row no-gutters class="gap">
<v-col lg="2">
<v-textarea
density="compact"
no-resize
row-height="25"
rows="1"
readonly
variant="outlined"
v-model="timeEvent"
:active="menutime"
:focus="menutime"
>
</v-textarea> <v-col lg=3 :class="`order-${order[0]}`" >
<v-menu
v-model="menutime"
:close-on-content-click="false"
activator="parent"
transition="scale-transition"
>
<v-time-picker
v-if="menutime"
v-model="timeEvent"
full-width
format="24hr"
></v-time-picker>
</v-menu>
<!-- <v-textarea
density="compact"
no-resize
row-height="25"
rows="1"
variant="outlined"
v-model="timeEvent"
></v-textarea> -->
</v-col>
<v-col lg="3">
<v-menu <v-menu
v-model="menudate" v-model="menudate"
:close-on-content-click="false" :close-on-content-click="false"
@@ -75,11 +38,42 @@
hide-header hide-header
border border
no-time no-time
:max="new Date(max_date)"
:min="new Date(min_date)"
></v-date-picker> ></v-date-picker>
</v-locale-provider> </v-locale-provider>
</v-menu> </v-menu>
</v-col> </v-col>
</v-row> <v-col class="flex-grow-0 " :class="`order-${order[1]}`">
<v-textarea
density="compact"
no-resize
row-height="25"
width="75"
rows="1"
readonly
variant="outlined"
v-model="timeEvent"
:active="menutime"
:focus="menutime"
>
</v-textarea>
<v-menu
v-model="menutime"
:close-on-content-click="false"
activator="parent"
transition="scale-transition"
>
<v-time-picker
v-if="menutime"
v-model="timeEvent"
full-width
format="24hr"
></v-time-picker>
</v-menu>
</v-col>
</template> </template>
<script> <script>
@@ -91,6 +85,19 @@ export default {
type: String, type: String,
default: "2024-07-01", default: "2024-07-01",
}, },
max_date: {
type: Date,
default: new Date('2555-07-01')
},
min_date: {
type: Date,
default: new Date("1970-01-01")
},
order: {
type: Array,
default: [0, 0]
}
}, },
setup(props, { emit }) { setup(props, { emit }) {
@@ -85,18 +85,29 @@
Дата и время Дата и время
</v-col> </v-col>
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-row no-gutters class="gap">
<time-select <time-select
:date="propsEvent.event.date_start" :date="propsEvent.event.date_start"
@update:date ="propsEvent.event.date_start = $event" :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 <time-select
:date="propsEvent.event.date_end" :date="propsEvent.event.date_end"
@update:date ="propsEvent.event.date_end = $event" :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> <v-row no-gutters>
<v-col> <v-col>
<v-textarea <v-textarea
@@ -111,7 +122,19 @@
</v-row> </v-col </v-row> </v-col
></v-row> ></v-row>
</v-col> </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"
chips
multiple
v-model="eventFiles"
></v-file-input>
</v-col
></v-row>
<v-row no-gutters class="align-center"> <v-row no-gutters class="align-center">
<v-col> <v-col>
<v-textarea <v-textarea
@@ -134,7 +157,7 @@ import { axiosApiInstance } from "@/utils/axios-api";
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue"; import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue"; import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
import { formatComa } from "@/utils/universal_functions"; import { formatComa } from "@/utils/universal_functions";
import TimeSelect from '@/components/calendar_of_events/UI_calendar/timeSelect.vue'; import TimeSelect from "@/components/calendar_of_events/UI_calendar/timeSelect.vue";
export default { export default {
components: { calendarCreateSelect, DialogCreate, TimeSelect }, components: { calendarCreateSelect, DialogCreate, TimeSelect },
@@ -182,11 +205,30 @@ export default {
}, },
}); });
// const getTime = computed({ const eventFiles = computed({
// get() { get() {
console.log(propsEvent.value.event.files)
return propsEvent.value.event.files
// } }
// }) ,
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)
}
else {
propsEvent.value.event.files.slice(ind, 0)
}
})
console.log(newValue)
}
})
const calendar = computed({ const calendar = computed({
get() { get() {
@@ -241,24 +283,19 @@ export default {
console.log(idPart, "idPart"); console.log(idPart, "idPart");
}; };
const dateEvent = computed({ const dateEvent = computed({
get() { get() {
return formatComa(new Date(propsEvent.value.event.date_start));
return formatComa(new Date(propsEvent.value.event.date_start))
}, },
set(newValue) { set(newValue) {
let dateParts = newValue.split("."); let dateParts = newValue.split(".");
console.log(dateParts, timeEvent.value, '1111111111111111111111111111') 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).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)) // 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); // propsEvent.value.event.date_start = new Date(2024,01,01);
},
} });
})
const menudate = ref(false); const menudate = ref(false);
@@ -272,7 +309,7 @@ export default {
staff, staff,
newStaff, newStaff,
returnIdParticant, returnIdParticant,
eventFiles
}; };
}, },
}; };