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>
|
<script>
|
||||||
import { computed, ref, watch } from 'vue';
|
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';
|
import { checkremote } from '@/utils/universal_functions.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -76,6 +76,10 @@ export default {
|
|||||||
assignedEmployees: {
|
assignedEmployees: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
|
},
|
||||||
|
useUsersApi: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
@@ -99,7 +103,8 @@ export default {
|
|||||||
allEmployees.value.filter(emp => !isEmployeeAssigned(emp.id))
|
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(() => {
|
const allEmployeesgroupedbydep = computed(() => {
|
||||||
let groupped = [];
|
let groupped = [];
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<SearcEmployess
|
<SearcEmployess
|
||||||
:modelValue="selectedEmployees"
|
:modelValue="selectedEmployees"
|
||||||
:assignedEmployees="assignedEmployees"
|
:assignedEmployees="assignedEmployees"
|
||||||
|
:useUsersApi="true"
|
||||||
@update:modelValue="handleEmployeeSelection"
|
@update:modelValue="handleEmployeeSelection"
|
||||||
class="mb-6"
|
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) {
|
async function getVoteResult(id) {
|
||||||
try {
|
try {
|
||||||
const response = await axiosApiInstance.get(`/api/vote/getresults/?id=${id}`);
|
const response = await axiosApiInstance.get(`/api/vote/getresults/?id=${id}`);
|
||||||
@@ -371,6 +381,7 @@ export {
|
|||||||
getVoteDetail,
|
getVoteDetail,
|
||||||
// updateVote,
|
// updateVote,
|
||||||
// patchVote,
|
// patchVote,
|
||||||
|
getUsers,
|
||||||
deleteVote,
|
deleteVote,
|
||||||
getEmployees,
|
getEmployees,
|
||||||
getVoteResult,
|
getVoteResult,
|
||||||
|
|||||||
Reference in new issue
Block a user