mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
доработка модального окна в управлении сотрудника
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="isOpen" class="modal-overlay" @click="closeModal">
|
<div v-if="isOpen" class="modal-overlay">
|
||||||
<div class="modal-content" @click.stop>
|
<div class="modal-content" @click.stop>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2>Управление заявками</h2>
|
<h2>Управление заявками</h2>
|
||||||
<button class="close-button" @click="closeModal">×</button>
|
<button class="close-button" @click.stop="closeModal">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<div class="filter-group">
|
<div class="filter-group">
|
||||||
<label>Статус:</label>
|
<label>Статус:</label>
|
||||||
<select v-model="statusFilter" class="filter-select">
|
<select v-model="statusFilter" class="filter-select" @click.stop>
|
||||||
<option value="">Все статусы</option>
|
<option value="">Все статусы</option>
|
||||||
<option value="new">Новая</option>
|
<option value="new">Новая</option>
|
||||||
<option value="in_progress">В работе</option>
|
<option value="in_progress">В работе</option>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<div class="filter-group">
|
<div class="filter-group">
|
||||||
<label>Приоритет:</label>
|
<label>Приоритет:</label>
|
||||||
<select v-model="priorityFilter" class="filter-select">
|
<select v-model="priorityFilter" class="filter-select" @click.stop>
|
||||||
<option value="">Все приоритеты</option>
|
<option value="">Все приоритеты</option>
|
||||||
<option value="low">Низкий</option>
|
<option value="low">Низкий</option>
|
||||||
<option value="medium">Средний</option>
|
<option value="medium">Средний</option>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="requests-list">
|
<div class="requests-list">
|
||||||
<div v-for="request in filteredRequests" :key="request.id" class="request-card">
|
<div v-for="request in filteredRequests" :key="request.id" class="request-card" @click.stop>
|
||||||
<div class="request-header">
|
<div class="request-header">
|
||||||
<h3>{{ request.title }}</h3>
|
<h3>{{ request.title }}</h3>
|
||||||
<div class="request-meta">
|
<div class="request-meta">
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<select
|
<select
|
||||||
v-model="request.status"
|
v-model="request.status"
|
||||||
class="status-select"
|
class="status-select"
|
||||||
@change="updateRequestStatus(request)"
|
@change.stop="updateRequestStatus(request)"
|
||||||
>
|
>
|
||||||
<option value="new">Новая</option>
|
<option value="new">Новая</option>
|
||||||
<option value="in_progress">В работе</option>
|
<option value="in_progress">В работе</option>
|
||||||
@@ -73,7 +73,8 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
isOpen: {
|
isOpen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: true
|
required: true,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -104,23 +105,9 @@ export default {
|
|||||||
const response = await axios.get('/api/requests', {
|
const response = await axios.get('/api/requests', {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||||
},
|
|
||||||
validateStatus: function (status) {
|
|
||||||
return status < 500
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.requests = response.data
|
||||||
if (response.status === 307) {
|
|
||||||
const redirectUrl = response.headers.location
|
|
||||||
const finalResponse = await axios.get(redirectUrl, {
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.requests = finalResponse.data
|
|
||||||
} else {
|
|
||||||
this.requests = response.data
|
|
||||||
}
|
|
||||||
|
|
||||||
// Получаем информацию о сотрудниках для отображения имен
|
// Получаем информацию о сотрудниках для отображения имен
|
||||||
const employeesResponse = await axios.get('/api/employees', {
|
const employeesResponse = await axios.get('/api/employees', {
|
||||||
@@ -156,7 +143,6 @@ export default {
|
|||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating request status:', error)
|
console.error('Error updating request status:', error)
|
||||||
// Возвращаем предыдущий статус в случае ошибки
|
|
||||||
this.fetchRequests()
|
this.fetchRequests()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<p>Регистрация нового сотрудника в системе</p>
|
<p>Регистрация нового сотрудника в системе</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="action-card" @click.stop="showRequestsModal = true">
|
<div class="action-card" @click.stop="openRequestsModal">
|
||||||
<div class="action-icon">📝</div>
|
<div class="action-icon">📝</div>
|
||||||
<h3>Управление заявками</h3>
|
<h3>Управление заявками</h3>
|
||||||
<p>Просмотр и обработка заявок</p>
|
<p>Просмотр и обработка заявок</p>
|
||||||
@@ -109,23 +109,9 @@ export default {
|
|||||||
const response = await axios.get('/api/requests/statistics', {
|
const response = await axios.get('/api/requests/statistics', {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||||
},
|
|
||||||
validateStatus: function (status) {
|
|
||||||
return status < 500
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.statistics = response.data
|
||||||
if (response.status === 307) {
|
|
||||||
const redirectUrl = response.headers.location
|
|
||||||
const finalResponse = await axios.get(redirectUrl, {
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.statistics = finalResponse.data
|
|
||||||
} else {
|
|
||||||
this.statistics = response.data
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching statistics:', error)
|
console.error('Error fetching statistics:', error)
|
||||||
this.statistics = {
|
this.statistics = {
|
||||||
@@ -136,19 +122,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEmployeeAdded() {
|
handleEmployeeAdded() {
|
||||||
// Обновляем список сотрудников, если модальное окно списка открыто
|
|
||||||
if (this.showEmployeesModal && this.$refs.employeesModal) {
|
if (this.showEmployeesModal && this.$refs.employeesModal) {
|
||||||
this.$refs.employeesModal.fetchEmployees()
|
this.$refs.employeesModal.fetchEmployees()
|
||||||
}
|
}
|
||||||
// Также обновляем список, если окно закрыто
|
},
|
||||||
if (!this.showEmployeesModal) {
|
openRequestsModal() {
|
||||||
this.showEmployeesModal = true
|
this.showRequestsModal = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.employeesModal) {
|
if (this.$refs.requestsModal) {
|
||||||
this.$refs.employeesModal.fetchEmployees()
|
this.$refs.requestsModal.fetchRequests()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
|||||||
Reference in New Issue
Block a user