shared-ritm 1.2.93 → 1.2.95

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.
@@ -1,7 +1,21 @@
1
1
  import ApiService from '../settings/ApiService';
2
+ import { ResponseApi } from '@/api/types/Api_Service';
3
+ import { Api_Work_Zone, Api_Work_Zone_Search } from '@/api/types/Api_Video';
2
4
  declare class VideoService extends ApiService {
3
5
  startVideoAnalytics(): Promise<boolean>;
4
6
  reloadVideoAnalytics(ids: string[]): Promise<any>;
7
+ fetchWorkZones(params?: any): Promise<ResponseApi<Api_Work_Zone_Search[]>>;
8
+ fetchWorkZone(id: string): Promise<ResponseApi<Api_Work_Zone>>;
9
+ editWorkZone(id: string, body: {
10
+ title: string;
11
+ }): Promise<{
12
+ data: Api_Work_Zone;
13
+ status: number;
14
+ }>;
15
+ deleteWorkZone(id: string): Promise<{
16
+ data: boolean;
17
+ status: number;
18
+ }>;
5
19
  }
6
20
  export default function useVideoService(): VideoService;
7
21
  export {};
@@ -0,0 +1,87 @@
1
+ import { Api_Status_DTO } from '@/api/types/Api_Tasks';
2
+ export type Api_Video_Source = {
3
+ id: string;
4
+ name: string;
5
+ login: string;
6
+ password: string;
7
+ camera_id: string | null;
8
+ comment: string | null;
9
+ data: unknown | null;
10
+ snapshot_path: string | null;
11
+ url: string;
12
+ updated_at: string;
13
+ created_at: string;
14
+ fps: string;
15
+ domed: boolean;
16
+ height: number;
17
+ width: number;
18
+ };
19
+ export type Api_Work_Zone_Search = {
20
+ id: string;
21
+ name: string;
22
+ title: string;
23
+ type: number;
24
+ parent_id: string | null;
25
+ created_at: string;
26
+ deleted_at: string | null;
27
+ updated_at: string;
28
+ description: string;
29
+ detect_face: boolean;
30
+ detect_helmet: boolean;
31
+ detect_mask: boolean;
32
+ detect_work_time: boolean;
33
+ detect_work_zone: boolean;
34
+ has_tasks: boolean;
35
+ is_parent: boolean;
36
+ x0: number;
37
+ x1: number;
38
+ y0: number;
39
+ y1: number;
40
+ video_source: Api_Video_Source;
41
+ video_source_id: string;
42
+ warehouse_by_work_zone_instruments: unknown[];
43
+ };
44
+ export type Api_Work_Zone_Usage_User = {
45
+ id: string;
46
+ user_id: string;
47
+ user_full_name: string;
48
+ work_zone_id: string;
49
+ start_interval: string;
50
+ end_interval: string;
51
+ minutes: number;
52
+ };
53
+ export type Api_Work_Zone_Task = {
54
+ id: string;
55
+ name: string;
56
+ plan_date: string;
57
+ planned_start: null | string;
58
+ planned_end: null | string;
59
+ deadline: string;
60
+ is_critical_path: boolean | null;
61
+ is_expired: boolean;
62
+ power_output_MWh: number;
63
+ cost_per_MWh: number | null;
64
+ fact_start_date: null | string;
65
+ fact_end_date: null | string;
66
+ time_to_complete_sec: number | null;
67
+ status: Api_Status_DTO[];
68
+ usage_users: Api_Work_Zone_Usage_User[];
69
+ };
70
+ export type Api_Work_Zone_Coords = {
71
+ x0: number;
72
+ x1: number;
73
+ y0: number;
74
+ y1: number;
75
+ };
76
+ export type Api_Work_Zone = {
77
+ id: string;
78
+ title: string;
79
+ created_at: string;
80
+ video_source: {
81
+ id: string;
82
+ name: string;
83
+ };
84
+ coordinates: Api_Work_Zone_Coords;
85
+ warehouse_by_work_zone_instruments: unknown[];
86
+ tasks: Api_Work_Zone_Task[];
87
+ };
@@ -58,3 +58,4 @@ export * from './api/types/Api_Search';
58
58
  export * from './api/types/Api_User';
59
59
  export * from './api/types/Api_Comment';
60
60
  export * from './api/types/Api_Files';
