shared-ritm 1.1.8 → 1.1.10
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/types/index.d.ts +3 -3
- package/package.json +10 -9
- package/src/App.vue +2411 -0
- package/src/api/services/AuthService.ts +41 -0
- package/src/api/services/GanttService.ts +17 -0
- package/src/api/services/MetricsService.ts +101 -0
- package/src/api/services/ProjectsService.ts +57 -0
- package/src/api/services/RepairsService.ts +82 -0
- package/src/api/services/TasksService.ts +27 -0
- package/src/api/settings/ApiService.ts +124 -0
- package/src/api/types/Api_Metrics.ts +0 -0
- package/src/api/types/Api_Projects.ts +33 -0
- package/src/api/types/Api_Repairs.ts +57 -0
- package/src/api/types/Api_Tasks.ts +124 -0
- package/src/common/app-button/AppButton.vue +173 -0
- package/src/common/app-checkbox/AppCheckbox.vue +26 -0
- package/src/common/app-date-picker/AppDatePicker.vue +66 -0
- package/src/common/app-icon/AppIcon.vue +104 -0
- package/src/common/app-input/AppInput.vue +147 -0
- package/src/common/app-input-search/AppInputSearch.vue +170 -0
- package/src/common/app-layout/AppLayout.vue +62 -0
- package/src/common/app-layout/components/AppLayoutHeader.vue +124 -0
- package/src/common/app-loader/index.vue +43 -0
- package/src/common/app-page-layout/AppPageLayout.vue +122 -0
- package/src/common/app-select/AppSelect.vue +157 -0
- package/src/common/app-sheet/AppSheet.vue +114 -0
- package/src/common/app-sidebar/AppSidebar.vue +167 -0
- package/src/common/app-sidebar/components/SidebarMenu.vue +29 -0
- package/src/common/app-sidebar/components/SidebarMenuItem.vue +137 -0
- package/src/common/app-toggle/AppToggle.vue +23 -0
- package/src/common/app-wrapper/AppWrapper.vue +28 -0
- package/src/global.d.ts +1 -0
- package/src/icons/components/arrow-down-icon.vue +25 -0
- package/src/icons/components/arrow-frame-icon.vue +19 -0
- package/src/icons/components/arrow-square.vue +22 -0
- package/src/icons/header/flashIcon.vue +24 -0
- package/src/icons/header/notificationIcon.vue +18 -0
- package/src/icons/header/searchStatusIcon.vue +24 -0
- package/src/icons/header/smallCapsIcon.vue +34 -0
- package/src/icons/sidebar/assign-module-icon.vue +36 -0
- package/src/icons/sidebar/instrument-history-icon.vue +32 -0
- package/src/icons/sidebar/instrument-order-icon.vue +38 -0
- package/src/icons/sidebar/instrument-work-zone-icon.vue +18 -0
- package/src/icons/sidebar/instruments-icon.vue +45 -0
- package/src/icons/sidebar/logo-icon.vue +15 -0
- package/src/icons/sidebar/logout-icon.vue +13 -0
- package/src/icons/sidebar/modules-icon.vue +16 -0
- package/src/icons/sidebar/notifications-icon.vue +24 -0
- package/src/icons/sidebar/order-icon.vue +44 -0
- package/src/icons/sidebar/pass-icon.vue +38 -0
- package/src/icons/sidebar/positions-icon.vue +42 -0
- package/src/icons/sidebar/preorder-icon.vue +19 -0
- package/src/icons/sidebar/projects-icon.vue +31 -0
- package/src/icons/sidebar/repair-object-icon.vue +18 -0
- package/src/icons/sidebar/repairs-icon.vue +20 -0
- package/src/icons/sidebar/roles-icon.vue +26 -0
- package/src/icons/sidebar/status-history-icon.vue +24 -0
- package/src/icons/sidebar/tasks-icon.vue +28 -0
- package/src/icons/sidebar/tasks_tasks-icon.vue +39 -0
- package/src/icons/sidebar/tasks_today-icon.vue +27 -0
- package/src/icons/sidebar/teams-icon.vue +32 -0
- package/src/icons/sidebar/user-icon.vue +18 -0
- package/src/icons/sidebar/users-icon.vue +46 -0
- package/src/icons/sidebar/videosources-icon.vue +19 -0
- package/src/icons/sidebar/videowall-icon.vue +13 -0
- package/src/icons/sidebar/videozones-icon.vue +21 -0
- package/src/icons/sidebar/warehouses-icon.vue +43 -0
- package/src/icons/sidebar/workshop-icon.vue +100 -0
- package/src/icons/sidebar/workzones-icon.vue +22 -0
- package/src/index.ts +57 -0
- package/src/main.ts +15 -0
- package/src/quasar-user-options.ts +17 -0
- package/src/shared/fonts/Montserrat-Bold.ttf +0 -0
- package/src/shared/fonts/Montserrat.ttf +0 -0
- package/src/shared/fonts/NunitoSansFont.ttf +0 -0
- package/src/shared/fonts/NunitoSans_7pt-Bold.ttf +0 -0
- package/src/shared/styles/general.css +96 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/styles/variables.sass +12 -0
- package/src/utils/notification.ts +13 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService'
|
|
2
|
+
|
|
3
|
+
type LoginPayload = {
|
|
4
|
+
email: string
|
|
5
|
+
password: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type LoginResponse = {
|
|
9
|
+
token: string
|
|
10
|
+
user: any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type ConfigResponse = any
|
|
14
|
+
|
|
15
|
+
class AuthService extends ApiService {
|
|
16
|
+
public login(email: string, password: string) {
|
|
17
|
+
return this.post<LoginPayload, LoginResponse>(`/login`, {
|
|
18
|
+
email,
|
|
19
|
+
password,
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public logout() {
|
|
24
|
+
return this.post<null, LoginResponse>(`/logout`, null)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public userInfo() {
|
|
28
|
+
return this.get<any>(`/users/auth`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public configs() {
|
|
32
|
+
return this.get<ConfigResponse>(`/configs`)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let api: AuthService
|
|
37
|
+
|
|
38
|
+
export default function useAuthService() {
|
|
39
|
+
if (!api) api = new AuthService()
|
|
40
|
+
return api
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService'
|
|
2
|
+
|
|
3
|
+
class GanttService extends ApiService {
|
|
4
|
+
public async fetchCriticalPathTasks(params: string): Promise<any> {
|
|
5
|
+
return await this.get(`gantt/get_list_task_on_critical_path?${params}`)
|
|
6
|
+
}
|
|
7
|
+
public async fetchGanttList(params: string): Promise<any> {
|
|
8
|
+
return await this.get(`/gantt/tasks?${params}`)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let api: GanttService
|
|
13
|
+
|
|
14
|
+
export default function useGanttService() {
|
|
15
|
+
if (!api) api = new GanttService()
|
|
16
|
+
return api
|
|
17
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService'
|
|
2
|
+
|
|
3
|
+
class MetricsService extends ApiService {
|
|
4
|
+
public async fetchPieProjects(queryString: string): Promise<ResponseApi<any>> {
|
|
5
|
+
return await this.get('repairs/pie/projects' + '?' + queryString)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
public async fetchPieTasks(queryString: string): Promise<ResponseApi<any>> {
|
|
9
|
+
return await this.get('repairs/pie/tasks' + '?' + queryString)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async fetchPiePersonnel(queryString: string): Promise<ResponseApi<any>> {
|
|
13
|
+
return await this.get('repairs/metrics/get_list_position' + '?' + queryString)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async fetchPersonnelData(queryString: string): Promise<ResponseApi<any>> {
|
|
17
|
+
return await this.get('repairs/metrics/list_position_intersection_group_by_status' + '?' + queryString)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async fetchPersonnelInfo(params: string): Promise<ResponseApi<any>> {
|
|
21
|
+
return await this.get(`repairs/metrics/list_position_intersection_details?${params}`)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public async fetchPiePersonnelInfo(params: string): Promise<any> {
|
|
25
|
+
return await this.get(`repairs/metrics/get_list_user_by_position?${params}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async fetchPieCriticalPath(queryString: string): Promise<any[]> {
|
|
29
|
+
return await this.get('repairs/metrics/get_critical_path_group_by_status' + '?' + queryString)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async fetchPieCriticalPathInfo(params: string): Promise<any> {
|
|
33
|
+
return await this.get(`repairs/metrics/get_list_task_critical_path_by_status?${params}`)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async fetchPieTmc(queryString: string): Promise<ResponseApi<any>> {
|
|
37
|
+
return await this.get('repairs/metrics/get_list_instrument_type' + '?' + queryString)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async fetchPieTmcInfo(params: string): Promise<any> {
|
|
41
|
+
return await this.get(`repairs/metrics/get_list_warehouse_by_instrument_type?${params}`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public async fetchPieUntimelyClosedTask(queryString: string): Promise<any[]> {
|
|
45
|
+
return await this.get('repairs/metrics/get_list_comment_type' + '?' + queryString)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async fetchPieUntimelyClosedTaskInfo(params: string): Promise<any> {
|
|
49
|
+
return await this.get(`repairs/metrics/get_list_task_by_comment_type?${params}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public async fetchPieAdditionalTasks(queryString: string): Promise<any[]> {
|
|
53
|
+
return await this.get('repairs/metrics/get_list_task_after_plan_fixate_group_by_status' + '?' + queryString)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public async fetchPieAdditionalTasksInfo(params: string): Promise<any> {
|
|
57
|
+
return await this.get(`repairs/metrics/get_list_task_after_plan_fixate_by_status?${params}`)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public async fetchPersonnel(queryString: string): Promise<any[]> {
|
|
61
|
+
return await this.get('repairs/statistic/personnel' + '?' + queryString)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public async fetchPieExpired(queryString: string): Promise<any[]> {
|
|
65
|
+
return await this.get('repairs/metrics/get_list_task_expired_group_by_status' + '?' + queryString)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public async fetchPieExpiredInfo(params: string): Promise<any> {
|
|
69
|
+
return await this.get(`repairs/metrics/get_list_task_expired?${params}`)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public async fetchEconomicsPerformance(params: string): Promise<any> {
|
|
73
|
+
return await this.get(`repairs/metrics/get_economic_performance?${params}`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public async fetchEconomicsInfo(params: string): Promise<any> {
|
|
77
|
+
return await this.get(`repairs/metrics/get_list_task_economic_performance?${params}`)
|
|
78
|
+
}
|
|
79
|
+
public async fetchQualityMetrics(params: string): Promise<any> {
|
|
80
|
+
return await this.get(`repairs/metrics/get_quality_metrics?${params}`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public async fetchQualityInfo(params: string): Promise<any> {
|
|
84
|
+
return await this.get(`repairs/metrics/get_list_task_by_quality?${params}`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public async fetchPieWorkZone(queryString: string): Promise<ResponseApi<any>> {
|
|
88
|
+
return await this.get('repairs/metrics/get_list_work_zone_instrument' + '?' + queryString)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public async fetchWorkZoneInfo(queryString: string): Promise<ResponseApi<any>> {
|
|
92
|
+
return await this.get('repairs/metrics/get_list_work_zone_instrument_by_status' + '?' + queryString)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let api: MetricsService
|
|
97
|
+
|
|
98
|
+
export default function useMetricsService() {
|
|
99
|
+
if (!api) api = new MetricsService()
|
|
100
|
+
return api
|
|
101
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService'
|
|
2
|
+
|
|
3
|
+
import { Api_Project_Dto } from '@/api/types/Api_Projects'
|
|
4
|
+
|
|
5
|
+
class ProjectsService extends ApiService {
|
|
6
|
+
public async fetchProjectById(id: string): Promise<ResponseApi<Api_Project_Dto>> {
|
|
7
|
+
return this.get(`/projects/${id}`)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public createProject(params: any): Promise<ResponseApi<any>> {
|
|
11
|
+
return this.post<any, ResponseApi<any>>('/projects', params)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public editProject(id: string, params: any): Promise<ResponseApi<any>> {
|
|
15
|
+
return this.put<any, ResponseApi<any>>(`/projects/${id}`, params)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public fetchProjects(params: any): Promise<ResponseApi<Api_Project_Dto[]>> {
|
|
19
|
+
return this.get(`/get_list_project`, { params })
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public cloneProject(project: any): Promise<ResponseApi<any>> {
|
|
23
|
+
return this.post<any, ResponseApi<any>>(`projects/${project.id}/clone`, project)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public archiveProject(id: string, data: any): Promise<ResponseApi<any>> {
|
|
27
|
+
return this.put<any, ResponseApi<any>>(`/projects/${id}`, data)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public unArchiveProject(id: string, data: any): Promise<ResponseApi<any>> {
|
|
31
|
+
return this.put<any, ResponseApi<any>>(`/projects/${id}`, data)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public moveAprProject(id: string): Promise<ResponseApi<any>> {
|
|
35
|
+
return this.post<any, ResponseApi<any>>('repairs/move_plan_to_real', {
|
|
36
|
+
repairs: [id],
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
public restoreProject(id: string): Promise<ResponseApi<any>> {
|
|
40
|
+
return this.post<any, ResponseApi<any>>('/restore_project', { projects_ids: [id] })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public importTasks(payload: any): Promise<ResponseApi<any>> {
|
|
44
|
+
return this.post<any, ResponseApi<any>>('tasks/import', payload)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public fetchProjectTeamList(id: string): Promise<ResponseApi<any>> {
|
|
48
|
+
return this.put<any, ResponseApi<any>>(`/projects/${id}`, null)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let api: ProjectsService
|
|
53
|
+
|
|
54
|
+
export default function useProjectsService() {
|
|
55
|
+
if (!api) api = new ProjectsService()
|
|
56
|
+
return api
|
|
57
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService'
|
|
2
|
+
import {
|
|
3
|
+
Api_Create_Repair_With_Equipments,
|
|
4
|
+
Api_Equipment_Full_Dto,
|
|
5
|
+
Api_Repair_Dto,
|
|
6
|
+
Api_Update_Repair,
|
|
7
|
+
OptionFilters,
|
|
8
|
+
} from '@/api/types/Api_Repairs'
|
|
9
|
+
|
|
10
|
+
class RepairsService extends ApiService {
|
|
11
|
+
public fetchFilters(fullParams: string): Promise<OptionFilters> {
|
|
12
|
+
return this.get(`get_list_repair?smart=1&${fullParams}`)
|
|
13
|
+
}
|
|
14
|
+
public fetchRepairs(
|
|
15
|
+
isQuery: boolean,
|
|
16
|
+
queries?: string,
|
|
17
|
+
hasTeams?: boolean | string,
|
|
18
|
+
teamsFilter?: string,
|
|
19
|
+
typeFilter?: string,
|
|
20
|
+
): Promise<ResponseApi<Api_Repair_Dto[]>> {
|
|
21
|
+
return this.get(
|
|
22
|
+
'get_list_repair' +
|
|
23
|
+
(isQuery
|
|
24
|
+
? `${queries}&per_page=100000${typeFilter ? '&' + typeFilter : ''}&${!hasTeams ? teamsFilter : ''}`
|
|
25
|
+
: `?per_page=100000${typeFilter ? '&' + typeFilter : ''}&${teamsFilter}`),
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
public fetchEquipment(): Promise<ResponseApi<Api_Equipment_Full_Dto[]>> {
|
|
29
|
+
return this.get('repairs/equipment/list?per_page=100000')
|
|
30
|
+
}
|
|
31
|
+
public createRepair(payload: Api_Create_Repair_With_Equipments) {
|
|
32
|
+
return this.post<Api_Create_Repair_With_Equipments, any>('/repairs/equipments', payload)
|
|
33
|
+
}
|
|
34
|
+
public startRepair(id: string): Promise<void> {
|
|
35
|
+
return this.post<null, void>(`/repairs/${id}/start`, null)
|
|
36
|
+
}
|
|
37
|
+
public finishRepair(id: string) {
|
|
38
|
+
return this.post<null, void>(`/repairs/${id}/finish`, null)
|
|
39
|
+
}
|
|
40
|
+
public finishPreparationProject(id: string) {
|
|
41
|
+
return this.post<null, void>(`/repairs/${id}/finish_preparation`, null)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public moveRepairToCurrent(id: string) {
|
|
45
|
+
return this.post<any, void>(`/repairs/transfer_repair_plan_to_current`, {
|
|
46
|
+
repairs: [id],
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
public moveArchiveToCurrent(id: string) {
|
|
50
|
+
return this.post<any, void>(`/repairs/transfer_repair_archive_to_current`, {
|
|
51
|
+
repairs_ids: [id],
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
public moveRepairToApr(id: string) {
|
|
55
|
+
return this.post<any, void>(`/repairs/transfer_repair_current_to_plan`, {
|
|
56
|
+
repairs: [id],
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
public moveRepairToArchive(id: string) {
|
|
60
|
+
return this.post<any, void>(`/repairs/transfer_repair_current_to_archive`, {
|
|
61
|
+
repairs_ids: [id],
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
public restoreRepair(id: string) {
|
|
65
|
+
return this.post<any, void>(`/restore_repair`, {
|
|
66
|
+
repairs_ids: [id],
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
public updateRepair(payload: Api_Update_Repair, id: string) {
|
|
70
|
+
return this.put<Api_Update_Repair, void>(`/repairs/${id}`, payload)
|
|
71
|
+
}
|
|
72
|
+
public deleteRepair(id: string) {
|
|
73
|
+
return this.delete<any>(`/repairs/${id}`)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let api: RepairsService
|
|
78
|
+
|
|
79
|
+
export default function useRepairsService() {
|
|
80
|
+
if (!api) api = new RepairsService()
|
|
81
|
+
return api
|
|
82
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ApiService, { ResponseApi } from '@/api/settings/ApiService'
|
|
2
|
+
import { Api_Tasks_Dto, Api_Tasks_Task_Dto } from '@/api/types/Api_Tasks'
|
|
3
|
+
|
|
4
|
+
class TasksService extends ApiService {
|
|
5
|
+
public async fetchTaskById(id: string): Promise<ResponseApi<Api_Tasks_Task_Dto>> {
|
|
6
|
+
return await this.get(`/tasks/${id}`)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public async fetchTasksList(params: any): Promise<ResponseApi<Api_Tasks_Dto[]>> {
|
|
10
|
+
return await this.get('/list/tasks/search', { params })
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async fetchSubtasksList(id: string): Promise<ResponseApi<Api_Tasks_Dto[]>> {
|
|
14
|
+
return await this.get(`/task/${id}/subtasks/list`)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async fetchTaskBranch(id: string): Promise<ResponseApi<any>> {
|
|
18
|
+
return await this.get(`/get_list_task_branch?task_id=${id}`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let api: TasksService
|
|
23
|
+
|
|
24
|
+
export default function useTasksService() {
|
|
25
|
+
if (!api) api = new TasksService()
|
|
26
|
+
return api
|
|
27
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
|
2
|
+
|
|
3
|
+
export enum ApiServiceType {
|
|
4
|
+
SERVICE_AUTH = 'SERVICE_AUTH',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type ResponseApi<T> = {
|
|
8
|
+
count: number
|
|
9
|
+
current_page: number
|
|
10
|
+
data: T
|
|
11
|
+
per_page: number
|
|
12
|
+
total: number
|
|
13
|
+
total_pages: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default class ApiService {
|
|
17
|
+
private axiosInstance: AxiosInstance
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
this.axiosInstance = axios.create({
|
|
21
|
+
baseURL: process.env.VUE_APP_BACKEND,
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
this.axiosInstance.interceptors.request.use(
|
|
28
|
+
(config: InternalAxiosRequestConfig) => {
|
|
29
|
+
const token = this.getToken()
|
|
30
|
+
if (token && config.headers) {
|
|
31
|
+
config.headers.Authorization = `Bearer ${token}`
|
|
32
|
+
}
|
|
33
|
+
return config
|
|
34
|
+
},
|
|
35
|
+
(error: AxiosError) => {
|
|
36
|
+
return Promise.reject(error)
|
|
37
|
+
},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
this.axiosInstance.interceptors.response.use(
|
|
41
|
+
(response: AxiosResponse) => {
|
|
42
|
+
return response.data
|
|
43
|
+
},
|
|
44
|
+
(error: AxiosError) => {
|
|
45
|
+
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
46
|
+
this.logout()
|
|
47
|
+
}
|
|
48
|
+
return Promise.reject(error)
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
private getToken() {
|
|
53
|
+
return localStorage.getItem('token')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private removeToken() {
|
|
57
|
+
localStorage.removeItem('token')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public logout(): void {
|
|
61
|
+
this.removeToken()
|
|
62
|
+
window.location.href = '/sign-in'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private handleError(error: AxiosError): void {
|
|
66
|
+
if (error.response) {
|
|
67
|
+
console.error('API Error:', error.response.status, error.response.data)
|
|
68
|
+
} else if (error.request) {
|
|
69
|
+
console.error('No response received:', error.request)
|
|
70
|
+
} else {
|
|
71
|
+
console.error('Error during request setup:', error.message)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected async get<T>(url: string, options?: AxiosRequestConfig) {
|
|
76
|
+
try {
|
|
77
|
+
const response: AxiosResponse<T> = await this.axiosInstance.get<T>(url, options)
|
|
78
|
+
return response?.data ?? (response as unknown as T)
|
|
79
|
+
} catch (error) {
|
|
80
|
+
const axiosError = error as AxiosError
|
|
81
|
+
this.handleError(axiosError)
|
|
82
|
+
throw error
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
protected async delete<T>(url: string, options?: AxiosRequestConfig) {
|
|
87
|
+
try {
|
|
88
|
+
return await this.axiosInstance.delete<T>(url, options)
|
|
89
|
+
} catch (error) {
|
|
90
|
+
const axiosError = error as AxiosError
|
|
91
|
+
this.handleError(axiosError)
|
|
92
|
+
throw error
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
protected async post<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
97
|
+
try {
|
|
98
|
+
const response: AxiosResponse<T2> = await this.axiosInstance.post<T1, AxiosResponse<T2>>(url, payload, options)
|
|
99
|
+
return response.data
|
|
100
|
+
} catch (error) {
|
|
101
|
+
const axiosError = error as AxiosError
|
|
102
|
+
this.handleError(axiosError)
|
|
103
|
+
throw error
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// protected patch<T1, T2>(url: string, payload: T1, type: ApiServiceType, options?: AxiosRequestConfig): Promise<T2> {
|
|
108
|
+
// return axios
|
|
109
|
+
// .patch<T1, AxiosResponse<T2>>(apiServiceUrls[type] + url, payload, options)
|
|
110
|
+
// .catch((err: AxiosError) => processError401<T2>(err))
|
|
111
|
+
// .then(extractData)
|
|
112
|
+
// }
|
|
113
|
+
//
|
|
114
|
+
protected async put<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
115
|
+
try {
|
|
116
|
+
const response: AxiosResponse<T2> = await this.axiosInstance.put<T1, AxiosResponse<T2>>(url, payload, options)
|
|
117
|
+
return response.data
|
|
118
|
+
} catch (error) {
|
|
119
|
+
const axiosError = error as AxiosError
|
|
120
|
+
this.handleError(axiosError)
|
|
121
|
+
throw error
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type Api_Project_Repair = {
|
|
2
|
+
id: string
|
|
3
|
+
name: string
|
|
4
|
+
start_date: null | string
|
|
5
|
+
end_date: null | string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type Api_Project_Team = {
|
|
9
|
+
id: string
|
|
10
|
+
name: string
|
|
11
|
+
display_name: string
|
|
12
|
+
description: string
|
|
13
|
+
created_at: string
|
|
14
|
+
updated_at: string
|
|
15
|
+
pivot: {
|
|
16
|
+
project_id: string
|
|
17
|
+
team_id: string
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type Api_Project_Dto = {
|
|
22
|
+
id: string
|
|
23
|
+
name: string
|
|
24
|
+
description: null
|
|
25
|
+
image: null
|
|
26
|
+
start_date: string
|
|
27
|
+
end_date: string
|
|
28
|
+
is_archive: false
|
|
29
|
+
teams: Api_Project_Team[]
|
|
30
|
+
category: number
|
|
31
|
+
deleted_at: null
|
|
32
|
+
repair: Api_Project_Repair
|
|
33
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type Api_Team = {
|
|
2
|
+
id: string
|
|
3
|
+
display_name: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type Api_Equipment_Short_Dto = {
|
|
7
|
+
id: string
|
|
8
|
+
name: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type Api_Repairs = {
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type Api_Projects = {
|
|
17
|
+
id: string
|
|
18
|
+
name: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type OptionFilters = {
|
|
22
|
+
teams?: Api_Team[]
|
|
23
|
+
equipments?: Api_Equipment_Short_Dto[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Api_Equipment_Full_Dto = {
|
|
27
|
+
id: string
|
|
28
|
+
model: null | string
|
|
29
|
+
name: string
|
|
30
|
+
registration_number: string
|
|
31
|
+
repair_frequency: number
|
|
32
|
+
repair_range: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type Api_Create_Repair_With_Equipments = {
|
|
36
|
+
name: string
|
|
37
|
+
display_name: string
|
|
38
|
+
description: string
|
|
39
|
+
equipment_id: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type Api_Update_Repair = {
|
|
43
|
+
name?: string
|
|
44
|
+
display_name?: string
|
|
45
|
+
description: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Api_Repair_Dto = {
|
|
49
|
+
id: string
|
|
50
|
+
name: string
|
|
51
|
+
display_name: string
|
|
52
|
+
description: string
|
|
53
|
+
start_date: string
|
|
54
|
+
end_date: string
|
|
55
|
+
projects: Api_Projects[]
|
|
56
|
+
equipments: Api_Equipment_Full_Dto[]
|
|
57
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export type Api_Tasks_Responsible_Dto = {
|
|
2
|
+
id: string
|
|
3
|
+
first_name: string
|
|
4
|
+
last_name: string
|
|
5
|
+
patronymic: string
|
|
6
|
+
full_name: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type Api_Tasks_Assigned_Dto = {
|
|
10
|
+
id: string
|
|
11
|
+
first_name: string
|
|
12
|
+
last_name: string
|
|
13
|
+
patronymic: null | string
|
|
14
|
+
full_name: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Api_Tasks_Status_Dto = {
|
|
18
|
+
id: string
|
|
19
|
+
name: string
|
|
20
|
+
title: string
|
|
21
|
+
}
|
|
22
|
+
export type Api_Tasks_Project_Dto = {
|
|
23
|
+
id: string
|
|
24
|
+
name: string
|
|
25
|
+
teams: string[]
|
|
26
|
+
}
|
|
27
|
+
export type Api_Tasks_Position_Dto = {
|
|
28
|
+
id: string
|
|
29
|
+
name: string
|
|
30
|
+
display_name: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type Api_Tasks_Position_Assigned_Dto = {
|
|
34
|
+
id: number
|
|
35
|
+
user: {
|
|
36
|
+
id: string
|
|
37
|
+
full_name: string
|
|
38
|
+
}
|
|
39
|
+
position: Api_Tasks_Position_Dto
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type Api_Tasks_Teams_Dto = {
|
|
43
|
+
id: string
|
|
44
|
+
name: string
|
|
45
|
+
display_name: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Api_Tasks_Equipment_Dto = {
|
|
49
|
+
id: string
|
|
50
|
+
name: string
|
|
51
|
+
model: string
|
|
52
|
+
registration_number: string
|
|
53
|
+
created_at: string
|
|
54
|
+
updated_at: string
|
|
55
|
+
repair_frequency: number
|
|
56
|
+
repair_range: number
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type Api_Tasks_Task_Dto = {
|
|
60
|
+
id: string
|
|
61
|
+
name: string
|
|
62
|
+
type: string
|
|
63
|
+
project_id: string
|
|
64
|
+
description: string
|
|
65
|
+
subtask_counter: number
|
|
66
|
+
subtasks: Api_Tasks_Task_Dto[]
|
|
67
|
+
state_id: null | string
|
|
68
|
+
start_date: string
|
|
69
|
+
end_date: string
|
|
70
|
+
deadline: string
|
|
71
|
+
plan_date: string
|
|
72
|
+
time_to_complete: null | string | number
|
|
73
|
+
time_to_complete_sec: number
|
|
74
|
+
priority: number
|
|
75
|
+
work_zone_id: null | string
|
|
76
|
+
location_id: null | string
|
|
77
|
+
target: any
|
|
78
|
+
status: Api_Tasks_Status_Dto
|
|
79
|
+
project: Api_Tasks_Project_Dto
|
|
80
|
+
position: Api_Tasks_Position_Dto[]
|
|
81
|
+
assigned: Api_Tasks_Assigned_Dto[]
|
|
82
|
+
instruments: any[]
|
|
83
|
+
warehouse: any[]
|
|
84
|
+
responsible: Api_Tasks_Responsible_Dto[]
|
|
85
|
+
position_assigned: Api_Tasks_Position_Assigned_Dto[]
|
|
86
|
+
comments: any[]
|
|
87
|
+
files: any[]
|
|
88
|
+
teams: Api_Tasks_Teams_Dto[]
|
|
89
|
+
work_zone: string
|
|
90
|
+
planned_start: null | string
|
|
91
|
+
planned_end: null | string
|
|
92
|
+
fact_start_date: string
|
|
93
|
+
fact_end_date: null | string
|
|
94
|
+
work_sec: number
|
|
95
|
+
pause_sec: number
|
|
96
|
+
repair_object: null | string
|
|
97
|
+
isPause: boolean
|
|
98
|
+
equipment: Api_Tasks_Equipment_Dto[]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type Api_Tasks_Simple_Responsible_Dto = {
|
|
102
|
+
id: string
|
|
103
|
+
full_name: string
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type Api_Tasks_Dto = {
|
|
107
|
+
id: string
|
|
108
|
+
name: string
|
|
109
|
+
plan_date: null | string
|
|
110
|
+
deadline: null | string
|
|
111
|
+
priority: number
|
|
112
|
+
subtasks_count: number
|
|
113
|
+
responsible: Api_Tasks_Simple_Responsible_Dto[]
|
|
114
|
+
assigned: any[]
|
|
115
|
+
status: Api_Tasks_Status_Dto
|
|
116
|
+
expired: boolean
|
|
117
|
+
teams: Api_Tasks_Teams_Dto[]
|
|
118
|
+
is_critical_path: boolean
|
|
119
|
+
isPause: boolean
|
|
120
|
+
fact_start_date: null | string
|
|
121
|
+
fact_end_date: null | string
|
|
122
|
+
pause_sec: number
|
|
123
|
+
work_sec: number
|
|
124
|
+
}
|