shared-ritm 1.2.111 → 1.2.112

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.
Files changed (128) hide show
  1. package/README.md +103 -103
  2. package/dist/index.css +1 -1
  3. package/dist/shared-ritm.es.js +31 -30
  4. package/dist/shared-ritm.umd.js +6 -6
  5. package/dist/types/api/services/VideoService.d.ts +1 -0
  6. package/package.json +64 -64
  7. package/src/App.vue +2461 -2461
  8. package/src/api/services/AuthService.ts +64 -64
  9. package/src/api/services/BrigadesService.ts +32 -32
  10. package/src/api/services/CommentsService.ts +24 -24
  11. package/src/api/services/ControlsService.ts +65 -65
  12. package/src/api/services/EquipmentService.ts +29 -29
  13. package/src/api/services/FileService.ts +17 -17
  14. package/src/api/services/GanttService.ts +17 -17
  15. package/src/api/services/InstrumentsService.ts +63 -63
  16. package/src/api/services/MetricsService.ts +110 -110
  17. package/src/api/services/ModulesService.ts +27 -27
  18. package/src/api/services/ProjectsService.ts +72 -72
  19. package/src/api/services/RepairsService.ts +119 -119
  20. package/src/api/services/SearchService.ts +22 -22
  21. package/src/api/services/TasksService.ts +145 -145
  22. package/src/api/services/UserService.ts +101 -101
  23. package/src/api/services/VideoService.ts +66 -62
  24. package/src/api/settings/ApiService.ts +124 -124
  25. package/src/api/types/Api_Brigades.ts +36 -36
  26. package/src/api/types/Api_Comment.ts +40 -40
  27. package/src/api/types/Api_Controls.ts +72 -72
  28. package/src/api/types/Api_Equipment.ts +3 -3
  29. package/src/api/types/Api_Files.ts +7 -7
  30. package/src/api/types/Api_Instruments.ts +136 -136
  31. package/src/api/types/Api_Modules.ts +21 -21
  32. package/src/api/types/Api_Projects.ts +55 -55
  33. package/src/api/types/Api_Repairs.ts +115 -115
  34. package/src/api/types/Api_Search.ts +77 -77
  35. package/src/api/types/Api_Service.ts +9 -9
  36. package/src/api/types/Api_Tasks.ts +319 -319
  37. package/src/api/types/Api_User.ts +117 -117
  38. package/src/api/types/Api_Video.ts +123 -123
  39. package/src/common/app-button/AppButton.vue +173 -173
  40. package/src/common/app-checkbox/AppCheckbox.vue +26 -26
  41. package/src/common/app-date-picker/AppDatePicker.vue +81 -81
  42. package/src/common/app-datepicker/AppDatepicker.vue +165 -165
  43. package/src/common/app-dialogs/AppConfirmDialog.vue +99 -99
  44. package/src/common/app-dropdown/AppDropdown.vue +31 -31
  45. package/src/common/app-icon/AppIcon.vue +108 -108
  46. package/src/common/app-input/AppInput.vue +148 -148
  47. package/src/common/app-input-new/AppInputNew.vue +175 -175
  48. package/src/common/app-input-search/AppInputSearch.vue +174 -174
  49. package/src/common/app-layout/AppLayout.vue +84 -84
  50. package/src/common/app-layout/components/AppLayoutHeader.vue +250 -250
  51. package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
  52. package/src/common/app-loader/index.vue +43 -43
  53. package/src/common/app-page-layout/AppPageLayout.vue +122 -122
  54. package/src/common/app-select/AppSelect.vue +157 -157
  55. package/src/common/app-sheet/AppSheet.vue +120 -120
  56. package/src/common/app-sheet-new/AppSheetNew.vue +246 -246
  57. package/src/common/app-sidebar/AppSidebar.vue +168 -168
  58. package/src/common/app-sidebar/components/SidebarMenu.vue +37 -37
  59. package/src/common/app-sidebar/components/SidebarMenuItem.vue +148 -148
  60. package/src/common/app-table/AppTable.vue +314 -314
  61. package/src/common/app-table/AppTableLayout.vue +137 -137
  62. package/src/common/app-table/components/ModalSelect.vue +270 -270
  63. package/src/common/app-table/components/TableModal.vue +356 -356
  64. package/src/common/app-table/components/TablePagination.vue +152 -152
  65. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  66. package/src/common/app-table/controllers/useColumnSelector.ts +38 -38
  67. package/src/common/app-table/controllers/useTableModel.ts +93 -93
  68. package/src/common/app-toggle/AppToggle.vue +24 -24
  69. package/src/common/app-wrapper/AppWrapper.vue +28 -28
  70. package/src/global.d.ts +1 -1
  71. package/src/icons/components/arrow-down-icon.vue +25 -25
  72. package/src/icons/components/arrow-frame-icon.vue +19 -19
  73. package/src/icons/components/arrow-square.vue +22 -22
  74. package/src/icons/components/table-filter-icon.vue +30 -30
  75. package/src/icons/dialogs/RemoveIcon.vue +12 -12
  76. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  77. package/src/icons/header/NotificationIcon.vue +18 -18
  78. package/src/icons/header/PersonIcon.vue +11 -11
  79. package/src/icons/header/SettingIcon.vue +14 -14
  80. package/src/icons/header/flashIcon.vue +24 -24
  81. package/src/icons/header/searchStatusIcon.vue +24 -24
  82. package/src/icons/header/smallCapsIcon.vue +34 -34
  83. package/src/icons/sidebar/assign-module-icon.vue +36 -36
  84. package/src/icons/sidebar/instrument-history-icon.vue +32 -32
  85. package/src/icons/sidebar/instrument-order-icon.vue +38 -38
  86. package/src/icons/sidebar/instrument-work-zone-icon.vue +18 -18
  87. package/src/icons/sidebar/instruments-icon.vue +45 -45
  88. package/src/icons/sidebar/logo-icon.vue +15 -15
  89. package/src/icons/sidebar/logout-icon.vue +13 -13
  90. package/src/icons/sidebar/modules-icon.vue +16 -16
  91. package/src/icons/sidebar/notifications-icon.vue +24 -24
  92. package/src/icons/sidebar/order-icon.vue +44 -44
  93. package/src/icons/sidebar/pass-icon.vue +38 -38
  94. package/src/icons/sidebar/positions-icon.vue +42 -42
  95. package/src/icons/sidebar/preorder-icon.vue +19 -19
  96. package/src/icons/sidebar/projects-icon.vue +31 -31
  97. package/src/icons/sidebar/repair-object-icon.vue +18 -18
  98. package/src/icons/sidebar/repairs-icon.vue +20 -20
  99. package/src/icons/sidebar/roles-icon.vue +26 -26
  100. package/src/icons/sidebar/status-history-icon.vue +24 -24
  101. package/src/icons/sidebar/tasks-icon.vue +28 -28
  102. package/src/icons/sidebar/tasks_tasks-icon.vue +39 -39
  103. package/src/icons/sidebar/tasks_today-icon.vue +27 -27
  104. package/src/icons/sidebar/teams-icon.vue +32 -32
  105. package/src/icons/sidebar/user-icon.vue +18 -18
  106. package/src/icons/sidebar/users-icon.vue +46 -46
  107. package/src/icons/sidebar/videosources-icon.vue +19 -19
  108. package/src/icons/sidebar/videowall-icon.vue +13 -13
  109. package/src/icons/sidebar/videozones-icon.vue +21 -21
  110. package/src/icons/sidebar/warehouses-icon.vue +43 -43
  111. package/src/icons/sidebar/workshop-icon.vue +100 -100
  112. package/src/icons/sidebar/workzones-icon.vue +22 -22
  113. package/src/icons/task/attention-icon.vue +13 -13
  114. package/src/icons/task/clock-icon.vue +10 -10
  115. package/src/icons/task/delete-icon.vue +10 -10
  116. package/src/icons/task/fire-icon.vue +16 -16
  117. package/src/index.ts +122 -122
  118. package/src/main.ts +28 -28
  119. package/src/quasar-user-options.ts +17 -17
  120. package/src/router/index.ts +10 -10
  121. package/src/shared/styles/general.css +124 -124
  122. package/src/shims-vue.d.ts +5 -5
  123. package/src/styles/variables.sass +12 -12
  124. package/src/utils/confirm.ts +12 -12
  125. package/src/utils/faceApiHelper.ts +137 -137
  126. package/src/utils/helpers.ts +59 -59
  127. package/src/utils/notification.ts +9 -9
  128. package/dist/types/api/services/PhotoService.d.ts +0 -40
