P-19
Добавить прикрепленный файл, и пустое значение на случай отстутсвия сопроводительного письма. Данные записываются, обновляются, форма чистится
This commit is contained in:
1 parent
5013b14ed9
commit
fdedd6c637
5 files changed
+86
-79
No files matched your search
@@ -53,6 +53,8 @@ class ResponseVacancy(models.Model):
|
||||
fio = models.CharField(max_length=300, verbose_name='ФИО')
|
||||
cdate = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
|
||||
text = models.TextField(null=True, verbose_name='Сообщение')
|
||||
email = models.CharField(null=True,max_length=300, verbose_name='Почта')
|
||||
tel = models.CharField(null=True,max_length=300, verbose_name='Номер телефона')
|
||||
file = models.FileField(null=True, upload_to='response/%Y/%m/%d', verbose_name='Файл резюме')
|
||||
vacancy = models.ForeignKey(Vacancies, on_delete=models.PROTECT, related_name='get_vacancies', verbose_name='Вакансия')
|
||||
|
||||
|
||||
@@ -47,5 +47,11 @@ class GetVacancies(ListAPIView):
|
||||
|
||||
class PostResponseVacancies(ListAPIView):
|
||||
def post(self, request):
|
||||
print(request.data['resp'],'poooooooooooooost----------------------------------------------')
|
||||
ResponseVacancy.objects.update_or_create(vacancy_id=request.data['id'],
|
||||
defaults={'fio':request.data['resp']['name'],
|
||||
'text':request.data['resp']['message'],
|
||||
'email':request.data['resp']['email'],
|
||||
'tel':request.data['resp']['phone'],
|
||||
})
|
||||
|
||||
return Response('ki')
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-row no-gutters class="h-100 gap" v-if="vacancy.length > 0" >
|
||||
<v-row no-gutters class="h-100 gap" v-if="vacancy.length > 0">
|
||||
<v-col lg="4" class="flex-column d-flex">
|
||||
<v-card class="h-100 pa-1 d-flex flex-column rounded-0">
|
||||
<v-card-title
|
||||
@@ -56,7 +56,11 @@
|
||||
>
|
||||
Описание
|
||||
</v-card-title>
|
||||
<v-row no-gutters class="h-0 gap overflow-auto" id="goto-container-example">
|
||||
<v-row
|
||||
no-gutters
|
||||
class="h-0 gap overflow-auto"
|
||||
id="goto-container-example"
|
||||
>
|
||||
<v-col>
|
||||
<v-card
|
||||
class="rounded-0 h-100"
|
||||
@@ -66,30 +70,27 @@
|
||||
<span class="text-h4 text-wrap">
|
||||
{{ vacancyDescription.name }}
|
||||
</span>
|
||||
|
||||
</v-card-title>
|
||||
|
||||
|
||||
<v-card-title class="pt-0">
|
||||
|
||||
<span class="text-h5">
|
||||
{{ vacancyDescription.department.name }}
|
||||
</span>
|
||||
</v-card-title>
|
||||
<v-card-title>
|
||||
<v-btn
|
||||
type="submit"
|
||||
class="text-subtitle-1 font-weight-light"
|
||||
color="btn_text"
|
||||
elevation=1
|
||||
@click="goTo('#response', { container: '#goto-container-example' })"
|
||||
>
|
||||
Откликнуться
|
||||
</v-btn>
|
||||
|
||||
|
||||
type="submit"
|
||||
class="text-subtitle-1 font-weight-light"
|
||||
color="btn_text"
|
||||
elevation="1"
|
||||
@click="
|
||||
goTo('#response', { container: '#goto-container-example' })
|
||||
"
|
||||
>
|
||||
Откликнуться
|
||||
</v-btn>
|
||||
</v-card-title>
|
||||
<v-card-title class="pt-6">
|
||||
|
||||
<span class="text-h6">
|
||||
Направление деятельности подразделения
|
||||
</span>
|
||||
@@ -106,7 +107,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</v-card-text>
|
||||
<v-card-title >
|
||||
<v-card-title>
|
||||
<span class="text-h6">
|
||||
Функционал и должностные обязанности
|
||||
</span>
|
||||
@@ -121,9 +122,7 @@
|
||||
<div class="py-1" v-html="vacancyDescription.functional"></div>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<response-vacancies id="response"/>
|
||||
|
||||
|
||||
<response-vacancies id="response" :idVacations=vacancySelect />
|
||||
</v-card>
|
||||
|
||||
<v-card
|
||||
@@ -166,7 +165,7 @@
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { useGoTo } from 'vuetify'
|
||||
import { useGoTo } from "vuetify";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import ResponseVacancies from "@/components/about_inspection/open_vacancies/ResponseVacancies.vue";
|
||||
@@ -174,7 +173,7 @@ import ResponseVacancies from "@/components/about_inspection/open_vacancies/Resp
|
||||
export default {
|
||||
components: { ResponseVacancies },
|
||||
setup() {
|
||||
const goTo = useGoTo()
|
||||
const goTo = useGoTo();
|
||||
let vacancyDescription = ref({ name: "", department: { name: "" } });
|
||||
let vacancySelect = ref(-1);
|
||||
|
||||
@@ -184,7 +183,7 @@ export default {
|
||||
clearAxios.get(`api/about_inspection/getvacancy/`).then((data) => {
|
||||
vacancy.value = data.data;
|
||||
vacancyDescription.value = vacancy.value[0];
|
||||
// console.log(, 'data')
|
||||
vacancySelect.value = vacancy.value[0].id
|
||||
});
|
||||
};
|
||||
|
||||
@@ -213,7 +212,7 @@ export default {
|
||||
vacancyDescription,
|
||||
getIndVacation,
|
||||
vacancySelect,
|
||||
goTo
|
||||
goTo,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
<template>
|
||||
|
||||
<v-card>
|
||||
{{}}
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -35,12 +35,8 @@
|
||||
no-resize
|
||||
rows="4"
|
||||
label="Сопроводительное письмо"
|
||||
></v-textarea>
|
||||
<v-file-input
|
||||
label="Резюме"
|
||||
hide-details
|
||||
|
||||
/>
|
||||
<v-file-input label="Резюме" hide-details />
|
||||
<v-btn block type="submit" class="mt-4 text-none" color="btn_text">
|
||||
Отправить
|
||||
</v-btn>
|
||||
@@ -51,43 +47,63 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { useField, useForm } from "vee-validate";
|
||||
import * as yup from "yup";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
|
||||
const { handleSubmit } = useForm({
|
||||
validationSchema: yup.object({
|
||||
email: yup
|
||||
.string()
|
||||
.email("Введите корректный email")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
name: yup
|
||||
.string()
|
||||
.matches(/^[а-яА-ЯЁё]+$/, "Имя должно содержать только русские буквы")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
phone: yup
|
||||
.string()
|
||||
.matches(
|
||||
/^[[\d-]*\d[\d-]*$/,
|
||||
"Номер телефона должен содержать только цифры"
|
||||
)
|
||||
.required("Поле обязательно для заполнения"),
|
||||
message: yup.string(),
|
||||
}),
|
||||
});
|
||||
const name = useField("name");
|
||||
const phone = useField("phone");
|
||||
const email = useField("email");
|
||||
const message = useField("message");
|
||||
|
||||
const submit = handleSubmit((values) => {
|
||||
clearAxios
|
||||
.post(`api/about_inspection/postresponsevacancy/`, { resp: values })
|
||||
.then((data) => {
|
||||
console.log("datas");
|
||||
export default {
|
||||
props: {
|
||||
idVacations: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const { handleSubmit, handleReset } = useForm({
|
||||
validationSchema: yup.object({
|
||||
email: yup
|
||||
.string()
|
||||
.email("Введите корректный email")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
name: yup
|
||||
.string()
|
||||
.matches(/^[а-яА-ЯЁё]+$/, "Имя должно содержать только русские буквы")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
phone: yup
|
||||
.string()
|
||||
.matches(
|
||||
/^[[\d-]*\d[\d-]*$/,
|
||||
"Номер телефона должен содержать только цифры"
|
||||
)
|
||||
.required("Поле обязательно для заполнения"),
|
||||
message: yup.string(),
|
||||
}),
|
||||
});
|
||||
alert(JSON.stringify(values, null, 2));
|
||||
});
|
||||
|
||||
const name = useField("name");
|
||||
const phone = useField("phone");
|
||||
const email = useField("email");
|
||||
const message = useField("message");
|
||||
|
||||
const submit = handleSubmit((values) => {
|
||||
clearAxios
|
||||
.post(`api/about_inspection/postresponsevacancy/`, { resp: values, id: props.idVacations })
|
||||
.then((data) => {
|
||||
|
||||
});
|
||||
handleReset()
|
||||
alert(JSON.stringify(values, null, 2));
|
||||
});
|
||||
|
||||
return {
|
||||
name,
|
||||
phone,
|
||||
email,
|
||||
message,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in new issue
Block a user