mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
подствеление отдела авто2
This commit is contained in:
@@ -20,34 +20,6 @@
|
|||||||
<h1 class="text-2xl font-bold mb-6">Создание заявки</h1>
|
<h1 class="text-2xl font-bold mb-6">Создание заявки</h1>
|
||||||
|
|
||||||
<form @submit.prevent="handleSubmit" class="space-y-6 bg-card rounded-lg shadow-lg p-6">
|
<form @submit.prevent="handleSubmit" class="space-y-6 bg-card rounded-lg shadow-lg p-6">
|
||||||
<div>
|
|
||||||
<label for="title" class="block text-sm font-medium text-secondary mb-1">Заголовок</label>
|
|
||||||
<input
|
|
||||||
id="title"
|
|
||||||
v-model="formData.title"
|
|
||||||
type="text"
|
|
||||||
class="w-full px-4 py-2 rounded-lg bg-input text-primary border border-input-border focus:border-button-primary transition-colors"
|
|
||||||
required
|
|
||||||
placeholder="Краткое описание проблемы"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="department" class="block text-sm font-medium text-secondary mb-1">Отдел</label>
|
|
||||||
<select
|
|
||||||
id="department"
|
|
||||||
v-model="formData.department"
|
|
||||||
class="w-full px-4 py-2 rounded-lg bg-input text-primary border border-input-border focus:border-button-primary transition-colors"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="">Выберите отдел</option>
|
|
||||||
<option value="IT">IT</option>
|
|
||||||
<option value="HR">HR</option>
|
|
||||||
<option value="Finance">Финансы</option>
|
|
||||||
<option value="Marketing">Маркетинг</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="request_type" class="block text-sm font-medium text-secondary mb-1">Тип заявки</label>
|
<label for="request_type" class="block text-sm font-medium text-secondary mb-1">Тип заявки</label>
|
||||||
<select
|
<select
|
||||||
@@ -129,8 +101,6 @@ import ThemeToggle from '@/components/ThemeToggle.vue'
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
title: '',
|
|
||||||
department: '',
|
|
||||||
request_type: '',
|
request_type: '',
|
||||||
priority: '',
|
priority: '',
|
||||||
description: '',
|
description: '',
|
||||||
@@ -157,14 +127,22 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token')
|
||||||
|
const employeeData = localStorage.getItem('employee')
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
throw new Error('Не найден токен авторизации')
|
throw new Error('Не найден токен авторизации')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!employeeData) {
|
||||||
|
throw new Error('Не найдены данные сотрудника')
|
||||||
|
}
|
||||||
|
|
||||||
|
const employee = JSON.parse(employeeData)
|
||||||
|
|
||||||
const requestData = {
|
const requestData = {
|
||||||
title: formData.title,
|
|
||||||
description: formData.description,
|
description: formData.description,
|
||||||
priority: formData.priority
|
priority: formData.priority,
|
||||||
|
request_type: formData.request_type
|
||||||
}
|
}
|
||||||
|
|
||||||
await axios.post('/api/requests/', requestData, {
|
await axios.post('/api/requests/', requestData, {
|
||||||
@@ -175,8 +153,6 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
success.value = true
|
success.value = true
|
||||||
// Очищаем форму
|
// Очищаем форму
|
||||||
formData.title = ''
|
|
||||||
formData.department = ''
|
|
||||||
formData.request_type = ''
|
formData.request_type = ''
|
||||||
formData.priority = ''
|
formData.priority = ''
|
||||||
formData.description = ''
|
formData.description = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user