shared-ritm 1.2.67 → 1.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -103
- package/dist/index.css +1 -1
- package/dist/shared-ritm.es.js +27926 -8480
- package/dist/shared-ritm.umd.js +3834 -7
- package/dist/types/api/services/ControlsService.d.ts +1 -2
- package/dist/types/api/services/FileService.d.ts +1 -2
- package/dist/types/api/services/MetricsService.d.ts +1 -2
- package/dist/types/api/services/PhotoService.d.ts +41 -0
- package/dist/types/api/services/ProjectsService.d.ts +1 -2
- package/dist/types/api/services/RepairsService.d.ts +1 -2
- package/dist/types/api/services/TasksService.d.ts +1 -2
- package/dist/types/api/services/UserService.d.ts +11 -0
- package/dist/types/api/settings/ApiService.d.ts +8 -0
- package/dist/types/api/types/Api_Instruments.d.ts +1 -35
- package/dist/types/api/types/Api_User.d.ts +42 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/utils/helpers.d.ts +1 -0
- package/package.json +64 -63
- package/src/api/services/PhotoService.ts +137 -0
- package/src/api/services/UserService.ts +19 -0
- package/src/api/types/Api_Controls.ts +72 -72
- package/src/api/types/Api_Files.ts +1 -1
- package/src/api/types/Api_Instruments.ts +98 -133
- package/src/api/types/Api_Projects.ts +55 -55
- package/src/api/types/Api_Repairs.ts +93 -93
- package/src/api/types/Api_Tasks.ts +155 -155
- package/src/api/types/Api_User.ts +44 -0
- package/src/common/app-checkbox/AppCheckbox.vue +26 -26
- package/src/common/app-dialogs/AppConfirmDialog.vue +99 -99
- package/src/common/app-dropdown/AppDropdown.vue +31 -31
- package/src/common/app-input/AppInput.vue +148 -148
- package/src/common/app-select/AppSelect.vue +157 -157
- package/src/common/app-sheet/AppSheet.vue +120 -120
- package/src/common/app-sidebar/components/SidebarMenuItem.vue +148 -148
- package/src/common/app-table/AppTable.vue +250 -250
- package/src/common/app-table/AppTableLayout.vue +111 -111
- package/src/common/app-table/components/ModalSelect.vue +264 -264
- package/src/common/app-table/components/TableModal.vue +329 -329
- package/src/common/app-table/components/TablePagination.vue +152 -152
- package/src/common/app-table/components/TableSearch.vue +76 -76
- package/src/common/app-table/controllers/useBaseTable.ts +42 -42
- package/src/common/app-table/controllers/useColumnSelector.ts +38 -38
- package/src/common/app-table/controllers/useTableModel.ts +93 -93
- package/src/common/app-toggle/AppToggle.vue +23 -23
- package/src/common/app-wrapper/AppWrapper.vue +28 -28
- package/src/icons/components/table-filter-icon.vue +30 -30
- package/src/icons/dialogs/RemoveIcon.vue +12 -12
- package/src/icons/dialogs/SafetyIcon.vue +12 -12
- package/src/icons/task/attention-icon.vue +13 -13
- package/src/icons/task/clock-icon.vue +10 -10
- package/src/icons/task/delete-icon.vue +10 -10
- package/src/icons/task/fire-icon.vue +16 -16
- package/src/index.ts +6 -0
- package/src/main.ts +28 -28
- package/src/shared/styles/general.css +125 -125
- package/src/styles/variables.sass +12 -12
- package/src/utils/confirm.ts +12 -12
- package/src/utils/helpers.ts +58 -39
- package/src/utils/notification.ts +9 -9
- package/dist/types/api/services/SearchService.d.ts +0 -8
- package/dist/types/api/types/Api_Search.d.ts +0 -43
- package/dist/types/api/types/Api_Service.d.ts +0 -9
- package/dist/types/api/types/Api_Users.d.ts +0 -43
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
2
2
|
import { Api_ControlLogs_Dto, Api_ControlZones_Dto } from '@/api/types/Api_Controls';
|
|
3
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
4
3
|
declare class ControlsService extends ApiService {
|
|
5
4
|
fetchControlZones(params: Record<string, any>): Promise<ResponseApi<Api_ControlZones_Dto[]>>;
|
|
6
5
|
fetchControlZone(id: string): Promise<ResponseApi<Api_ControlZones_Dto>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
3
2
|
import { Api_Files_Responsible_Dto } from '@/api/types/Api_Files';
|
|
4
3
|
declare class FileService extends ApiService {
|
|
5
4
|
uploadFile(data: FormData): Promise<ResponseApi<Api_Files_Responsible_Dto>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
3
2
|
declare class MetricsService extends ApiService {
|
|
4
3
|
fetchPieProjects(queryString: string): Promise<ResponseApi<any>>;
|
|
5
4
|
fetchPieTasks(queryString: string): Promise<ResponseApi<any>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as faceapi from 'face-api.js';
|
|
2
|
+
import ApiService from '@/api/settings/ApiService';
|
|
3
|
+
declare class PhotoService extends ApiService {
|
|
4
|
+
getVideoStreamConfig(width: number, height: number): {
|
|
5
|
+
audio: boolean;
|
|
6
|
+
video: {
|
|
7
|
+
width: {
|
|
8
|
+
min: number;
|
|
9
|
+
ideal: number;
|
|
10
|
+
};
|
|
11
|
+
height: {
|
|
12
|
+
min: number;
|
|
13
|
+
ideal: number;
|
|
14
|
+
};
|
|
15
|
+
facingMode: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
getContourCoordinate(width: number, height: number): {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
24
|
+
getBoxData(box: any): {
|
|
25
|
+
x: any;
|
|
26
|
+
y: any;
|
|
27
|
+
width: any;
|
|
28
|
+
height: any;
|
|
29
|
+
} | null;
|
|
30
|
+
setStylesForCanvas(canvasContainer: any): void;
|
|
31
|
+
checkFaceInclusion(frame: any, face: any): boolean;
|
|
32
|
+
getFaceDetections(videoRef: any): Promise<faceapi.WithFaceExpressions<faceapi.WithFaceLandmarks<{
|
|
33
|
+
detection: faceapi.FaceDetection;
|
|
34
|
+
}, faceapi.FaceLandmarks68>>[]>;
|
|
35
|
+
getCanvas(videoRef: any): HTMLCanvasElement;
|
|
36
|
+
getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number): void;
|
|
37
|
+
getFaceSnapshot(inputImage: any, box: any): Promise<string | null>;
|
|
38
|
+
initModels(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
export default function usePhotoService(): PhotoService;
|
|
41
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
3
2
|
import { Api_Project_Dto } from '@/api/types/Api_Projects';
|
|
4
3
|
declare class ProjectsService extends ApiService {
|
|
5
4
|
fetchProjectById(id: string): Promise<ResponseApi<Api_Project_Dto>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
3
2
|
import { Api_Create_Repair_With_Equipments, Api_Equipment_Full_Dto, Api_Repair_Dto, Api_Update_Repair, OptionFilters } from '@/api/types/Api_Repairs';
|
|
4
3
|
declare class RepairsService extends ApiService {
|
|
5
4
|
fetchFilters(fullParams: string): Promise<OptionFilters>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import ApiService from '@/api/settings/ApiService';
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service';
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService';
|
|
3
2
|
import { Api_Task_Close_Reason, Api_Task_Instrument_Dto, Api_Task_Instrument_From_Warehouse, Api_Task_Module_Instrument_Condition, Api_Tasks_Dto, Api_Tasks_Task_Dto } from '@/api/types/Api_Tasks';
|
|
4
3
|
import { Api_Equipment_Full_Dto, Api_Task_Video_Source, Api_Task_Video_Source_Stream } from '@/api/types/Api_Repairs';
|
|
5
4
|
declare class TasksService extends ApiService {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService';
|
|
2
|
+
import { Api_User } from '@/api/types/Api_User';
|
|
3
|
+
declare class UserService extends ApiService {
|
|
4
|
+
editUser({ id, model }: {
|
|
5
|
+
id: string;
|
|
6
|
+
model: any;
|
|
7
|
+
}): Promise<Api_User>;
|
|
8
|
+
getUser(id: string): Promise<Api_User>;
|
|
9
|
+
}
|
|
10
|
+
export default function useUserService(): UserService;
|
|
11
|
+
export {};
|
|
@@ -2,6 +2,14 @@ import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
|
2
2
|
export declare enum ApiServiceType {
|
|
3
3
|
SERVICE_AUTH = "SERVICE_AUTH"
|
|
4
4
|
}
|
|
5
|
+
export type ResponseApi<T> = {
|
|
6
|
+
count: number;
|
|
7
|
+
current_page: number;
|
|
8
|
+
data: T;
|
|
9
|
+
per_page: number;
|
|
10
|
+
total: number;
|
|
11
|
+
total_pages: number;
|
|
12
|
+
};
|
|
5
13
|
export default class ApiService {
|
|
6
14
|
private axiosInstance;
|
|
7
15
|
constructor();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Api_User } from '@/api/types/Api_User';
|
|
1
2
|
export type Api_Instrument_Storage = {
|
|
2
3
|
id: string;
|
|
3
4
|
created_at: string;
|
|
@@ -30,18 +31,6 @@ export type Api_Instrument_Location = {
|
|
|
30
31
|
deleted_at: string | null;
|
|
31
32
|
state_id: unknown | null;
|
|
32
33
|
};
|
|
33
|
-
export type Api_User_Team = {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
display_name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
created_at: string;
|
|
39
|
-
updated_at: string;
|
|
40
|
-
pivot: {
|
|
41
|
-
team_id: string;
|
|
42
|
-
user_id: string;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
34
|
export type Api_Instrument_Status = {
|
|
46
35
|
id: string;
|
|
47
36
|
description: string;
|
|
@@ -51,29 +40,6 @@ export type Api_Instrument_Status = {
|
|
|
51
40
|
updated_at: string;
|
|
52
41
|
deleted_at: string | null;
|
|
53
42
|
};
|
|
54
|
-
export type Api_User = {
|
|
55
|
-
id: string;
|
|
56
|
-
RFID: string;
|
|
57
|
-
avatar: unknown | null;
|
|
58
|
-
avatar_id: string | null;
|
|
59
|
-
change_password: string;
|
|
60
|
-
created_at: string;
|
|
61
|
-
updated_at: string;
|
|
62
|
-
deleted_at: string | null;
|
|
63
|
-
dismissal_at: string | null;
|
|
64
|
-
email_verified_at: string;
|
|
65
|
-
divisions: string;
|
|
66
|
-
email: string;
|
|
67
|
-
face_recognition_id: string | null;
|
|
68
|
-
first_name: string;
|
|
69
|
-
full_name: string;
|
|
70
|
-
last_name: string;
|
|
71
|
-
patronymic: string;
|
|
72
|
-
personnel_number: number;
|
|
73
|
-
phone: string;
|
|
74
|
-
profession: string;
|
|
75
|
-
teams: Api_User_Team[];
|
|
76
|
-
};
|
|
77
43
|
export type Api_Instrument = {
|
|
78
44
|
id: string;
|
|
79
45
|
RFID: string | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Api_User_Team = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
display_name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
created_at: string;
|
|
7
|
+
updated_at: string;
|
|
8
|
+
pivot: {
|
|
9
|
+
team_id: string;
|
|
10
|
+
user_id: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type Api_User_Photo = {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
export type Api_User = {
|
|
20
|
+
id: string;
|
|
21
|
+
RFID: string;
|
|
22
|
+
avatar: unknown | null;
|
|
23
|
+
avatar_id: string | null;
|
|
24
|
+
change_password: string;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
deleted_at: string | null;
|
|
28
|
+
dismissal_at: string | null;
|
|
29
|
+
email_verified_at: string;
|
|
30
|
+
divisions: string;
|
|
31
|
+
email: string;
|
|
32
|
+
face_recognition_id: string | null;
|
|
33
|
+
first_name: string;
|
|
34
|
+
full_name: string;
|
|
35
|
+
last_name: string;
|
|
36
|
+
patronymic: string;
|
|
37
|
+
personnel_number: number;
|
|
38
|
+
phone: string;
|
|
39
|
+
profession: string;
|
|
40
|
+
teams: Api_User_Team[];
|
|
41
|
+
photos: Api_User_Photo[];
|
|
42
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ import AppTableModal from '@/common/app-table/components/TableModal.vue';
|
|
|
21
21
|
import AppTable from '@/common/app-table/AppTable.vue';
|
|
22
22
|
import AppTableLayout from '@/common/app-table/AppTableLayout.vue';
|
|
23
23
|
import AppModalSelect from '@/common/app-table/components/ModalSelect.vue';
|
|
24
|
-
import ApiService from '@/api/settings/ApiService';
|
|
25
24
|
import useGanttService from '@/api/services/GanttService';
|
|
26
25
|
import useMetricsService from '@/api/services/MetricsService';
|
|
27
26
|
import useProjectsService from '@/api/services/ProjectsService';
|
|
@@ -30,21 +29,23 @@ import useTasksService from '@/api/services/TasksService';
|
|
|
30
29
|
import useAuthService from '@/api/services/AuthService';
|
|
31
30
|
import useFileService from '@/api/services/FileService';
|
|
32
31
|
import useVideoService from '@/api/services/VideoService';
|
|
32
|
+
import useUserService from '@/api/services/UserService';
|
|
33
|
+
import usePhotoService from '@/api/services/PhotoService';
|
|
33
34
|
import useInstrumentsService from '@/api/services/InstrumentsService';
|
|
35
|
+
import ApiService from '@/api/settings/ApiService';
|
|
34
36
|
import useControlsService from '@/api/services/ControlsService';
|
|
35
|
-
import useSearchService from '@/api/services/SearchService';
|
|
36
37
|
export { AppButton, AppCheckbox, AppDatePicker, AppInput, AppInputSearch, AppLayout, AppLayoutHeader, AppLayoutPage, AppLoader, AppSelect, AppSheet, AppSidebar, AppToggle, AppWrapper, AppConfirmDialog, AppDropdown, AppTablePagination, AppTableSearch, AppTableModal, AppTable, AppTableLayout, AppModalSelect, };
|
|
37
|
-
export { ApiService, useAuthService, useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService, useFileService, useControlsService, useVideoService,
|
|
38
|
+
export { ApiService, useAuthService, useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService, useFileService, useControlsService, useVideoService, useUserService, usePhotoService, useInstrumentsService, };
|
|
38
39
|
export { useBaseTable } from './common/app-table/controllers/useBaseTable';
|
|
39
40
|
export { useTableModel } from './common/app-table/controllers/useTableModel';
|
|
40
41
|
export { useColumnSelector } from './common/app-table/controllers/useColumnSelector';
|
|
41
42
|
export type { FilterOption, TableModel, TableColumn } from './common/app-table/controllers/useTableModel';
|
|
42
43
|
export type { NotificationType } from './utils/notification';
|
|
43
44
|
export { notificationSettings } from './utils/notification';
|
|
44
|
-
export * from './
|
|
45
|
+
export * from './utils/helpers';
|
|
45
46
|
export * from './api/types/Api_Tasks';
|
|
46
47
|
export * from './api/types/Api_Repairs';
|
|
47
48
|
export * from './api/types/Api_Projects';
|
|
48
49
|
export * from './api/types/Api_Controls';
|
|
49
50
|
export * from './api/types/Api_Instruments';
|
|
50
|
-
export * from './api/types/
|
|
51
|
+
export * from './api/types/Api_User';
|
package/package.json
CHANGED
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "shared-ritm",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"private": false,
|
|
5
|
-
"files": [
|
|
6
|
-
"dist",
|
|
7
|
-
"src"
|
|
8
|
-
],
|
|
9
|
-
"main": "dist/shared-ritm.umd.js",
|
|
10
|
-
"type": "module",
|
|
11
|
-
"module": "./dist/shared-ritm.es.js",
|
|
12
|
-
"types": "./dist/types/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"import": "./dist/shared-ritm.es.js",
|
|
16
|
-
"require": "./dist/shared-ritm.umd.js",
|
|
17
|
-
"default": "./dist/shared-ritm.es.js",
|
|
18
|
-
"types": "./dist/types/index.d.ts"
|
|
19
|
-
},
|
|
20
|
-
"./style": "./dist/index.css"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"dev": "vite",
|
|
24
|
-
"build": "vite build && tsc --emitDeclarationOnly",
|
|
25
|
-
"typecheck": "vue-tsc --noEmit",
|
|
26
|
-
"lint": "eslint --fix",
|
|
27
|
-
"format": "prettier -w -u ."
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@quasar/extras": "^1.16.17",
|
|
31
|
-
"@vueuse/core": "^10.1.2",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"vue
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@typescript-eslint/
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@vue/
|
|
48
|
-
"@vue/eslint-config-
|
|
49
|
-
"eslint": "^7.
|
|
50
|
-
"eslint
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"vite
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "shared-ritm",
|
|
3
|
+
"version": "1.2.68",
|
|
4
|
+
"private": false,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"main": "dist/shared-ritm.umd.js",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"module": "./dist/shared-ritm.es.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/shared-ritm.es.js",
|
|
16
|
+
"require": "./dist/shared-ritm.umd.js",
|
|
17
|
+
"default": "./dist/shared-ritm.es.js",
|
|
18
|
+
"types": "./dist/types/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./style": "./dist/index.css"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
25
|
+
"typecheck": "vue-tsc --noEmit",
|
|
26
|
+
"lint": "eslint --fix",
|
|
27
|
+
"format": "prettier -w -u ."
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@quasar/extras": "^1.16.17",
|
|
31
|
+
"@vueuse/core": "^10.1.2",
|
|
32
|
+
"face-api.js": "^0.22.2",
|
|
33
|
+
"axios": "^1.7.7",
|
|
34
|
+
"vue": "^3.5.12",
|
|
35
|
+
"vue-router": "^4.0.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"quasar": "^2.18.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@quasar/vite-plugin": "^1.9.0",
|
|
42
|
+
"@rollup/pluginutils": "^5.1.3",
|
|
43
|
+
"@types/node": "^22.7.9",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^4.25.0",
|
|
45
|
+
"@typescript-eslint/parser": "^4.25.0",
|
|
46
|
+
"@vitejs/plugin-vue": "^5.1.4",
|
|
47
|
+
"@vue/compiler-sfc": "^3.0.5",
|
|
48
|
+
"@vue/eslint-config-prettier": "^6.0.0",
|
|
49
|
+
"@vue/eslint-config-typescript": "^7.0.0",
|
|
50
|
+
"eslint": "^7.27.0",
|
|
51
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
52
|
+
"eslint-plugin-vue": "^7.10.0",
|
|
53
|
+
"install": "^0.13.0",
|
|
54
|
+
"npm": "^11.4.0",
|
|
55
|
+
"prettier": "^2.3.0",
|
|
56
|
+
"quasar": "^2.18.1",
|
|
57
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
58
|
+
"sass": "^1.80.4",
|
|
59
|
+
"typescript": "^5.6.3",
|
|
60
|
+
"vite": "^5.4.9",
|
|
61
|
+
"vite-plugin-css-modules": "^0.0.1",
|
|
62
|
+
"vue-tsc": "^2.1.6"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as faceapi from 'face-api.js'
|
|
2
|
+
|
|
3
|
+
class PhotoService {
|
|
4
|
+
// async getFaceSnapshot(inputImage: any, box: any) {
|
|
5
|
+
// const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
|
|
6
|
+
// const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
|
|
7
|
+
// if (faceImages.length) {
|
|
8
|
+
// const dataUrl = faceImages[0].toDataURL('image/jpeg')
|
|
9
|
+
// photo.value = dataUrl.replace(/^data:image\/\w+;base64,/, '')
|
|
10
|
+
// }
|
|
11
|
+
// }
|
|
12
|
+
|
|
13
|
+
// Метод настройки конфига для стрима
|
|
14
|
+
getVideoStreamConfig(width: number, height: number) {
|
|
15
|
+
return {
|
|
16
|
+
audio: false,
|
|
17
|
+
video: {
|
|
18
|
+
width: { min: width, ideal: width },
|
|
19
|
+
height: { min: height, ideal: height },
|
|
20
|
+
facingMode: 'environment', // или 'user' для фронтальной камеры
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Метод для настройки рамки, где должно помещаться лицо
|
|
26
|
+
getContourCoordinate(width: number, height: number) {
|
|
27
|
+
return {
|
|
28
|
+
x: width * 0.25,
|
|
29
|
+
y: height * 0.05,
|
|
30
|
+
width: width * 0.5,
|
|
31
|
+
height: height * 0.9,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getBoxData(box: any) {
|
|
36
|
+
if (!box) return null
|
|
37
|
+
return {
|
|
38
|
+
x: box.x,
|
|
39
|
+
y: box.y,
|
|
40
|
+
width: box.width,
|
|
41
|
+
height: box.height,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
setStylesForCanvas(canvasContainer: any) {
|
|
46
|
+
canvasContainer.width = '100%'
|
|
47
|
+
canvasContainer.height = '100%'
|
|
48
|
+
canvasContainer.style.position = 'absolute'
|
|
49
|
+
canvasContainer.style.top = '0'
|
|
50
|
+
canvasContainer.style.left = '0'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Метод для рассчёта того, что лицо полностью помещается в рамке
|
|
54
|
+
checkFaceInclusion(frame: any, face: any) {
|
|
55
|
+
if (!frame || !face) return false
|
|
56
|
+
|
|
57
|
+
if (face.width > frame.width || face.height > frame.height) {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const faceXmin = face.x
|
|
62
|
+
const faceXmax = face.x + face.width
|
|
63
|
+
const faceYmin = face.y
|
|
64
|
+
const faceYmax = face.y + face.height
|
|
65
|
+
|
|
66
|
+
const frameXmin = frame.x
|
|
67
|
+
const frameXmax = frame.x + frame.width
|
|
68
|
+
const frameYmin = frame.y
|
|
69
|
+
const frameYmax = frame.y + frame.height
|
|
70
|
+
|
|
71
|
+
return faceXmin >= frameXmin && faceXmax <= frameXmax && faceYmin >= frameYmin && faceYmax <= frameYmax
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async getFaceDetections(videoRef: any) {
|
|
75
|
+
if (!videoRef) return []
|
|
76
|
+
return faceapi
|
|
77
|
+
.detectAllFaces(videoRef, new faceapi.TinyFaceDetectorOptions())
|
|
78
|
+
.withFaceLandmarks()
|
|
79
|
+
.withFaceExpressions()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getCanvas(videoRef: any) {
|
|
83
|
+
return faceapi.createCanvasFromMedia(videoRef)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number) {
|
|
87
|
+
faceapi.matchDimensions(canvas, { width: videoWidth, height: videoHeight })
|
|
88
|
+
|
|
89
|
+
const resized = faceapi.resizeResults(detections, {
|
|
90
|
+
width: videoWidth,
|
|
91
|
+
height: videoHeight,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
ctx.clearRect(0, 0, videoWidth, videoHeight)
|
|
95
|
+
|
|
96
|
+
faceapi.draw.drawDetections(canvas, resized)
|
|
97
|
+
faceapi.draw.drawFaceLandmarks(canvas, resized)
|
|
98
|
+
faceapi.draw.drawFaceExpressions(canvas, resized)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async getFaceSnapshot(inputImage: any, box: any) {
|
|
102
|
+
const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
|
|
103
|
+
const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
|
|
104
|
+
|
|
105
|
+
if (faceImages.length) {
|
|
106
|
+
const dataUrl = faceImages[0].toDataURL('image/jpeg')
|
|
107
|
+
return dataUrl.replace(/^data:image\/\w+;base64,/, '')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return null
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async initModels() {
|
|
114
|
+
let date = new Date()
|
|
115
|
+
console.log(date)
|
|
116
|
+
try {
|
|
117
|
+
await Promise.all([
|
|
118
|
+
faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
|
|
119
|
+
faceapi.nets.faceLandmark68Net.loadFromUri('/models'),
|
|
120
|
+
faceapi.nets.faceRecognitionNet.loadFromUri('/models'),
|
|
121
|
+
faceapi.nets.faceExpressionNet.loadFromUri('/models'),
|
|
122
|
+
//faceapi.nets.ssdMobilenetv1.loadFromUri('/models'),
|
|
123
|
+
])
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error(error)
|
|
126
|
+
}
|
|
127
|
+
date = new Date()
|
|
128
|
+
console.log(date)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let api: PhotoService
|
|
133
|
+
|
|
134
|
+
export default function usePhotoService() {
|
|
135
|
+
if (!api) api = new PhotoService()
|
|
136
|
+
return api
|
|
137
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService'
|
|
2
|
+
import { Api_User } from '@/api/types/Api_User'
|
|
3
|
+
|
|
4
|
+
class UserService extends ApiService {
|
|
5
|
+
public async editUser({ id, model }: { id: string; model: any }): Promise<Api_User> {
|
|
6
|
+
return await this.put<Partial<Api_User>, Api_User>(`/admin/users/${id}`, model)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public async getUser(id: string): Promise<Api_User> {
|
|
10
|
+
return await this.get<Api_User>(`/admin/users/${id}`)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let api: UserService
|
|
15
|
+
|
|
16
|
+
export default function useUserService() {
|
|
17
|
+
if (!api) api = new UserService()
|
|
18
|
+
return api
|
|
19
|
+
}
|