61
+ export * from './api/types/Api_Video';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.2.93",
3
+ "version": "1.2.95",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -1,12 +1,31 @@
1
1
  import ApiService from '../settings/ApiService'
2
+ import { ResponseApi } from '@/api/types/Api_Service'
3
+ import { Api_Work_Zone, Api_Work_Zone_Search } from '@/api/types/Api_Video'
2
4
 
3
5
  class VideoService extends ApiService {
4
6
  public async startVideoAnalytics(): Promise<boolean> {
5
7
  return await this.post('/statanly/start', null)
6
8
  }
9
+
7
10
  public reloadVideoAnalytics(ids: string[]): Promise<any> {
8
11
  return this.post('/horizon/video-source/reload', { video_source_ids: ids })
9
12
  }
13
+
14
+ public async fetchWorkZones(params?: any): Promise<ResponseApi<Api_Work_Zone_Search[]>> {
15
+ return await this.get('/search/work_zones', { params })
16
+ }
17
+
18
+ public async fetchWorkZone(id: string): Promise<ResponseApi<Api_Work_Zone>> {
19
+ return await this.get(`/work_zone/get_work_zone/${id}`)
20
+ }
21
+
22
+ public async editWorkZone(id: string, body: { title: string }): Promise<{ data: Api_Work_Zone; status: number }> {
23
+ return await this.put(`/admin/work-zones/${id}`, body)
24
+ }
25
+
26
+ public async deleteWorkZone(id: string): Promise<{ data: boolean; status: number }> {
27
+ return await this.delete(`/admin/work-zones/${id}`)
28
+ }
10
29
  }
11
30
 
12
31
  let api: VideoService
@@ -0,0 +1,90 @@
1
+ import { Api_Status_DTO } from '@/api/types/Api_Tasks'
2
+
3
+ export type Api_Video_Source = {
4
+ id: string
5
+ name: string
6
+ login: string
7
+ password: string
8
+ camera_id: string | null
9
+ comment: string | null
10
+ data: unknown | null
11
+ snapshot_path: string | null
12
+ url: string
13
+ updated_at: string
14
+ created_at: string
15
+ fps: string
16
+ domed: boolean
17
+ height: number
18
+ width: number
19
+ }
20
+
21
+ export type Api_Work_Zone_Search = {
22
+ id: string
23
+ name: string
24
+ title: string
25
+ type: number
26
+ parent_id: string | null
27
+ created_at: string
28
+ deleted_at: string | null
29
+ updated_at: string
30
+ description: string
31
+ detect_face: boolean
32
+ detect_helmet: boolean
33
+ detect_mask: boolean
34
+ detect_work_time: boolean
35
+ detect_work_zone: boolean
36
+ has_tasks: boolean
37
+ is_parent: boolean
38
+ x0: number
39
+ x1: number
40
+ y0: number
41
+ y1: number
42
+ video_source: Api_Video_Source
43
+ video_source_id: string
44
+ warehouse_by_work_zone_instruments: unknown[]
45
+ }
46
+
47
+ export type Api_Work_Zone_Usage_User = {
48
+ id: string
49
+ user_id: string
50
+ user_full_name: string
51
+ work_zone_id: string
52
+ start_interval: string
53
+ end_interval: string
54
+ minutes: number
55
+ }
56
+
57
+ export type Api_Work_Zone_Task = {
58
+ id: string
59
+ name: string
60
+ plan_date: string
61
+ planned_start: null | string
62
+ planned_end: null | string
63
+ deadline: string
64
+ is_critical_path: boolean | null
65
+ is_expired: boolean
66
+ power_output_MWh: number
67
+ cost_per_MWh: number | null
68
+ fact_start_date: null | string
69
+ fact_end_date: null | string
70
+ time_to_complete_sec: number | null
71
+ status: Api_Status_DTO[]
72
+ usage_users: Api_Work_Zone_Usage_User[]
73
+ }
74
+
75
+ export type Api_Work_Zone_Coords = {
76
+ x0: number
77
+ x1: number
78
+ y0: number
79
+ y1: number
80
+ }
81
+
82
+ export type Api_Work_Zone = {
83
+ id: string
84
+ title: string
85
+ created_at: string
86
+ video_source: { id: string; name: string }
87
+ coordinates: Api_Work_Zone_Coords
88
+ warehouse_by_work_zone_instruments: unknown[]
89
+ tasks: Api_Work_Zone_Task[]
90
+ }
@@ -73,12 +73,17 @@ const isSettingsOpened = ref(false)
73
73
  // { label: 'Root-режим включен', name: 'root-on', isShow: false },
