shared-ritm 1.2.90 → 1.2.91

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 (120) hide show
  1. package/README.md +103 -103
  2. package/dist/index.css +1 -1
  3. package/dist/shared-ritm.es.js +29 -28
  4. package/dist/shared-ritm.umd.js +3 -3
  5. package/package.json +64 -64
  6. package/src/App.vue +2461 -2461
  7. package/src/api/services/AuthService.ts +64 -64
  8. package/src/api/services/CommentsService.ts +24 -24
  9. package/src/api/services/ControlsService.ts +65 -65
  10. package/src/api/services/FileService.ts +17 -17
  11. package/src/api/services/GanttService.ts +17 -17
  12. package/src/api/services/InstrumentsService.ts +23 -22
  13. package/src/api/services/MetricsService.ts +110 -110
  14. package/src/api/services/ProjectsService.ts +68 -68
  15. package/src/api/services/RepairsService.ts +119 -119
  16. package/src/api/services/SearchService.ts +16 -16
  17. package/src/api/services/TasksService.ts +145 -145
  18. package/src/api/services/UserService.ts +71 -71
  19. package/src/api/services/VideoService.ts +17 -17
  20. package/src/api/settings/ApiService.ts +123 -123
  21. package/src/api/types/Api_Comment.ts +40 -40
  22. package/src/api/types/Api_Controls.ts +72 -72
  23. package/src/api/types/Api_Files.ts +7 -7
  24. package/src/api/types/Api_Instruments.ts +98 -98
  25. package/src/api/types/Api_Projects.ts +55 -55
  26. package/src/api/types/Api_Repairs.ts +115 -115
  27. package/src/api/types/Api_Search.ts +48 -48
  28. package/src/api/types/Api_Service.ts +9 -9
  29. package/src/api/types/Api_Tasks.ts +315 -315
  30. package/src/api/types/Api_User.ts +87 -87
  31. package/src/common/app-button/AppButton.vue +173 -173
  32. package/src/common/app-checkbox/AppCheckbox.vue +26 -26
  33. package/src/common/app-date-picker/AppDatePicker.vue +81 -81
  34. package/src/common/app-datepicker/AppDatepicker.vue +165 -165
  35. package/src/common/app-dialogs/AppConfirmDialog.vue +99 -99
  36. package/src/common/app-dropdown/AppDropdown.vue +31 -31
  37. package/src/common/app-icon/AppIcon.vue +108 -108
  38. package/src/common/app-input/AppInput.vue +148 -148
  39. package/src/common/app-input-new/AppInputNew.vue +152 -152
  40. package/src/common/app-input-search/AppInputSearch.vue +174 -174
  41. package/src/common/app-layout/AppLayout.vue +84 -84
  42. package/src/common/app-layout/components/AppLayoutHeader.vue +246 -246
  43. package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
  44. package/src/common/app-loader/index.vue +43 -43
  45. package/src/common/app-page-layout/AppPageLayout.vue +122 -122
  46. package/src/common/app-select/AppSelect.vue +157 -157
  47. package/src/common/app-sheet/AppSheet.vue +120 -120
  48. package/src/common/app-sheet-new/AppSheetNew.vue +246 -246
  49. package/src/common/app-sidebar/AppSidebar.vue +168 -168
  50. package/src/common/app-sidebar/components/SidebarMenu.vue +37 -37
  51. package/src/common/app-sidebar/components/SidebarMenuItem.vue +148 -148
  52. package/src/common/app-table/AppTable.vue +305 -305
  53. package/src/common/app-table/AppTableLayout.vue +126 -126
  54. package/src/common/app-table/components/ModalSelect.vue +270 -270
  55. package/src/common/app-table/components/TableModal.vue +331 -331
  56. package/src/common/app-table/components/TablePagination.vue +152 -152
  57. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  58. package/src/common/app-table/controllers/useColumnSelector.ts +38 -38
  59. package/src/common/app-table/controllers/useTableModel.ts +93 -93
  60. package/src/common/app-toggle/AppToggle.vue +24 -24
  61. package/src/common/app-wrapper/AppWrapper.vue +28 -28
  62. package/src/global.d.ts +1 -1
  63. package/src/icons/components/arrow-down-icon.vue +25 -25
  64. package/src/icons/components/arrow-frame-icon.vue +19 -19
  65. package/src/icons/components/arrow-square.vue +22 -22
  66. package/src/icons/components/table-filter-icon.vue +30 -30
  67. package/src/icons/dialogs/RemoveIcon.vue +12 -12
  68. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  69. package/src/icons/header/NotificationIcon.vue +18 -18
  70. package/src/icons/header/PersonIcon.vue +11 -11
  71. package/src/icons/header/SettingIcon.vue +14 -14
  72. package/src/icons/header/flashIcon.vue +24 -24
  73. package/src/icons/header/searchStatusIcon.vue +24 -24
  74. package/src/icons/header/smallCapsIcon.vue +34 -34
  75. package/src/icons/sidebar/assign-module-icon.vue +36 -36
  76. package/src/icons/sidebar/instrument-history-icon.vue +32 -32
  77. package/src/icons/sidebar/instrument-order-icon.vue +38 -38
  78. package/src/icons/sidebar/instrument-work-zone-icon.vue +18 -18
  79. package/src/icons/sidebar/instruments-icon.vue +45 -45
  80. package/src/icons/sidebar/logo-icon.vue +15 -15
  81. package/src/icons/sidebar/logout-icon.vue +13 -13
  82. package/src/icons/sidebar/modules-icon.vue +16 -16
  83. package/src/icons/sidebar/notifications-icon.vue +24 -24
  84. package/src/icons/sidebar/order-icon.vue +44 -44
  85. package/src/icons/sidebar/pass-icon.vue +38 -38
  86. package/src/icons/sidebar/positions-icon.vue +42 -42
  87. package/src/icons/sidebar/preorder-icon.vue +19 -19
  88. package/src/icons/sidebar/projects-icon.vue +31 -31
  89. package/src/icons/sidebar/repair-object-icon.vue +18 -18
  90. package/src/icons/sidebar/repairs-icon.vue +20 -20
  91. package/src/icons/sidebar/roles-icon.vue +26 -26
  92. package/src/icons/sidebar/status-history-icon.vue +24 -24
  93. package/src/icons/sidebar/tasks-icon.vue +28 -28
  94. package/src/icons/sidebar/tasks_tasks-icon.vue +39 -39
  95. package/src/icons/sidebar/tasks_today-icon.vue +27 -27
  96. package/src/icons/sidebar/teams-icon.vue +32 -32
  97. package/src/icons/sidebar/user-icon.vue +18 -18
  98. package/src/icons/sidebar/users-icon.vue +46 -46
  99. package/src/icons/sidebar/videosources-icon.vue +19 -19
  100. package/src/icons/sidebar/videowall-icon.vue +13 -13
  101. package/src/icons/sidebar/videozones-icon.vue +21 -21
  102. package/src/icons/sidebar/warehouses-icon.vue +43 -43
  103. package/src/icons/sidebar/workshop-icon.vue +100 -100
  104. package/src/icons/sidebar/workzones-icon.vue +22 -22
  105. package/src/icons/task/attention-icon.vue +13 -13
  106. package/src/icons/task/clock-icon.vue +10 -10
  107. package/src/icons/task/delete-icon.vue +10 -10
  108. package/src/icons/task/fire-icon.vue +16 -16
  109. package/src/index.ts +112 -112
  110. package/src/main.ts +28 -28
  111. package/src/quasar-user-options.ts +17 -17
  112. package/src/router/index.ts +10 -10
  113. package/src/shared/styles/general.css +124 -124
  114. package/src/shims-vue.d.ts +5 -5
  115. package/src/styles/variables.sass +12 -12
  116. package/src/utils/confirm.ts +12 -12
  117. package/src/utils/faceApiHelper.ts +137 -137
  118. package/src/utils/helpers.ts +59 -59
  119. package/src/utils/notification.ts +9 -9
  120. package/dist/types/api/services/PhotoService.d.ts +0 -40