@@ -1,314 +1,314 @@
1
- <template>
2
- <div class="flex flex-col" style="height: 100%; min-height: 100%">
3
- <q-table
4
- v-model:selected="selected"
5
- :rows="rows.value"
6
- :columns="resCols"
7
- row-key="id"
8
- flat
9
- bordered
10
- hide-bottom
11
- class="full-width"
12
- :rows-per-page-options="[0]"
13
- :selection="props.enableMultiSelect ? 'multiple' : 'none'"
14
- style="height: 100%"
15
- :table-row-style-fn="tableRowStyleFn"
16
- @row-click="rowClick"
17
- >
18
- <template #header-selection="scope">
19
- <q-toggle v-model="scope.selected" />
20
- </template>
21
-
22
- <template #body-selection="scope">
23
- <q-toggle v-model="scope.selected" />
24
- </template>
25
-
26
- <template #body-cell-index="cellProps">
27
- <q-td :props="cellProps" class="text-center" :class="{ 'q-td--no-hover': noHover }">
28
- {{ getIndex(cellProps.rowIndex) }}
29
- </q-td>
30
- </template>
31
-
32
- <template v-for="col in resCols" :key="col.name" #[`header-cell-${col.name}`]="propsSlot">
33
- <q-th
34
- :props="propsSlot"
35
- :class="{ 'cursor-pointer': col.filterType, actions: col.name === 'actions' }"
36
- :style="col.style"
37
- >
38
- <div
39
- v-if="col.filterType"
40
- class="row items-center no-wrap"
41
- @click.stop="emit('open-filter-menu', col.name, !filterMenus.value[col.name])"
42
- >
43
- <filter-icon class="q-mr-xs" />
44
- <span>{{ col.label }}</span>
45
- <div
46
- v-if="['multi', 'single'].includes(col.filterType) && columnFilters.value[col.name]?.length"
47
- class="label-length"
48
- >
49
- - {{ col.filterType === 'multi' ? columnFilters.value[col.name]?.length : 1 }}
50
- </div>
51
- </div>
52
- <div v-else>{{ col.label }}</div>
53
-
54
- <q-menu
55
- v-if="col.filterType"
56
- :model-value="filterMenus.value[col.name]"
57
- fit
58
- max-height="300px"
59
- class="filter-menu"
60
- @update:model-value="isOpen => emit('open-filter-menu', col.name, isOpen)"
61
- >
62
- <div class="filter-content">
63
- <q-input v-model="localSearches[col.name]" dense outlined placeholder="Поиск" class="q-mb-sm" clearable />
64
- <q-scroll-area style="height: 200px">
65
- <q-list style="min-width: 200px">
66
- <q-item v-for="option in filteredOptions[col.name]" :key="`${col.name}-${option.id}`" tag="label">
67
- <q-item-section avatar>
68
- <q-checkbox
69
- v-if="col.filterType === 'multi'"
70
- dense
71
- :model-value="
72
- Array.isArray(columnFilters.value[col.name]) &&
73
- columnFilters.value[col.name]?.includes(option.name)
74
- "
75
- @update:model-value="() => emit('toggle-filter-value', col.name, option.name)"
76
- />
77
- <q-radio
78
- v-else
79
- dense
80
- :model-value="columnFilters.value[col.name]"
81
- :val="option.name"
82
- @update:model-value="emit('toggle-filter-value', col.name, $event)"
83
- />
84
- </q-item-section>
85
- <q-item-section>{{ option.name }}</q-item-section>
86
- </q-item>
87
- </q-list>
88
- </q-scroll-area>
89
-
90
- <div class="filter-footer">
91
- <q-btn color="negative" flat dense label="Сбросить фильтр" @click="emit('clear-filter', col.name)" />
92
- </div>
93
- </div>
94
- </q-menu>
95
- </q-th>
96
- </template>
97
-
98
- <template #body-cell="cellProps">
99
- <q-td
100
- :props="cellProps"
101
- :class="{
102
- 'q-td--no-hover': noHover || cellProps.col.name === 'actions',
103
- actions: cellProps.col.name === 'actions',
104
- }"
105
- >
106
- <div v-if="cellProps.col.name === 'actions'" class="actions__btns">
107
- <q-btn square icon="edit" size="sm" unelevated title="Редактировать" @click="emit('edit', cellProps.row)" />
108
- </div>
109
- <q-badge
110
- v-else-if="cellProps.col.badge && typeof cellProps.value === 'boolean'"
111
- :color="
112
- cellProps.col.badge.colorTrue && cellProps.value
113
- ? cellProps.col.badge.colorTrue
114
- : cellProps.col.badge.colorFalse && !cellProps.value
115
- ? cellProps.col.badge.colorFalse
116
- : cellProps.value
117
- ? 'green'
118
- : 'red'
119
- "
120
- outline
121
- class="text-bold"
122
- >
123
- {{ cellProps.value ? cellProps.col.badge.true ?? 'Да' : cellProps.col.badge.false ?? 'Нет' }}
124
- </q-badge>
125
- <span v-else-if="cellProps.col.html" v-html="cellProps.value"></span>
126
- <slot v-else-if="hasSlot(cellProps.col.name)" :name="cellProps.col.name" :cellProps="cellProps" />
127
- <span v-else :title="cellProps.value">{{ cellProps.value }}</span>
128
- </q-td>
129
- </template>
130
- </q-table>
131
- </div>
132
- </template>
133
- <script setup lang="ts">
134
- import { defineProps, defineEmits, ref, computed, watch, Slots } from 'vue'
135
- import type { Ref } from 'vue'
136
- import FilterIcon from '@/icons/components/table-filter-icon.vue'
137
-
138
- interface FilterOption {
139
- id: string
140
- name: string
141
- }
142
-
143
- interface TableEmits {
144
- 'toggle-filter-value': [colName: string, value: string]
145
- 'clear-filter': [colName: string]
146
- 'open-filter-menu': [colName: string, isOpen: boolean]
147
- 'row-click': [row: Record<string, any>]
148
- 'update:selectedRows': [rows: any[]] // синтаксис defineEmits для эмита с именованными параметрами
149
- edit: [row: Record<string, any>]
150
- }
151
-
152
- const props = defineProps<{
153
- rows: Ref<any[]>
154
- columns: any[]
155
- columnFilters: Ref<Record<string, string | string[] | undefined>>
156
- filterMenus: Ref<Record<string, boolean>>
157
- filtersOptions: Record<string, FilterOption[]>
158
- meta: Ref<{ currentPage: number; perPage: number }>
159
- enableMultiSelect?: boolean
160
- noHover?: boolean
161
- hidePagination?: boolean
162
- selectedRows: any[]
163
- actions?: string[]
164
- tableRowStyleFn?: (row: Record<string, any>) => string
165
- slots?: Slots
166
- }>()
167
- const emit = defineEmits<TableEmits>()
168
-
169
- const localSearches = ref<Record<string, string>>({})
170
- const selected = ref<any[]>([])
171
-
172
- const resCols = computed(() => {
173
- if (!props.actions?.length) return props.columns
174
-
175
- return [...props.columns, { name: 'actions', label: 'Действия', align: 'center' }]
176
- })
177
-
178
- const filteredOptions = computed(() => {
179
- const result: Record<string, FilterOption[]> = {}
180
- for (const col of props.columns) {
181
- const search = localSearches.value[col.name]?.toLowerCase() || ''
182
- const options = props.filtersOptions[col.name] || []
183
- result[col.name] = options.filter(opt => opt.name.toLowerCase().includes(search))
184
- }
185
- return result
186
- })
187
-
188
- const hasSlot = (name: string) => props.slots && name in props.slots
189
-
190
- const rowClick = (e: Event, row: Record<string, any>) => {
191
- const target = e?.target
192
-
193
- if (!(target instanceof HTMLElement) || target.closest('.actions') || document.getSelection()?.toString()) return
194
-
195
- emit('row-click', row)
196
- }
197
-
198
- const getIndex = (rowIndex: number) => {
199
- if (props.hidePagination) return rowIndex + 1
200
-
201
- return rowIndex + 1 + (props.meta.value.currentPage - 1) * props.meta.value.perPage
202
- }
203
-
204
- watch(
205
- () => props.selectedRows,
206
- val => {
207
- selected.value = val
208
- },
209
- { immediate: true },
210
- )
211
-
212
- watch(
213
- selected,
214
- val => {
215
- emit('update:selectedRows', val)
216
- },
217
- { deep: true },
218
- )
219
- </script>
220
- <style scoped lang="scss">
221
- .actions {
222
- width: 100px;
223
- background-color: #f2f7fb;
224
- position: sticky;
225
- right: 0;
226
- z-index: 1;
227
- border-left: 1px solid #d7e0ef;
228
-
229
- &__btns {
230
- display: flex;
231
- justify-content: center;
232
- gap: 0.5rem;
233
-
234
- button {
235
- background-color: #a4b4cf50;
236
- width: 32px;
237
- height: 32px;
238
- border-radius: 8px;
239
- }
240
- }
241
- }
242
-
243
- .cursor-pointer {
244
- cursor: pointer;
245
- }
246
-
247
- .filter-menu {
248
- padding: 10px;
249
- }
250
- .label-length {
251
- margin-left: 5px;
252
- }
253
- .filter-content {
254
- display: flex;
255
- flex-direction: column;
256
- color: #1d425d;
257
- .q-item {
258
- padding: 0 5px;
259
- min-height: 40px;
260
- }
261
- .q-item__section {
262
- min-width: 30px;
263
- padding: 0;
264
- }
265
- ::v-deep(.q-radio__inner),
266
- ::v-deep(.q-checkbox__inner) {
267
- color: #a4b4cf;
268
- }
269
- }
270
-
271
- .filter-footer {
272
- border-top: 1px solid #eee;
273
- display: flex;
274
- justify-content: center;
275
- }
276
-
277
- ::v-deep(.q-table thead) {
278
- position: sticky;
279
- top: 0;
280
- background: #f2f7fb;
281
- z-index: 2;
282
- }
283
-
284
- ::v-deep(.q-table th) {
285
- font-family: NunitoSansFont, sans-serif;
286
- color: #a4b4cf;
287
- font-size: 15px;
288
- font-style: normal;
289
- font-weight: 700;
290
- line-height: 20px;
291
- height: 61px;
292
- }
293
-
294
- ::v-deep(.q-table tbody td) {
295
- height: 61px;
296
- font-size: 14px;
297
- }
298
-
299
- .q-td--no-hover {
300
- cursor: default;
301
- }
302
-
303
- ::v-deep(.q-table tbody) {
304
- font-family: NunitoSansFont, sans-serif;
305
- border-color: #d7e0ef;
306
- color: #1d425d;
307
- line-height: 20px;
308
- font-size: 14px;
309
- }
310
-
311
- ::v-deep(.q-table tbody tr:last-child td) {
312
- border-bottom: 1px solid #d7e0ef;
313
- }
314
- </style>
1
+ <template>
2
+ <div class="flex flex-col" style="height: 100%; min-height: 100%">
3
+ <q-table
4
+ v-model:selected="selected"
5
+ :rows="rows.value"
6
+ :columns="resCols"
7
+ row-key="id"
8
+ flat
9
+ bordered
10
+ hide-bottom
11
+ class="full-width"
12
+ :rows-per-page-options="[0]"
13
+ :selection="props.enableMultiSelect ? 'multiple' : 'none'"
14
+ style="height: 100%"
15
+ :table-row-style-fn="tableRowStyleFn"
16
+ @row-click="rowClick"
17
+ >
18
+ <template #header-selection="scope">
19
+ <q-toggle v-model="scope.selected" />
20
+ </template>
21
+
22
+ <template #body-selection="scope">
23
+ <q-toggle v-model="scope.selected" />
24
+ </template>
25
+
26
+ <template #body-cell-index="cellProps">
27
+ <q-td :props="cellProps" class="text-center" :class="{ 'q-td--no-hover': noHover }">
28
+ {{ getIndex(cellProps.rowIndex) }}
29
+ </q-td>
30
+ </template>
31
+
32
+ <template v-for="col in resCols" :key="col.name" #[`header-cell-${col.name}`]="propsSlot">
33
+ <q-th
34
+ :props="propsSlot"
35
+ :class="{ 'cursor-pointer': col.filterType, actions: col.name === 'actions' }"
36
+ :style="col.style"
37
+ >
38
+ <div
39
+ v-if="col.filterType"
40
+ class="row items-center no-wrap"
41
+ @click.stop="emit('open-filter-menu', col.name, !filterMenus.value[col.name])"
42
+ >
43
+ <filter-icon class="q-mr-xs" />
44
+ <span>{{ col.label }}</span>
45
+ <div
46
+ v-if="['multi', 'single'].includes(col.filterType) && columnFilters.value[col.name]?.length"
47
+ class="label-length"
48
+ >
49
+ - {{ col.filterType === 'multi' ? columnFilters.value[col.name]?.length : 1 }}
50
+ </div>
51
+ </div>
52
+ <div v-else>{{ col.label }}</div>
53
+
54
+ <q-menu
55
+ v-if="col.filterType"
56
+ :model-value="filterMenus.value[col.name]"
57
+ fit
58
+ max-height="300px"
59
+ class="filter-menu"
60
+ @update:model-value="isOpen => emit('open-filter-menu', col.name, isOpen)"
61
+ >
62
+ <div class="filter-content">
63
+ <q-input v-model="localSearches[col.name]" dense outlined placeholder="Поиск" class="q-mb-sm" clearable />
64
+ <q-scroll-area style="height: 200px">
65
+ <q-list style="min-width: 200px">
66
+ <q-item v-for="option in filteredOptions[col.name]" :key="`${col.name}-${option.id}`" tag="label">
67
+ <q-item-section avatar>
68
+ <q-checkbox
69
+ v-if="col.filterType === 'multi'"
70
+ dense
71
+ :model-value="
72
+ Array.isArray(columnFilters.value[col.name]) &&
73
+ columnFilters.value[col.name]?.includes(option.name)
74
+ "
75
+ @update:model-value="() => emit('toggle-filter-value', col.name, option.name)"
76
+ />
77
+ <q-radio
78
+ v-else
79
+ dense
80
+ :model-value="columnFilters.value[col.name]"
81
+ :val="option.name"
82
+ @update:model-value="emit('toggle-filter-value', col.name, $event)"
83
+ />
84
+ </q-item-section>
85
+ <q-item-section>{{ option.name }}</q-item-section>
86
+ </q-item>
87
+ </q-list>
88
+ </q-scroll-area>
89
+
90
+ <div class="filter-footer">
91
+ <q-btn color="negative" flat dense label="Сбросить фильтр" @click="emit('clear-filter', col.name)" />
92
+ </div>
93
+ </div>
94
+ </q-menu>
95
+ </q-th>
96
+ </template>
97
+
98
+ <template #body-cell="cellProps">
99
+ <q-td
100
+ :props="cellProps"
101
+ :class="{
102
+ 'q-td--no-hover': noHover || cellProps.col.name === 'actions',
103
+ actions: cellProps.col.name === 'actions',
104
+ }"
105
+ >
106
+ <div v-if="cellProps.col.name === 'actions'" class="actions__btns">
107
+ <q-btn square icon="edit" size="sm" unelevated title="Редактировать" @click="emit('edit', cellProps.row)" />
108
+ </div>
109
+ <q-badge
110
+ v-else-if="cellProps.col.badge && typeof cellProps.value === 'boolean'"
111
+ :color="
112
+ cellProps.col.badge.colorTrue && cellProps.value
113
+ ? cellProps.col.badge.colorTrue
114
+ : cellProps.col.badge.colorFalse && !cellProps.value
115
+ ? cellProps.col.badge.colorFalse
116
+ : cellProps.value
117
+ ? 'green'
118
+ : 'red'
119
+ "
120
+ outline
121
+ class="text-bold"
122
+ >
123
+ {{ cellProps.value ? cellProps.col.badge.true ?? 'Да' : cellProps.col.badge.false ?? 'Нет' }}
124
+ </q-badge>
125
+ <span v-else-if="cellProps.col.html" v-html="cellProps.value"></span>
126
+ <slot v-else-if="hasSlot(cellProps.col.name)" :name="cellProps.col.name" :cellProps="cellProps" />
127
+ <span v-else :title="cellProps.value">{{ cellProps.value }}</span>
128
+ </q-td>
129
+ </template>
130
+ </q-table>
131
+ </div>
132
+ </template>
133
+ <script setup lang="ts">
134
+ import { defineProps, defineEmits, ref, computed, watch, Slots } from 'vue'
135
+ import type { Ref } from 'vue'
136
+ import FilterIcon from '@/icons/components/table-filter-icon.vue'
137
+
138
+ interface FilterOption {
139
+ id: string
140
+ name: string
141
+ }
142
+
143
+ interface TableEmits {
144
+ 'toggle-filter-value': [colName: string, value: string]
145
+ 'clear-filter': [colName: string]
146
+ 'open-filter-menu': [colName: string, isOpen: boolean]
147
+ 'row-click': [row: Record<string, any>]
148
+ 'update:selectedRows': [rows: any[]] // синтаксис defineEmits для эмита с именованными параметрами
149
+ edit: [row: Record<string, any>]
150
+ }
151
+
152
+ const props = defineProps<{
153
+ rows: Ref<any[]>
154
+ columns: any[]
155
+ columnFilters: Ref<Record<string, string | string[] | undefined>>
156
+ filterMenus: Ref<Record<string, boolean>>
157
+ filtersOptions: Record<string, FilterOption[]>
158
+ meta: Ref<{ currentPage: number; perPage: number }>
159
+ enableMultiSelect?: boolean
160
+ noHover?: boolean
161
+ hidePagination?: boolean
162
+ selectedRows: any[]
163
+ actions?: string[]
164
+ tableRowStyleFn?: (row: Record<string, any>) => string
165
+ slots?: Slots
166
+ }>()
167
+ const emit = defineEmits<TableEmits>()
168
+
169
+ const localSearches = ref<Record<string, string>>({})
170
+ const selected = ref<any[]>([])
171
+
172
+ const resCols = computed(() => {
173
+ if (!props.actions?.length) return props.columns
174
+
175
+ return [...props.columns, { name: 'actions', label: 'Действия', align: 'center' }]
176
+ })
177
+
178
+ const filteredOptions = computed(() => {
179
+ const result: Record<string, FilterOption[]> = {}
180
+ for (const col of props.columns) {
181
+ const search = localSearches.value[col.name]?.toLowerCase() || ''
182
+ const options = props.filtersOptions[col.name] || []
183
+ result[col.name] = options.filter(opt => opt.name.toLowerCase().includes(search))
184
+ }
185
+ return result
186
+ })
187
+
188
+ const hasSlot = (name: string) => props.slots && name in props.slots
189
+
190
+ const rowClick = (e: Event, row: Record<string, any>) => {
191
+ const target = e?.target
192
+
193
+ if (!(target instanceof HTMLElement) || target.closest('.actions') || document.getSelection()?.toString()) return
194
+
195
+ emit('row-click', row)
196
+ }
197
+
198
+ const getIndex = (rowIndex: number) => {
199
+ if (props.hidePagination) return rowIndex + 1
200
+
201
+ return rowIndex + 1 + (props.meta.value.currentPage - 1) * props.meta.value.perPage
202
+ }
203
+
204
+ watch(
205
+ () => props.selectedRows,
206
+ val => {
207
+ selected.value = val
208
+ },
209
+ { immediate: true },
210
+ )
211
+
212
+ watch(
213
+ selected,
214
+ val => {
215
+ emit('update:selectedRows', val)
216
+ },
217
+ { deep: true },
218
+ )
219
+ </script>
220
+ <style scoped lang="scss">
221
+ .actions {
222
+ width: 100px;
223
+ background-color: #f2f7fb;
224
+ position: sticky;
225
+ right: 0;
226
+ z-index: 1;
227
+ border-left: 1px solid #d7e0ef;
228
+
229
+ &__btns {
230
+ display: flex;
231
+ justify-content: center;
232
+ gap: 0.5rem;
233
+
234
+ button {
235
+ background-color: #a4b4cf50;
236
+ width: 32px;
237
+ height: 32px;
238
+ border-radius: 8px;
239
+ }
240
+ }
241
+ }
242
+
243
+ .cursor-pointer {
244
+ cursor: pointer;
245
+ }
246
+
247
+ .filter-menu {
248
+ padding: 10px;
249
+ }
250
+ .label-length {
251
+ margin-left: 5px;
252
+ }
253
+ .filter-content {
254
+ display: flex;
255
+ flex-direction: column;
256
+ color: #1d425d;
257
+ .q-item {
258
+ padding: 0 5px;
259
+ min-height: 40px;
260
+ }
261
+ .q-item__section {
262
+ min-width: 30px;
263
+ padding: 0;
264
+ }
265
+ ::v-deep(.q-radio__inner),
266
+ ::v-deep(.q-checkbox__inner) {
267
+ color: #a4b4cf;
268
+ }
269
+ }
270
+
271
+ .filter-footer {
272
+ border-top: 1px solid #eee;
273
+ display: flex;
274
+ justify-content: center;
275
+ }
276
+
277
+ ::v-deep(.q-table thead) {
278
+ position: sticky;
279
+ top: 0;
280
+ background: #f2f7fb;
281
+ z-index: 2;
282
+ }
283
+
284
+ ::v-deep(.q-table th) {
285
+ font-family: NunitoSansFont, sans-serif;
286
+ color: #a4b4cf;
287
+ font-size: 15px;
288
+ font-style: normal;
289
+ font-weight: 700;
290
+ line-height: 20px;
291
+ height: 61px;
292
+ }
293
+
294
+ ::v-deep(.q-table tbody td) {
295
+ height: 61px;
296
+ font-size: 14px;
297
+ }
298
+
299
+ .q-td--no-hover {
300
+ cursor: default;
301
+ }
302
+
303
+ ::v-deep(.q-table tbody) {
304
+ font-family: NunitoSansFont, sans-serif;
305
+ border-color: #d7e0ef;
306
+ color: #1d425d;
307
+ line-height: 20px;
308
+ font-size: 14px;
309
+ }
310
+
311
+ ::v-deep(.q-table tbody tr:last-child td) {
312
+ border-bottom: 1px solid #d7e0ef;
313
+ }
314
+ </style>