74
74
  // ])
75
75
 
76
- const shortName = computed(
77
- () =>
78
- `${props.userData?.last_name} ${props.userData?.first_name} ${props.userData?.patronymic?.[0] || ''}${
79
- props.userData?.patronymic?.[0] ? '.' : ''
80
- }`,
81
- )
76
+ const shortName = computed(() => {
77
+ if (!props.userData?.full_name) return ''
78
+
79
+ const [lastName, name, patronymic] = props.userData.full_name.split(' ')
80
+
81
+ const mainPart = `${lastName} ${name}`
82
+
83
+ if (!patronymic) return mainPart
84
+
85
+ return `${mainPart} ${patronymic[0]}.`
86
+ })
82
87
 
83
88
  const positionName = computed(() => props.userData?.positions?.[0]?.display_name)
84
89
 
@@ -221,7 +226,6 @@ onClickOutside(refMenuSettings, () => (isSettingsOpened.value = false))
221
226
  height: 100px;
222
227
  background: transparent;
223
228
  margin: 0 auto;
224
- max-width: 874px;
225
229
  }
226
230
  .header-search {
227
231
  width: 343px;
@@ -24,7 +24,7 @@
24
24
 
25
25
  <template #body-cell-index="cellProps">
26
26
  <q-td :props="cellProps" class="text-center" :class="{ 'q-td--no-hover': noHover }">
27
- {{ cellProps.rowIndex + 1 + (meta.value.currentPage - 1) * meta.value.perPage }}
27
+ {{ getIndex(cellProps.rowIndex) }}
28
28
  </q-td>
29
29
  </template>
30
30
 
@@ -157,6 +157,7 @@ const props = defineProps<{
157
157
  meta: Ref<{ currentPage: number; perPage: number }>
158
158
  enableMultiSelect?: boolean
159
159
  noHover?: boolean
160
+ hidePagination?: boolean
160
161
  selectedRows: any[]
161
162
  actions?: string[]
162
163
  slots?: Slots
@@ -192,6 +193,12 @@ const rowClick = (e: Event, row: Record<string, any>) => {
192
193
  emit('row-click', row)
193
194
  }
194
195
 
196
+ const getIndex = (rowIndex: number) => {
197
+ if (props.hidePagination) return rowIndex + 1
198
+
199
+ return rowIndex + 1 + (props.meta.value.currentPage - 1) * props.meta.value.perPage
200
+ }
201
+
195
202
  watch(
196
203
  () => props.selectedRows,
197
204
  val => {
@@ -17,6 +17,7 @@
17
17
  :selected-rows="props.selectedRows"
18
18
  :no-hover="noHover"
19
19
  :slots="slots"
20
+ :hide-pagination="hidePagination"
20
21
  v-on="props.tableEvents"
21
22
  @update:selectedRows="rows => emit('update:selectedRows', rows)"
22
23
  >
@@ -30,7 +31,7 @@
30
31
  </div>
31
32
 
32
33
  <app-table-pagination
33
- v-if="!hidePagination"
34
+ v-if="!hidePagination && props.currentPage && props.totalPages"
34
35
  :model-value="props.currentPage"
35
36
  :total-pages="props.totalPages"
36
37
  @page-change="props.onPageChange"
@@ -48,10 +49,10 @@ import { defineProps, defineEmits, useSlots, computed } from 'vue'
48
49
  const props = defineProps<{
49
50
  search?: string
50
51
  loading?: boolean
51
- currentPage: number
52
- totalPages: number
52
+ currentPage?: number
53
+ totalPages?: number
53
54
  tableProps: any
54
- tableEvents: any
55
+ tableEvents?: any
55
56
  onSearch?: (val: string) => void
56
57
  onPageChange?: (page: number) => void
57
58
  hideSearch?: boolean
package/src/index.ts CHANGED
@@ -109,4 +109,5 @@ export * from './api/types/Api_Search'
109
109
  export * from './api/types/Api_User'
110
110
  export * from './api/types/Api_Comment'
111
111
  export * from './api/types/Api_Files'
112
+ export * from './api/types/Api_Video'
112
113
  // export * from '../types/Api_Metrics'