shared-ritm 1.3.67 → 1.3.69
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/dist/index.css +1 -1
- package/dist/shared-ritm.es.js +4862 -4700
- package/dist/shared-ritm.umd.js +190 -190
- package/dist/types/api/services/AuthService.d.ts +0 -1
- package/dist/types/api/services/MetricsService.d.ts +2 -1
- package/dist/types/api/services/PhotoService.d.ts +40 -0
- package/dist/types/api/services/UserService.d.ts +1 -2
- package/dist/types/api/settings/ApiService.d.ts +2 -7
- package/dist/types/api/types/Api_Auth.d.ts +0 -15
- package/dist/types/api/types/Api_Metrics.d.ts +18 -0
- package/dist/types/api/types/Api_User.d.ts +0 -9
- package/dist/types/common/app-checkbox/Checkbox.stories.d.ts +5 -1
- package/dist/types/common/app-toggle/Toggle.stories.d.ts +5 -1
- package/dist/types/stories/Button.stories.d.ts +13 -0
- package/dist/types/stories/Checkbox.stories.d.ts +7 -0
- package/dist/types/stories/Confirm.stories.d.ts +8 -0
- package/dist/types/stories/DatePicker.stories.d.ts +8 -0
- package/dist/types/stories/Dropdown.stories.d.ts +8 -0
- package/dist/types/stories/File.stories.d.ts +8 -0
- package/dist/types/stories/Icon.stories.d.ts +7 -0
- package/dist/types/stories/Input.stories.d.ts +11 -0
- package/dist/types/stories/InputNew.stories.d.ts +12 -0
- package/dist/types/stories/InputSearch.stories.d.ts +10 -0
- package/dist/types/stories/Loader.stories.d.ts +8 -0
- package/dist/types/stories/Select.stories.d.ts +7 -0
- package/dist/types/stories/Toggle.stories.d.ts +8 -0
- package/package.json +70 -70
- package/src/App.vue +2461 -2461
- package/src/api/services/AuthService.ts +4 -18
- package/src/api/services/ControlsService.ts +96 -96
- package/src/api/services/EquipmentService.ts +29 -29
- package/src/api/services/GanttService.ts +23 -23
- package/src/api/services/MetricsService.ts +127 -123
- package/src/api/services/RepairsService.ts +111 -111
- package/src/api/services/UserService.ts +0 -6
- package/src/api/services/VideoService.ts +118 -118
- package/src/api/settings/ApiService.ts +10 -73
- package/src/api/types/Api_Auth.ts +0 -16
- package/src/api/types/Api_Metrics.ts +26 -5
- package/src/api/types/Api_Repairs.ts +186 -186
- package/src/api/types/Api_Tasks.ts +376 -376
- package/src/api/types/Api_User.ts +0 -10
- package/src/api/types/Api_Video.ts +244 -244
- package/src/common/app-button/Button.stories.ts +369 -369
- package/src/common/app-checkbox/AppCheckbox.vue +19 -12
- package/src/common/app-checkbox/Checkbox.stories.ts +252 -60
- package/src/common/app-date-picker/DatePicker.stories.ts +66 -66
- package/src/common/app-datepicker/Datepicker.stories.ts +145 -145
- package/src/common/app-dialogs/AppConfirmDialog.vue +109 -109
- package/src/common/app-dialogs/Confirm.stories.ts +93 -93
- package/src/common/app-dropdown/Dropdown.stories.ts +94 -94
- package/src/common/app-file/File.stories.ts +104 -104
- package/src/common/app-icon/AppIcon.vue +108 -108
- package/src/common/app-icon/Icon.stories.ts +91 -91
- package/src/common/app-input/Input.stories.ts +160 -160
- package/src/common/app-input-new/InputNew.stories.ts +240 -240
- package/src/common/app-input-search/InputSearch.stories.ts +149 -149
- package/src/common/app-layout/components/AppLayoutHeader.vue +289 -289
- package/src/common/app-loader/Loader.stories.ts +114 -114
- package/src/common/app-select/AppSelect.vue +159 -159
- package/src/common/app-select/Select.stories.ts +155 -155
- package/src/common/app-sidebar/AppSidebar.vue +174 -174
- package/src/common/app-table/AppTable.vue +313 -313
- package/src/common/app-table/components/ModalSelect.stories.ts +323 -323
- package/src/common/app-table/components/ModalSelect.vue +302 -302
- package/src/common/app-table/components/TableModal.vue +367 -367
- package/src/common/app-table/controllers/useColumnSelector.ts +45 -45
- package/src/common/app-table/controllers/useTableModel.ts +97 -97
- package/src/common/app-toggle/AppToggle.vue +5 -15
- package/src/common/app-toggle/Toggle.stories.ts +245 -69
- package/src/common/app-wrapper/AppWrapper.vue +31 -31
- package/src/configs/storybook.ts +14 -14
- package/src/index.ts +131 -131
- package/src/shared/styles/general.css +140 -140
- package/src/styles/variables.sass +12 -12
- package/src/utils/helpers.ts +59 -59
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import ApiService from '../settings/ApiService'
|
|
2
|
-
import { ResponseApi } from '../types/Api_Service'
|
|
3
|
-
import {
|
|
4
|
-
Api_Create_Repair_With_Equipments,
|
|
5
|
-
Api_Create_Repair_With_Template,
|
|
6
|
-
Api_Repair_Dto,
|
|
7
|
-
Api_Repair_Intersection,
|
|
8
|
-
Api_Repair_Template,
|
|
9
|
-
Api_Update_Repair,
|
|
10
|
-
OptionFilters,
|
|
11
|
-
} from '../types/Api_Repairs'
|
|
12
|
-
|
|
13
|
-
class RepairsService extends ApiService {
|
|
14
|
-
public fetchFilters(fullParams: string): Promise<OptionFilters> {
|
|
15
|
-
return this.get(`get_list_repair?smart=1&${fullParams}`)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public fetchRepairs(
|
|
19
|
-
isQuery: boolean,
|
|
20
|
-
queries?: string,
|
|
21
|
-
hasTeams?: boolean | string,
|
|
22
|
-
teamsFilter?: string,
|
|
23
|
-
typeFilter?: string,
|
|
24
|
-
): Promise<ResponseApi<Api_Repair_Dto[]>> {
|
|
25
|
-
return this.get(
|
|
26
|
-
'get_list_repair' +
|
|
27
|
-
(isQuery
|
|
28
|
-
? `${queries}&per_page=100000${typeFilter ? '&' + typeFilter : ''}&${!hasTeams ? teamsFilter : ''}`
|
|
29
|
-
: `?per_page=100000${typeFilter ? '&' + typeFilter : ''}&${teamsFilter}`),
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public fetchRepairTemplates(params?: any): Promise<ResponseApi<Api_Repair_Template[]>> {
|
|
34
|
-
return this.get('repairs/get_repair_template_list', { params })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public createRepair(payload: Api_Create_Repair_With_Equipments) {
|
|
38
|
-
return this.post<Api_Create_Repair_With_Equipments, any>('/repairs/equipments', payload)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public createRepairFromTemplate(payload: Api_Create_Repair_With_Template) {
|
|
42
|
-
return this.post<Api_Create_Repair_With_Template, any>('/repairs/create_repair_from_repair_template', payload)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public startRepair(id: string): Promise<void> {
|
|
46
|
-
return this.post<null, void>(`/repairs/${id}/start`, null)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public finishRepair(id: string) {
|
|
50
|
-
return this.post<any, void>(`/repairs/complete_repair_list`, {
|
|
51
|
-
repairIdList: [id],
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public finishPreparationProject(id: string) {
|
|
56
|
-
return this.post<null, void>(`/repairs/${id}/finish_preparation`, null)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public moveRepairToCurrent(id: string) {
|
|
60
|
-
return this.post<any, void>(`/repairs/transfer_repair_plan_to_current`, {
|
|
61
|
-
repairs: [id],
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public moveArchiveToCurrent(id: string) {
|
|
66
|
-
return this.post<any, void>(`/repairs/transfer_repair_archive_to_current`, {
|
|
67
|
-
repairs_ids: [id],
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public moveRepairToApr(id: string) {
|
|
72
|
-
return this.post<any, void>(`/repairs/transfer_repair_current_to_plan`, {
|
|
73
|
-
repairs: [id],
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public moveRepairToArchive(id: string) {
|
|
78
|
-
return this.post<any, void>(`/repairs/transfer_repair_current_to_archive`, {
|
|
79
|
-
repairs_ids: [id],
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public restoreRepair(id: string) {
|
|
84
|
-
return this.post<any, void>(`/restore_repair`, {
|
|
85
|
-
repairs_ids: [id],
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public updateRepair(payload: Api_Update_Repair, id: string) {
|
|
90
|
-
return this.put<Api_Update_Repair, void>(`/repairs/${id}`, payload)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public copyRepair(id: string) {
|
|
94
|
-
return this.post<null, any>(`/repairs/${id}/clone`, null)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public deleteRepair(id: string) {
|
|
98
|
-
return this.delete<any>(`/repairs/${id}`)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public fetchIntersection(id: string): Promise<Api_Repair_Intersection[]> {
|
|
102
|
-
return this.get(`v3/repairs/${id}/personnel/intersection`)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let api: RepairsService
|
|
107
|
-
|
|
108
|
-
export default function useRepairsService() {
|
|
109
|
-
if (!api) api = new RepairsService()
|
|
110
|
-
return api
|
|
111
|
-
}
|
|
1
|
+
import ApiService from '../settings/ApiService'
|
|
2
|
+
import { ResponseApi } from '../types/Api_Service'
|
|
3
|
+
import {
|
|
4
|
+
Api_Create_Repair_With_Equipments,
|
|
5
|
+
Api_Create_Repair_With_Template,
|
|
6
|
+
Api_Repair_Dto,
|
|
7
|
+
Api_Repair_Intersection,
|
|
8
|
+
Api_Repair_Template,
|
|
9
|
+
Api_Update_Repair,
|
|
10
|
+
OptionFilters,
|
|
11
|
+
} from '../types/Api_Repairs'
|
|
12
|
+
|
|
13
|
+
class RepairsService extends ApiService {
|
|
14
|
+
public fetchFilters(fullParams: string): Promise<OptionFilters> {
|
|
15
|
+
return this.get(`get_list_repair?smart=1&${fullParams}`)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public fetchRepairs(
|
|
19
|
+
isQuery: boolean,
|
|
20
|
+
queries?: string,
|
|
21
|
+
hasTeams?: boolean | string,
|
|
22
|
+
teamsFilter?: string,
|
|
23
|
+
typeFilter?: string,
|
|
24
|
+
): Promise<ResponseApi<Api_Repair_Dto[]>> {
|
|
25
|
+
return this.get(
|
|
26
|
+
'get_list_repair' +
|
|
27
|
+
(isQuery
|
|
28
|
+
? `${queries}&per_page=100000${typeFilter ? '&' + typeFilter : ''}&${!hasTeams ? teamsFilter : ''}`
|
|
29
|
+
: `?per_page=100000${typeFilter ? '&' + typeFilter : ''}&${teamsFilter}`),
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public fetchRepairTemplates(params?: any): Promise<ResponseApi<Api_Repair_Template[]>> {
|
|
34
|
+
return this.get('repairs/get_repair_template_list', { params })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public createRepair(payload: Api_Create_Repair_With_Equipments) {
|
|
38
|
+
return this.post<Api_Create_Repair_With_Equipments, any>('/repairs/equipments', payload)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public createRepairFromTemplate(payload: Api_Create_Repair_With_Template) {
|
|
42
|
+
return this.post<Api_Create_Repair_With_Template, any>('/repairs/create_repair_from_repair_template', payload)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public startRepair(id: string): Promise<void> {
|
|
46
|
+
return this.post<null, void>(`/repairs/${id}/start`, null)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public finishRepair(id: string) {
|
|
50
|
+
return this.post<any, void>(`/repairs/complete_repair_list`, {
|
|
51
|
+
repairIdList: [id],
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public finishPreparationProject(id: string) {
|
|
56
|
+
return this.post<null, void>(`/repairs/${id}/finish_preparation`, null)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public moveRepairToCurrent(id: string) {
|
|
60
|
+
return this.post<any, void>(`/repairs/transfer_repair_plan_to_current`, {
|
|
61
|
+
repairs: [id],
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public moveArchiveToCurrent(id: string) {
|
|
66
|
+
return this.post<any, void>(`/repairs/transfer_repair_archive_to_current`, {
|
|
67
|
+
repairs_ids: [id],
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public moveRepairToApr(id: string) {
|
|
72
|
+
return this.post<any, void>(`/repairs/transfer_repair_current_to_plan`, {
|
|
73
|
+
repairs: [id],
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public moveRepairToArchive(id: string) {
|
|
78
|
+
return this.post<any, void>(`/repairs/transfer_repair_current_to_archive`, {
|
|
79
|
+
repairs_ids: [id],
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public restoreRepair(id: string) {
|
|
84
|
+
return this.post<any, void>(`/restore_repair`, {
|
|
85
|
+
repairs_ids: [id],
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public updateRepair(payload: Api_Update_Repair, id: string) {
|
|
90
|
+
return this.put<Api_Update_Repair, void>(`/repairs/${id}`, payload)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public copyRepair(id: string) {
|
|
94
|
+
return this.post<null, any>(`/repairs/${id}/clone`, null)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public deleteRepair(id: string) {
|
|
98
|
+
return this.delete<any>(`/repairs/${id}`)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public fetchIntersection(id: string): Promise<Api_Repair_Intersection[]> {
|
|
102
|
+
return this.get(`v3/repairs/${id}/personnel/intersection`)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let api: RepairsService
|
|
107
|
+
|
|
108
|
+
export default function useRepairsService() {
|
|
109
|
+
if (!api) api = new RepairsService()
|
|
110
|
+
return api
|
|
111
|
+
}
|
|
@@ -9,9 +9,7 @@ import {
|
|
|
9
9
|
Api_User_Team,
|
|
10
10
|
Api_User_Team_Search,
|
|
11
11
|
Api_User_Warehouse,
|
|
12
|
-
Api_User_Change_Password_Payload,
|
|
13
12
|
} from '../types/Api_User'
|
|
14
|
-
|
|
15
13
|
import { ResponseApi } from '../types/Api_Service'
|
|
16
14
|
|
|
17
15
|
class UserService extends ApiService {
|
|
@@ -23,10 +21,6 @@ class UserService extends ApiService {
|
|
|
23
21
|
return await this.get<Api_User>(`/admin/users/${id}`)
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
public async changeUserPassword(payload: Api_User_Change_Password_Payload): Promise<Api_User> {
|
|
27
|
-
return await this.patch<Api_User_Change_Password_Payload, Api_User>(`/v2/auth/users/password`, payload)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
public async getUserWarehouses(params: {
|
|
31
25
|
user_id: string
|
|
32
26
|
page?: number
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import ApiService from '../settings/ApiService'
|
|
2
|
-
import { ResponseApi } from '@/api/types/Api_Service'
|
|
3
|
-
import {
|
|
4
|
-
Api_Video_Combination,
|
|
5
|
-
Api_Video_Source_By_Repair,
|
|
6
|
-
Api_Video_Source_Create,
|
|
7
|
-
Api_Video_Source_Economics,
|
|
8
|
-
Api_Video_Source_Search,
|
|
9
|
-
Api_Video_Training_Status,
|
|
10
|
-
Api_Work_Zone,
|
|
11
|
-
Api_Work_Zone_Search,
|
|
12
|
-
} from '@/api/types/Api_Video'
|
|
13
|
-
|
|
14
|
-
class VideoService extends ApiService {
|
|
15
|
-
public async startVideoAnalytics(): Promise<boolean> {
|
|
16
|
-
return await this.post('/statanly/start', null)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public reloadVideoAnalytics(ids: string[]): Promise<any> {
|
|
20
|
-
return this.post('/horizon/video-source/reload', { video_source_ids: ids })
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public hardReloadStream(): Promise<any> {
|
|
24
|
-
return this.post('horizon/video-source/streams/add', null)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public async fetchWorkZones(params?: any): Promise<ResponseApi<Api_Work_Zone_Search[]>> {
|
|
28
|
-
return await this.get('/search/work_zones', { params })
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public async fetchWorkZone(id: string): Promise<ResponseApi<Api_Work_Zone>> {
|
|
32
|
-
return await this.get(`/work_zone/get_work_zone/${id}`)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public async editWorkZone(id: string, body: { title: string }): Promise<{ data: Api_Work_Zone; status: number }> {
|
|
36
|
-
return await this.put(`/admin/work-zones/${id}`, body)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public async deleteWorkZone(id: string): Promise<{ data: boolean; status: number }> {
|
|
40
|
-
return await this.delete(`/admin/work-zones/${id}`)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public async fetchVideoSources(params?: any): Promise<ResponseApi<Api_Video_Source_Search[]>> {
|
|
44
|
-
return await this.get('/search/video_sources/list', { params })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public async fetchVideoSourceEconomics(params?: any): Promise<ResponseApi<Api_Video_Source_Economics>> {
|
|
48
|
-
return await this.get('horizon/video-source/economics', { params })
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public async createVideoSource(body: Api_Video_Source_Create): Promise<Api_Video_Source_Search> {
|
|
52
|
-
return await this.post('horizon/video-source', body)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public async editVideoSource(id: string, body: Partial<Api_Video_Source_Create>): Promise<Api_Video_Source_Search> {
|
|
56
|
-
return await this.put(`/horizon/video-source/${id}`, body)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public async deleteVideoSource(id: string): Promise<void> {
|
|
60
|
-
await this.delete(`/horizon/video-source/${id}`)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public async fetchListRepairsVideoSource(params?: any): Promise<Api_Video_Source_By_Repair[]> {
|
|
64
|
-
return await this.get('work_zone/get_list_video_source_by_repair', { params })
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public async sendCombination(body: { cameras_id: string[] }): Promise<any> {
|
|
68
|
-
return await this.post('horizon/video-source/training', body)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public async saveCombination(body: any): Promise<any> {
|
|
72
|
-
return await this.post('horizon/video-source/bind', body)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public async fetchCombination(params?: Record<string, string>): Promise<Api_Video_Combination> {
|
|
76
|
-
return await this.get('horizon/video-source/bind/show', { params })
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public async startTraining(body: { cameras_id: string[] }): Promise<any> {
|
|
80
|
-
return await this.post('horizon/video-source/training/start', body)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public async stopTraining(body: { cameras_id: string[] }): Promise<any> {
|
|
84
|
-
return await this.post('horizon/video-source/training/stop', body)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public async fetchTrainingInfo(params?: Record<string, string>): Promise<any> {
|
|
88
|
-
return await this.get('horizon/video-source/training/info', { params })
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public async fetchTrainingStatus(params?: Record<string, string>): Promise<Api_Video_Training_Status> {
|
|
92
|
-
return await this.get('horizon/video-source/training/status', { params })
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public async fetchVisualizationDataLink(params?: Record<string, string>): Promise<string> {
|
|
96
|
-
return await this.get('horizon/video-source/link/video/training', { params })
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public async updateVisualizationData(params?: Record<string, string>): Promise<number> {
|
|
100
|
-
return await this.get('horizon/video-source/download/video/training', { params })
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public async deleteFrameFromVideo(id: string): Promise<void> {
|
|
104
|
-
await this.delete(`horizon/video-source/delete/fragment/video/training/${id}`)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Для тестирования ws видеостены
|
|
108
|
-
public async sendEvent(params?: Record<string, any>): Promise<number> {
|
|
109
|
-
return await this.post('alerts_callback_url', params)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let api: VideoService
|
|
114
|
-
|
|
115
|
-
export default function useVideoService() {
|
|
116
|
-
if (!api) api = new VideoService()
|
|
117
|
-
return api
|
|
118
|
-
}
|
|
1
|
+
import ApiService from '../settings/ApiService'
|
|
2
|
+
import { ResponseApi } from '@/api/types/Api_Service'
|
|
3
|
+
import {
|
|
4
|
+
Api_Video_Combination,
|
|
5
|
+
Api_Video_Source_By_Repair,
|
|
6
|
+
Api_Video_Source_Create,
|
|
7
|
+
Api_Video_Source_Economics,
|
|
8
|
+
Api_Video_Source_Search,
|
|
9
|
+
Api_Video_Training_Status,
|
|
10
|
+
Api_Work_Zone,
|
|
11
|
+
Api_Work_Zone_Search,
|
|
12
|
+
} from '@/api/types/Api_Video'
|
|
13
|
+
|
|
14
|
+
class VideoService extends ApiService {
|
|
15
|
+
public async startVideoAnalytics(): Promise<boolean> {
|
|
16
|
+
return await this.post('/statanly/start', null)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public reloadVideoAnalytics(ids: string[]): Promise<any> {
|
|
20
|
+
return this.post('/horizon/video-source/reload', { video_source_ids: ids })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public hardReloadStream(): Promise<any> {
|
|
24
|
+
return this.post('horizon/video-source/streams/add', null)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async fetchWorkZones(params?: any): Promise<ResponseApi<Api_Work_Zone_Search[]>> {
|
|
28
|
+
return await this.get('/search/work_zones', { params })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public async fetchWorkZone(id: string): Promise<ResponseApi<Api_Work_Zone>> {
|
|
32
|
+
return await this.get(`/work_zone/get_work_zone/${id}`)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public async editWorkZone(id: string, body: { title: string }): Promise<{ data: Api_Work_Zone; status: number }> {
|
|
36
|
+
return await this.put(`/admin/work-zones/${id}`, body)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public async deleteWorkZone(id: string): Promise<{ data: boolean; status: number }> {
|
|
40
|
+
return await this.delete(`/admin/work-zones/${id}`)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public async fetchVideoSources(params?: any): Promise<ResponseApi<Api_Video_Source_Search[]>> {
|
|
44
|
+
return await this.get('/search/video_sources/list', { params })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public async fetchVideoSourceEconomics(params?: any): Promise<ResponseApi<Api_Video_Source_Economics>> {
|
|
48
|
+
return await this.get('horizon/video-source/economics', { params })
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async createVideoSource(body: Api_Video_Source_Create): Promise<Api_Video_Source_Search> {
|
|
52
|
+
return await this.post('horizon/video-source', body)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public async editVideoSource(id: string, body: Partial<Api_Video_Source_Create>): Promise<Api_Video_Source_Search> {
|
|
56
|
+
return await this.put(`/horizon/video-source/${id}`, body)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public async deleteVideoSource(id: string): Promise<void> {
|
|
60
|
+
await this.delete(`/horizon/video-source/${id}`)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public async fetchListRepairsVideoSource(params?: any): Promise<Api_Video_Source_By_Repair[]> {
|
|
64
|
+
return await this.get('work_zone/get_list_video_source_by_repair', { params })
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public async sendCombination(body: { cameras_id: string[] }): Promise<any> {
|
|
68
|
+
return await this.post('horizon/video-source/training', body)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public async saveCombination(body: any): Promise<any> {
|
|
72
|
+
return await this.post('horizon/video-source/bind', body)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public async fetchCombination(params?: Record<string, string>): Promise<Api_Video_Combination> {
|
|
76
|
+
return await this.get('horizon/video-source/bind/show', { params })
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public async startTraining(body: { cameras_id: string[] }): Promise<any> {
|
|
80
|
+
return await this.post('horizon/video-source/training/start', body)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public async stopTraining(body: { cameras_id: string[] }): Promise<any> {
|
|
84
|
+
return await this.post('horizon/video-source/training/stop', body)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public async fetchTrainingInfo(params?: Record<string, string>): Promise<any> {
|
|
88
|
+
return await this.get('horizon/video-source/training/info', { params })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public async fetchTrainingStatus(params?: Record<string, string>): Promise<Api_Video_Training_Status> {
|
|
92
|
+
return await this.get('horizon/video-source/training/status', { params })
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public async fetchVisualizationDataLink(params?: Record<string, string>): Promise<string> {
|
|
96
|
+
return await this.get('horizon/video-source/link/video/training', { params })
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public async updateVisualizationData(params?: Record<string, string>): Promise<number> {
|
|
100
|
+
return await this.get('horizon/video-source/download/video/training', { params })
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public async deleteFrameFromVideo(id: string): Promise<void> {
|
|
104
|
+
await this.delete(`horizon/video-source/delete/fragment/video/training/${id}`)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Для тестирования ws видеостены
|
|
108
|
+
public async sendEvent(params?: Record<string, any>): Promise<number> {
|
|
109
|
+
return await this.post('alerts_callback_url', params)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let api: VideoService
|
|
114
|
+
|
|
115
|
+
export default function useVideoService() {
|
|
116
|
+
if (!api) api = new VideoService()
|
|
117
|
+
return api
|
|
118
|
+
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
|
2
|
-
import { Api_Auth_Login } from '@/api/types/Api_Auth'
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line
|
|
5
|
-
var isRefreshing = false
|
|
6
|
-
|
|
7
|
-
interface Api_Auth_Refresh {
|
|
8
|
-
accessToken: string
|
|
9
|
-
}
|
|
10
2
|
|
|
11
3
|
export enum ApiServiceType {
|
|
12
4
|
SERVICE_AUTH = 'SERVICE_AUTH',
|
|
@@ -14,7 +6,6 @@ export enum ApiServiceType {
|
|
|
14
6
|
|
|
15
7
|
export default class ApiService {
|
|
16
8
|
private axiosInstance: AxiosInstance
|
|
17
|
-
private refreshSubscribers: any[] = []
|
|
18
9
|
|
|
19
10
|
constructor() {
|
|
20
11
|
this.axiosInstance = axios.create({
|
|
@@ -23,12 +14,14 @@ export default class ApiService {
|
|
|
23
14
|
'Content-Type': 'application/json',
|
|
24
15
|
Accept: 'application/json',
|
|
25
16
|
},
|
|
26
|
-
withCredentials: true,
|
|
27
17
|
})
|
|
28
18
|
|
|
29
19
|
this.axiosInstance.interceptors.request.use(
|
|
30
20
|
(config: InternalAxiosRequestConfig) => {
|
|
31
|
-
|
|
21
|
+
const token = this.getToken()
|
|
22
|
+
if (token && config.headers) {
|
|
23
|
+
config.headers.Authorization = `Bearer ${token}`
|
|
24
|
+
}
|
|
32
25
|
return config
|
|
33
26
|
},
|
|
34
27
|
(error: AxiosError) => {
|
|
@@ -40,57 +33,16 @@ export default class ApiService {
|
|
|
40
33
|
(response: AxiosResponse) => {
|
|
41
34
|
return response.data
|
|
42
35
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
error.response?.status !== 401 ||
|
|
48
|
-
originalRequest.url === '/v2/auth/refresh' ||
|
|
49
|
-
originalRequest.url === '/v2/login' ||
|
|
50
|
-
originalRequest._retry
|
|
51
|
-
) {
|
|
52
|
-
alert('sssssss' + originalRequest.url)
|
|
53
|
-
return Promise.reject(error)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
originalRequest._retry = true
|
|
57
|
-
|
|
58
|
-
alert(isRefreshing)
|
|
59
|
-
|
|
60
|
-
if (isRefreshing) {
|
|
61
|
-
alert(originalRequest.url)
|
|
62
|
-
return new Promise(resolve => {
|
|
63
|
-
this.subscribeTokenRefresh(() => resolve(this.axiosInstance(originalRequest)))
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
isRefreshing = true
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const response = await this.refresh()
|
|
71
|
-
|
|
72
|
-
const newToken = response.accessToken
|
|
73
|
-
if (!newToken) {
|
|
74
|
-
this.logoutUser()
|
|
75
|
-
return Promise.reject(error)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
this.setAccessToken(newToken)
|
|
79
|
-
this.onRefreshed()
|
|
80
|
-
isRefreshing = false
|
|
81
|
-
return this.axiosInstance(originalRequest)
|
|
82
|
-
} catch (e) {
|
|
83
|
-
this.logoutUser()
|
|
84
|
-
return Promise.reject(e)
|
|
36
|
+
(error: AxiosError) => {
|
|
37
|
+
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
38
|
+
this.logout()
|
|
85
39
|
}
|
|
40
|
+
return Promise.reject(error)
|
|
86
41
|
},
|
|
87
42
|
)
|
|
88
43
|
}
|
|
89
44
|
|
|
90
|
-
private
|
|
91
|
-
localStorage.setItem('token', token)
|
|
92
|
-
}
|
|
93
|
-
private getAccessToken() {
|
|
45
|
+
private getToken() {
|
|
94
46
|
return localStorage.getItem('token')
|
|
95
47
|
}
|
|
96
48
|
|
|
@@ -98,22 +50,7 @@ export default class ApiService {
|
|
|
98
50
|
localStorage.removeItem('token')
|
|
99
51
|
}
|
|
100
52
|
|
|
101
|
-
|
|
102
|
-
this.refreshSubscribers.push(cb)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private refresh(): Promise<Api_Auth_Refresh> {
|
|
106
|
-
return this.post<null, Api_Auth_Login>(`/v2/auth/refresh`, null)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private onRefreshed() {
|
|
110
|
-
this.refreshSubscribers.forEach(cb => cb())
|
|
111
|
-
this.refreshSubscribers = []
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public logoutUser(): any {
|
|
115
|
-
isRefreshing = false
|
|
116
|
-
this.post<any, any>(`/v2/logout`, {})
|
|
53
|
+
public logout(): void {
|
|
117
54
|
this.removeToken()
|
|
118
55
|
window.location.href = '/sign-in'
|
|
119
56
|
}
|
|
@@ -72,15 +72,6 @@ export type Api_Auth_User = {
|
|
|
72
72
|
roles: Api_Auth_User_Role[]
|
|
73
73
|
security_warnings: any[]
|
|
74
74
|
teams: Api_Auth_User_Team[]
|
|
75
|
-
avatar: null
|
|
76
|
-
change_password: null
|
|
77
|
-
created_at: string
|
|
78
|
-
deleted_at: null
|
|
79
|
-
face_recognition_id: null
|
|
80
|
-
password_change_available_at: string
|
|
81
|
-
password_change_due_at: string
|
|
82
|
-
password_last_changed_at: string
|
|
83
|
-
updated_at: string
|
|
84
75
|
}
|
|
85
76
|
|
|
86
77
|
export type Api_Auth_Login = {
|
|
@@ -93,13 +84,6 @@ export type ChangePasswordPayload = {
|
|
|
93
84
|
password_confirmation: string
|
|
94
85
|
}
|
|
95
86
|
|
|
96
|
-
export type ChangePasswordAndActivatePayload = {
|
|
97
|
-
email: string
|
|
98
|
-
currentPassword: string
|
|
99
|
-
password: string
|
|
100
|
-
passwordConfirmation: string
|
|
101
|
-
}
|
|
102
|
-
|
|
103
87
|
export type ChangePasswordResponse = Pick<
|
|
104
88
|
Api_User,
|
|
105
89
|
| 'id'
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
export type Api_Metrics_Unused_Personnel = {
|
|
2
|
-
position_name: string | null
|
|
3
|
-
brigade_name: string | null
|
|
4
|
-
full_name: string | null
|
|
5
|
-
}
|
|
1
|
+
export type Api_Metrics_Unused_Personnel = {
|
|
2
|
+
position_name: string | null
|
|
3
|
+
brigade_name: string | null
|
|
4
|
+
full_name: string | null
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type Api_Metrics_Personnel_Plan_User = {
|
|
8
|
+
user_id: string
|
|
9
|
+
full_name: string
|
|
10
|
+
position_id: string
|
|
11
|
+
position_name: string
|
|
12
|
+
position_display_name: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Api_Metrics_Personnel_Plan_Position = {
|
|
16
|
+
position_id: string
|
|
17
|
+
position_name: string
|
|
18
|
+
position_display_name: string
|
|
19
|
+
count: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Api_Metrics_Personnel_Plan = {
|
|
23
|
+
engaged: Api_Metrics_Personnel_Plan_User[]
|
|
24
|
+
fixed_repair: Api_Metrics_Personnel_Plan_Position[]
|
|
25
|
+
ready: Api_Metrics_Personnel_Plan_User[]
|
|
26
|
+
}
|