@@ -1,331 +1,331 @@
1
- <template>
2
- <q-dialog :model-value="modelValue" @update:model-value="val => emit('update:modelValue', val)">
3
- <q-card style="min-width: 700px">
4
- <q-card-section>
5
- <div class="modal-title">{{ title }}</div>
6
- </q-card-section>
7
-
8
- <q-card-section>
9
- <q-form ref="formRef" @submit.prevent="submit">
10
- <div v-for="field in fields" :key="field.key" class="field-wrapper">
11
- <label v-if="field.type === 'text'" class="field-label">
12
- {{ field.label }}
13
- <span v-if="field.rules?.length && mode !== 'view'" class="required">*</span>
14
- </label>
15
-
16
- <q-input
17
- v-if="field.type === 'text'"
18
- v-model="formData[field.key]"
19
- :rules="field.rules"
20
- :readonly="mode === 'view' || (field.key === 'uuid' && mode === 'edit')"
21
- filled
22
- :placeholder="field.placeholder"
23
- >
24
- <template #append>
25
- <q-icon
26
- v-if="mode !== 'view' && formData[field.key] && !(field.key === 'uuid' && mode === 'edit')"
27
- name="close"
28
- class="cursor-pointer clear-input"
29
- @click="() => handleClear(field.key)"
30
- />
31
- <q-btn
32
- v-if="field.key === 'uuid' && mode === 'create'"
33
- flat
34
- no-caps
35
- label="UUID"
36
- size="sm"
37
- class="q-ml-sm uuid-btn"
38
- @click="generateUuid"
39
- />
40
- <q-icon
41
- v-else-if="field.key === 'uuid' && mode !== 'create'"
42
- name="content_copy"
43
- class="cursor-pointer q-ml-sm copy-icon"
44
- color="primary"
45
- @click="copyToClipboard(formData[field.key])"
46
- />
47
- </template>
48
- </q-input>
49
-
50
- <app-modal-select
51
- v-else-if="field.type === 'select'"
52
- v-model="formData[field.key]"
53
- :options="filteredOptions[field.key] || field.options"
54
- :rules="field.rules"
55
- :placeholder="mode === 'view' ? '' : field.placeholder"
56
- :multiple="true"
57
- :show-chip="true"
58
- :is-disabled="mode === 'view'"
59
- :loading="field.loading"
60
- :label="field.label"
61
- :is-show-required="mode !== 'view'"
62
- empty-text="Ничего не найдено"
63
- option-label="label"
64
- option-value="value"
65
- chip-color="#e9eff9"
66
- @update:search="val => field.onSearch?.(val)"
67
- @update:scroll="() => field.onScroll?.()"
68
- @clear="
69
- () => {
70
- handleClear(field.key)
71
- nextTick(() => formRef.value?.validate())
72
- }
73
- "
74
- />
75
- </div>
76
- </q-form>
77
- </q-card-section>
78
-
79
- <q-card-actions align="center">
80
- <q-btn v-if="mode === 'view'" class="remove" flat label="Удалить" :loading="loading" @click="emit('delete')" />
81
- <q-btn
82
- v-if="mode !== 'view'"
83
- class="confirm"
84
- flat
85
- :label="mode === 'edit' ? 'Сохранить' : 'Создать'"
86
- :disable="isSubmitDisabled"
87
- :loading="loading"
88
- @click="submit"
89
- />
90
- <q-btn v-else class="confirm" flat label="Редактировать" :disable="loading" @click="$emit('edit')" />
91
- <q-btn v-close-popup class="cancel" flat label="Закрыть" :disable="loading" />
92
- </q-card-actions>
93
- </q-card>
94
- </q-dialog>
95
- </template>
96
-
97
- <script setup lang="ts">
98
- import { ref, watch, defineProps, defineEmits, nextTick, computed } from 'vue'
99
- import { useQuasar } from 'quasar'
100
- import AppModalSelect from '../components/ModalSelect.vue'
101
- import { notificationSettings } from '@/utils/notification'
102
- import { isEqual, normalizeValue, uuidv4 } from '@/utils/helpers'
103
-
104
- type ModalMode = 'view' | 'edit' | 'create'
105
- type FieldType = 'text' | 'select'
106
-
107
- interface FieldOption {
108
- label: string
109
- value: string
110
- }
111
- interface FieldSchema {
112
- key: string
113
- label: string
114
- type: FieldType
115
- rules?: ((val: any) => boolean | string)[]
116
- options?: FieldOption[]
117
- placeholder?: string
118
- onSearch?: (val: string) => void
119
- onScroll?: () => void
120
- loading?: boolean
121
- }
122
-
123
- const props = defineProps<{
124
- modelValue: boolean
125
- title: string
126
- mode: ModalMode
127
- fields: FieldSchema[]
128
- initialData?: Record<string, any>
129
- loading?: boolean
130
- }>()
131
- const emit = defineEmits<{
132
- (e: 'update:modelValue', val: boolean): void
133
- (e: 'submit', data: Record<string, any>): void
134
- (e: 'edit'): void
135
- (e: 'delete'): void
136
- }>()
137
-
138
- const $q = useQuasar()
139
- const formRef = ref()
140
- const formData = ref<Record<string, any>>({})
141
- const filteredOptions = ref<Record<string, FieldOption[]>>({})
142
- const isSubmitDisabled = computed(() => {
143
- if (props.mode === 'view') return false
144
-
145
- const hasEmptyRequired = props.fields.some(field => {
146
- const isRequired = field.rules?.some(rule => rule('') !== true)
147
- const val = formData.value[field.key]
148
- const normalized = normalizeValue(val)
149
-
150
- const empty =
151
- normalized === null ||
152
- normalized === undefined ||
153
- (typeof normalized === 'string' && normalized.trim() === '') ||
154
- (Array.isArray(normalized) && normalized.length === 0)
155
-
156
- return isRequired && empty
157
- })
158
-
159
- if (hasEmptyRequired) return true
160
-
161
- const hasChanges = props.fields.some(field => {
162
- const key = field.key
163
- const current = normalizeValue(formData.value[key])
164
- const initial = normalizeValue(props.initialData?.[key])
165
- return !isEqual(current, initial)
166
- })
167
-
168
- return !hasChanges
169
- })
170
- function submit() {
171
- formRef.value?.validate().then(ok => {
172
- if (!ok) return
173
-
174
- const changed: Record<string, any> = {}
175
-
176
- for (const field of props.fields) {
177
- const key = field.key
178
- const current = formData.value[key]
179
- const initial = props.initialData?.[key]
180
-
181
- const normalizedCurrent = field.type === 'select' ? normalizeValue(current) : current
182
- const normalizedInitial = field.type === 'select' ? normalizeValue(initial) : initial
183
-
184
- if (!isEqual(normalizedCurrent, normalizedInitial)) {
185
- changed[key] = normalizedCurrent
186
- }
187
- }
188
-
189
- emit('submit', changed)
190
- })
191
- }
192
- function handleClear(key: string) {
193
- const field = props.fields.find(f => f.key === key)
194
- formData.value[key] = field?.type === 'select' ? [] : ''
195
-
196
- nextTick(() => {
197
- formRef.value?.validate()
198
- })
199
- }
200
- function generateUuid() {
201
- formData.value.uuid = uuidv4()
202
- }
203
- function copyToClipboard(text: string) {
204
- navigator.clipboard.writeText(text).then(() => {
205
- $q.notify(notificationSettings('success', 'UUID скопирован'))
206
- })
207
- }
208
-
209
- watch(
210
- () => props.modelValue,
211
- val => {
212
- if (val) {
213
- formData.value = { ...(props.initialData ?? {}) }
214
- }
215
- },
216
- { immediate: true },
217
- )
218
- </script>
219
-
220
- <style lang="scss">
221
- .custom-select-menu {
222
- max-height: 250px !important;
223
- overflow-y: auto !important;
224
- }
225
- </style>
226
- <style scoped lang="scss">
227
- .uuid-btn {
228
- height: 32px;
229
- padding: 0 10px;
230
- border: 1px solid #3f8cff;
231
- color: #3f8cff;
232
- font-weight: 700;
233
- font-size: 14px;
234
- background: white;
235
- border-radius: 6px;
236
- }
237
-
238
- .q-card {
239
- border-radius: 12px;
240
- background: #fff;
241
- box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
242
- font-family: NunitoSansFont, sans-serif;
243
-
244
- .modal-title {
245
- color: #1d425d;
246
- text-align: center;
247
- font-size: 32px;
248
- font-weight: 700;
249
- padding: 18px 29px;
250
- }
251
-
252
- .q-card__section {
253
- padding: 0;
254
- }
255
-
256
- .q-form {
257
- padding: 0 29px;
258
- }
259
-
260
- .field-wrapper {
261
- display: flex;
262
- flex-direction: column;
263
- margin-bottom: 15px;
264
- }
265
-
266
- .field-label {
267
- font-size: 14px;
268
- font-weight: 700;
269
- color: #7d8592;
270
- }
271
- ::v-deep(.q-placeholder) {
272
- color: #7d8592;
273
- }
274
- ::v-deep(.q-field__control) {
275
- border-radius: 8px;
276
- border: 1px solid #d8e0f0;
277
- background: #fff;
278
- box-shadow: 0px 1px 2px 0px rgba(184, 200, 224, 0.22);
279
- }
280
-
281
- ::v-deep(.q-field--filled .q-field__control:before) {
282
- background: #fff !important;
283
- border: none;
284
- }
285
-
286
- ::v-deep(.q-field--with-bottom) {
287
- padding-bottom: 0;
288
- }
289
-
290
- ::v-deep(.q-field__bottom) {
291
- padding: 0;
292
- }
293
-
294
- .clear-input {
295
- color: #d8e0f0;
296
- }
297
-
298
- .required {
299
- color: #f65160;
300
- font-weight: bold;
301
- }
302
-
303
- &__actions {
304
- padding: 18px 0;
305
- border-radius: 0px 0px 16px 16px;
306
- background: #f4f9fd;
307
-
308
- button {
309
- padding: 13px 37px;
310
- border-radius: 4px;
311
- font-size: 16px;
312
- font-weight: 700;
313
- text-transform: none;
314
-
315
- &.remove {
316
- border: 1px solid #f65160;
317
- color: #f65160;
318
- }
319
- &.confirm {
320
- background: #3f8cff;
321
- color: #fff;
322
- }
323
-
324
- &.cancel {
325
- color: #3f8cff;
326
- border: 1px solid #3f8cff;
327
- }
328
- }
329
- }
330
- }
331
- </style>
1
+ <template>
2
+ <q-dialog :model-value="modelValue" @update:model-value="val => emit('update:modelValue', val)">
3
+ <q-card style="min-width: 700px">
4
+ <q-card-section>
5
+ <div class="modal-title">{{ title }}</div>
6
+ </q-card-section>
7
+
8
+ <q-card-section>
9
+ <q-form ref="formRef" @submit.prevent="submit">
10
+ <div v-for="field in fields" :key="field.key" class="field-wrapper">
11
+ <label v-if="field.type === 'text'" class="field-label">
12
+ {{ field.label }}
13
+ <span v-if="field.rules?.length && mode !== 'view'" class="required">*</span>
14
+ </label>
15
+
16
+ <q-input
17
+ v-if="field.type === 'text'"
18
+ v-model="formData[field.key]"
19
+ :rules="field.rules"
20
+ :readonly="mode === 'view' || (field.key === 'uuid' && mode === 'edit')"
21
+ filled
22
+ :placeholder="field.placeholder"
23
+ >
24
+ <template #append>
25
+ <q-icon
26
+ v-if="mode !== 'view' && formData[field.key] && !(field.key === 'uuid' && mode === 'edit')"
27
+ name="close"
28
+ class="cursor-pointer clear-input"
29
+ @click="() => handleClear(field.key)"
30
+ />
31
+ <q-btn
32
+ v-if="field.key === 'uuid' && mode === 'create'"
33
+ flat
34
+ no-caps
35
+ label="UUID"
36
+ size="sm"
37
+ class="q-ml-sm uuid-btn"
38
+ @click="generateUuid"
39
+ />
40
+ <q-icon
41
+ v-else-if="field.key === 'uuid' && mode !== 'create'"
42
+ name="content_copy"
43
+ class="cursor-pointer q-ml-sm copy-icon"
44
+ color="primary"
45
+ @click="copyToClipboard(formData[field.key])"
46
+ />
47
+ </template>
48
+ </q-input>
49
+
50
+ <app-modal-select
51
+ v-else-if="field.type === 'select'"
52
+ v-model="formData[field.key]"
53
+ :options="filteredOptions[field.key] || field.options"
54
+ :rules="field.rules"
55
+ :placeholder="mode === 'view' ? '' : field.placeholder"
56
+ :multiple="true"
57
+ :show-chip="true"
58
+ :is-disabled="mode === 'view'"
59
+ :loading="field.loading"
60
+ :label="field.label"
61
+ :is-show-required="mode !== 'view'"
62
+ empty-text="Ничего не найдено"
63
+ option-label="label"
64
+ option-value="value"
65
+ chip-color="#e9eff9"
66
+ @update:search="val => field.onSearch?.(val)"
67
+ @update:scroll="() => field.onScroll?.()"
68
+ @clear="
69
+ () => {
70
+ handleClear(field.key)
71
+ nextTick(() => formRef.value?.validate())
72
+ }
73
+ "
74
+ />
75
+ </div>
76
+ </q-form>
77
+ </q-card-section>
78
+
79
+ <q-card-actions align="center">
80
+ <q-btn v-if="mode === 'view'" class="remove" flat label="Удалить" :loading="loading" @click="emit('delete')" />
81
+ <q-btn
82
+ v-if="mode !== 'view'"
83
+ class="confirm"
84
+ flat
85
+ :label="mode === 'edit' ? 'Сохранить' : 'Создать'"
86
+ :disable="isSubmitDisabled"
87
+ :loading="loading"
88
+ @click="submit"
89
+ />
90
+ <q-btn v-else class="confirm" flat label="Редактировать" :disable="loading" @click="$emit('edit')" />
91
+ <q-btn v-close-popup class="cancel" flat label="Закрыть" :disable="loading" />
92
+ </q-card-actions>
93
+ </q-card>
94
+ </q-dialog>
95
+ </template>
96
+
97
+ <script setup lang="ts">
98
+ import { ref, watch, defineProps, defineEmits, nextTick, computed } from 'vue'
99
+ import { useQuasar } from 'quasar'
100
+ import AppModalSelect from '../components/ModalSelect.vue'
101
+ import { notificationSettings } from '@/utils/notification'
102
+ import { isEqual, normalizeValue, uuidv4 } from '@/utils/helpers'
103
+
104
+ type ModalMode = 'view' | 'edit' | 'create'
105
+ type FieldType = 'text' | 'select'
106
+
107
+ interface FieldOption {
108
+ label: string
109
+ value: string
110
+ }
111
+ interface FieldSchema {
112
+ key: string
113
+ label: string
114
+ type: FieldType
115
+ rules?: ((val: any) => boolean | string)[]
116
+ options?: FieldOption[]
117
+ placeholder?: string
118
+ onSearch?: (val: string) => void
119
+ onScroll?: () => void
120
+ loading?: boolean
121
+ }
122
+
123
+ const props = defineProps<{
124
+ modelValue: boolean
125
+ title: string
126
+ mode: ModalMode
127
+ fields: FieldSchema[]
128
+ initialData?: Record<string, any>
129
+ loading?: boolean
130
+ }>()
131
+ const emit = defineEmits<{
132
+ (e: 'update:modelValue', val: boolean): void
133
+ (e: 'submit', data: Record<string, any>): void
134
+ (e: 'edit'): void
135
+ (e: 'delete'): void
136
+ }>()
137
+
138
+ const $q = useQuasar()
139
+ const formRef = ref()
140
+ const formData = ref<Record<string, any>>({})
141
+ const filteredOptions = ref<Record<string, FieldOption[]>>({})
142
+ const isSubmitDisabled = computed(() => {
143
+ if (props.mode === 'view') return false
144
+
145
+ const hasEmptyRequired = props.fields.some(field => {
146
+ const isRequired = field.rules?.some(rule => rule('') !== true)
147
+ const val = formData.value[field.key]
148
+ const normalized = normalizeValue(val)
149
+
150
+ const empty =
151
+ normalized === null ||
152
+ normalized === undefined ||
153
+ (typeof normalized === 'string' && normalized.trim() === '') ||
154
+ (Array.isArray(normalized) && normalized.length === 0)
155
+
156
+ return isRequired && empty
157
+ })
158
+
159
+ if (hasEmptyRequired) return true
160
+
161
+ const hasChanges = props.fields.some(field => {
162
+ const key = field.key
163
+ const current = normalizeValue(formData.value[key])
164
+ const initial = normalizeValue(props.initialData?.[key])
165
+ return !isEqual(current, initial)
166
+ })
167
+
168
+ return !hasChanges
169
+ })
170
+ function submit() {
171
+ formRef.value?.validate().then(ok => {
172
+ if (!ok) return
173
+
174
+ const changed: Record<string, any> = {}
175
+
176
+ for (const field of props.fields) {
177
+ const key = field.key
178
+ const current = formData.value[key]
179
+ const initial = props.initialData?.[key]
180
+
181
+ const normalizedCurrent = field.type === 'select' ? normalizeValue(current) : current
182
+ const normalizedInitial = field.type === 'select' ? normalizeValue(initial) : initial
183
+
184
+ if (!isEqual(normalizedCurrent, normalizedInitial)) {
185
+ changed[key] = normalizedCurrent
186
+ }
187
+ }
188
+
189
+ emit('submit', changed)
190
+ })
191
+ }
192
+ function handleClear(key: string) {
193
+ const field = props.fields.find(f => f.key === key)
194
+ formData.value[key] = field?.type === 'select' ? [] : ''
195
+
196
+ nextTick(() => {
197
+ formRef.value?.validate()
198
+ })
199
+ }
200
+ function generateUuid() {
201
+ formData.value.uuid = uuidv4()
202
+ }
203
+ function copyToClipboard(text: string) {
204
+ navigator.clipboard.writeText(text).then(() => {
205
+ $q.notify(notificationSettings('success', 'UUID скопирован'))
206
+ })
207
+ }
208
+
209
+ watch(
210
+ () => props.modelValue,
211
+ val => {
212
+ if (val) {
213
+ formData.value = { ...(props.initialData ?? {}) }
214
+ }
215
+ },
216
+ { immediate: true },
217
+ )
218
+ </script>
219
+
220
+ <style lang="scss">
221
+ .custom-select-menu {
222
+ max-height: 250px !important;
223
+ overflow-y: auto !important;
224
+ }
225
+ </style>
226
+ <style scoped lang="scss">
227
+ .uuid-btn {
228
+ height: 32px;
229
+ padding: 0 10px;
230
+ border: 1px solid #3f8cff;
231
+ color: #3f8cff;
232
+ font-weight: 700;
233
+ font-size: 14px;
234
+ background: white;
235
+ border-radius: 6px;
236
+ }
237
+
238
+ .q-card {
239
+ border-radius: 12px;
240
+ background: #fff;
241
+ box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
242
+ font-family: NunitoSansFont, sans-serif;
243
+
244
+ .modal-title {
245
+ color: #1d425d;
246
+ text-align: center;
247
+ font-size: 32px;
248
+ font-weight: 700;
249
+ padding: 18px 29px;
250
+ }
251
+
252
+ .q-card__section {
253
+ padding: 0;
254
+ }
255
+
256
+ .q-form {
257
+ padding: 0 29px;
258
+ }
259
+
260
+ .field-wrapper {
261
+ display: flex;
262
+ flex-direction: column;
263
+ margin-bottom: 15px;
264
+ }
265
+
266
+ .field-label {
267
+ font-size: 14px;
268
+ font-weight: 700;
269
+ color: #7d8592;
270
+ }
271
+ ::v-deep(.q-placeholder) {
272
+ color: #7d8592;
273
+ }
274
+ ::v-deep(.q-field__control) {
275
+ border-radius: 8px;
276
+ border: 1px solid #d8e0f0;
277
+ background: #fff;
278
+ box-shadow: 0px 1px 2px 0px rgba(184, 200, 224, 0.22);
279
+ }
280
+
281
+ ::v-deep(.q-field--filled .q-field__control:before) {
282
+ background: #fff !important;
283
+ border: none;
284
+ }
285
+
286
+ ::v-deep(.q-field--with-bottom) {
287
+ padding-bottom: 0;
288
+ }
289
+
290
+ ::v-deep(.q-field__bottom) {
291
+ padding: 0;
292
+ }
293
+
294
+ .clear-input {
295
+ color: #d8e0f0;
296
+ }
297
+
298
+ .required {
299
+ color: #f65160;
300
+ font-weight: bold;
301
+ }
302
+
303
+ &__actions {
304
+ padding: 18px 0;
305
+ border-radius: 0px 0px 16px 16px;
306
+ background: #f4f9fd;
307
+
308
+ button {
309
+ padding: 13px 37px;
310
+ border-radius: 4px;
311
+ font-size: 16px;
312
+ font-weight: 700;
313
+ text-transform: none;
314
+
315
+ &.remove {
316
+ border: 1px solid #f65160;
317
+ color: #f65160;
318
+ }
319
+ &.confirm {
320
+ background: #3f8cff;
321
+ color: #fff;
322
+ }
323
+
324
+ &.cancel {
325
+ color: #3f8cff;
326
+ border: 1px solid #3f8cff;
327
+ }
328
+ }
329
+ }
330
+ }
331
+ </style>