fix [P-01]: запрос юзеров
This commit is contained in:
1 parent
3881d34dd2
commit
4927ef04c8
4 files changed
+19
-2
No files matched your search
BIN
Binary file not shown.
@@ -67,7 +67,7 @@
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { getEmployees, spravURL } from '@/utils/axios-api';
|
||||
import { getEmployees, getUsers, spravURL } from '@/utils/axios-api';
|
||||
import { checkremote } from '@/utils/universal_functions.js';
|
||||
|
||||
export default {
|
||||
@@ -76,6 +76,10 @@ export default {
|
||||
assignedEmployees: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
useUsersApi: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
@@ -99,7 +103,8 @@ export default {
|
||||
allEmployees.value.filter(emp => !isEmployeeAssigned(emp.id))
|
||||
);
|
||||
|
||||
getEmployees().then((r) => (groupedEmployees.value = r));
|
||||
// Используем getUsers если установлен флаг useUsersApi, иначе используем getEmployees
|
||||
(props.useUsersApi ? getUsers() : getEmployees()).then((r) => (groupedEmployees.value = r));
|
||||
|
||||
const allEmployeesgroupedbydep = computed(() => {
|
||||
let groupped = [];
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<SearcEmployess
|
||||
:modelValue="selectedEmployees"
|
||||
:assignedEmployees="assignedEmployees"
|
||||
:useUsersApi="true"
|
||||
@update:modelValue="handleEmployeeSelection"
|
||||
class="mb-6"
|
||||
/>
|
||||
|
||||
@@ -188,6 +188,16 @@ async function getEmployees() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getUsers() {
|
||||
try {
|
||||
const response = await axiosApiInstance.get(`api/tests/getusers/`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Ошибка получения всех сотрудников:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function getVoteResult(id) {
|
||||
try {
|
||||
const response = await axiosApiInstance.get(`/api/vote/getresults/?id=${id}`);
|
||||
@@ -371,6 +381,7 @@ export {
|
||||
getVoteDetail,
|
||||
// updateVote,
|
||||
// patchVote,
|
||||
getUsers,
|
||||
deleteVote,
|
||||
getEmployees,
|
||||
getVoteResult,
|
||||
|
||||
Reference in new issue
Block a user