shared-ritm 1.3.36 → 1.3.37

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 (57) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared-ritm.es.js +8789 -8712
  3. package/dist/shared-ritm.umd.js +324 -324
  4. package/dist/types/api/services/PhotoService.d.ts +38 -51
  5. package/dist/types/api/services/RepairsService.d.ts +1 -1
  6. package/dist/types/api/services/VideoService.d.ts +2 -1
  7. package/dist/types/api/settings/ApiService.d.ts +1 -1
  8. package/dist/types/api/types/Api_Tasks.d.ts +1 -0
  9. package/dist/types/api/types/Api_Video.d.ts +5 -4
  10. package/package.json +64 -64
  11. package/src/App.vue +2461 -2461
  12. package/src/api/services/BrigadesService.ts +32 -32
  13. package/src/api/services/ControlsService.ts +96 -96
  14. package/src/api/services/EquipmentService.ts +29 -29
  15. package/src/api/services/InstrumentsService.ts +68 -68
  16. package/src/api/services/MetricsService.ts +123 -123
  17. package/src/api/services/ModulesService.ts +27 -27
  18. package/src/api/services/ProjectsService.ts +83 -83
  19. package/src/api/services/RepairsService.ts +111 -111
  20. package/src/api/services/ScheduleService.ts +69 -69
  21. package/src/api/services/SearchService.ts +22 -22
  22. package/src/api/services/UserService.ts +123 -123
  23. package/src/api/services/VideoService.ts +118 -113
  24. package/src/api/settings/ApiService.ts +124 -124
  25. package/src/api/types/Api_Auth.ts +105 -105
  26. package/src/api/types/Api_Brigades.ts +36 -36
  27. package/src/api/types/Api_Controls.ts +111 -111
  28. package/src/api/types/Api_Equipment.ts +3 -3
  29. package/src/api/types/Api_Instruments.ts +156 -156
  30. package/src/api/types/Api_Metrics.ts +5 -5
  31. package/src/api/types/Api_Modules.ts +21 -21
  32. package/src/api/types/Api_Projects.ts +62 -62
  33. package/src/api/types/Api_Repairs.ts +186 -186
  34. package/src/api/types/Api_Schedule.ts +64 -64
  35. package/src/api/types/Api_Search.ts +80 -80
  36. package/src/api/types/Api_Tasks.ts +1 -0
  37. package/src/api/types/Api_User.ts +146 -146
  38. package/src/api/types/Api_Video.ts +244 -241
  39. package/src/common/app-datepicker/AppDatepicker.vue +218 -218
  40. package/src/common/app-dropdown/AppDropdown.vue +37 -37
  41. package/src/common/app-input-new/AppInputNew.vue +179 -179
  42. package/src/common/app-layout/AppLayout.vue +84 -84
  43. package/src/common/app-modal/index.vue +96 -96
  44. package/src/common/app-sheet-new/AppSheetNew.vue +244 -244
  45. package/src/common/app-sidebar/AppSidebar.vue +174 -174
  46. package/src/common/app-sidebar/components/SidebarMenuItem.vue +149 -149
  47. package/src/common/app-table/AppTable.vue +313 -313
  48. package/src/common/app-table/AppTableLayout.vue +137 -137
  49. package/src/common/app-table/components/ModalSelect.vue +298 -298
  50. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  51. package/src/common/app-table/controllers/useTableModel.ts +102 -102
  52. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  53. package/src/index.ts +131 -131
  54. package/src/styles/variables.sass +12 -12
  55. package/src/utils/files.ts +19 -19
  56. package/dist/types/api/services/ComentsServise.d.ts +0 -10
  57. package/dist/types/api/types/Api_Users.d.ts +0 -43
@@ -1,298 +1,298 @@
1
- <template>
2
- <label v-if="label" class="field-label" :data-test="`${dataTest}-label`">
3
- {{ label }}
4
- <span v-if="rules?.length && isShowRequired" class="required">*</span>
5
- </label>
6
-
7
- <q-select
8
- ref="select"
9
- v-model="selected"
10
- :data-test="dataTest"
11
- :options="filteredOptions"
12
- :disable="isDisabled"
13
- :multiple="multiple"
14
- :popup-content-class="'custom-select-menu'"
15
- :hide-selected="!showChip && !simple"
16
- :placeholder="isEmpty || (multiple && !showChip) ? placeholder : null"
17
- :loading="loading"
18
- :option-value="optionValue || 'value'"
19
- :option-label="optionLabel || 'label'"
20
- emit-value
21
- filled
22
- map-options
23
- stack-label
24
- :use-input="!hideSearch"
25
- :use-chips="!simple"
26
- :hide-bottom-space="hideBottomSpace"
27
- input-debounce="100"
28
- autocomplete=""
29
- :rules="rules"
30
- :popup-content-style="popupContentStyle"
31
- @virtual-scroll="onScroll"
32
- @filter="filterFn"
33
- @add="clearInputAfterFilterSelection"
34
- >
35
- <template v-if="multiple || showChip || 'selected' in slots" #selected-item="scope">
36
- <slot v-if="'selected' in slots && scope.opt" name="selected" :opt="scope.opt" />
37
- <q-chip
38
- v-else-if="scope.opt"
39
- removable
40
- :tabindex="scope.tabindex"
41
- :style="{ backgroundColor: chipColor }"
42
- icon-remove="close"
43
- text-color="secondary"
44
- @remove="scope.removeAtIndex(scope.index)"
45
- >
46
- {{ scope.opt[optionLabel || 'label'] }}
47
- </q-chip>
48
- </template>
49
-
50
- <template #append>
51
- <q-icon
52
- v-if="!isDisabled && !isEmpty"
53
- name="close"
54
- class="cursor-pointer clear-input"
55
- @click.stop="handleClear"
56
- />
57
- </template>
58
-
59
- <template #no-option>
60
- <div class="q-pa-sm">
61
- <q-item>
62
- <q-item-section class="wrapper-empty-text">
63
- {{ emptyText || 'Нет данных' }}
64
- <button
65
- v-if="allowCreate && internalSearch && internalSearch.trim()"
66
- class="add-new-items"
67
- @click="handleCreateFromSearch"
68
- >
69
- Добавить
70
- </button>
71
- </q-item-section>
72
- </q-item>
73
- </div>
74
- </template>
75
-
76
- <template #option="scope">
77
- <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
78
- <q-spinner-dots size="24px" color="primary" />
79
- </q-item>
80
- <q-item v-else-if="'option' in slots" v-bind="scope.itemProps">
81
- <slot name="option" :opt="scope.opt" />
82
- </q-item>
83
- <q-item v-else v-bind="scope.itemProps">
84
- <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
85
- </q-item>
86
- </template>
87
- </q-select>
88
- </template>
89
-
90
- <script setup lang="ts">
91
- import { computed, defineEmits, defineProps, ref, Ref, useSlots } from 'vue'
92
- import { QSelect } from 'quasar'
93
- type Option = Record<string, any>
94
-
95
- interface AppQSelectProps {
96
- modelValue: any
97
- options: Option[]
98
- placeholder?: string | undefined
99
- emptyText?: string
100
- optionLabel?: string
101
- optionValue?: string
102
- label?: string
103
- multiple?: boolean
104
- loading?: boolean
105
- isShowRequired?: boolean
106
- isDisabled?: boolean
107
- allowCreate?: boolean
108
- isSearch?: boolean
109
- hideSearch?: boolean
110
- showChip?: boolean
111
- simple?: boolean
112
- hideBottomSpace?: boolean
113
- chipColor?: string
114
- height?: string
115
- borderColor?: string
116
- borderRadius?: string
117
- menuWidth?: string
118
- rules?: ((val: any) => boolean | string)[]
119
- popupContentStyle?: string
120
- dataTest?: string
121
- }
122
-
123
- const props = defineProps<AppQSelectProps>()
124
- const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
125
-
126
- const slots = useSlots()
127
-
128
- const select = ref<QSelect | null>(null)
129
- const lcText: Ref<string> = ref('')
130
- const internalSearch = ref('')
131
-
132
- const selected = computed({
133
- get() {
134
- return props.modelValue
135
- },
136
- set(value) {
137
- emit('update:modelValue', value)
138
- },
139
- })
140
-
141
- const isEmpty = computed(() => {
142
- if (!props.modelValue && props.modelValue !== 0) return true
143
-
144
- return Array.isArray(props.modelValue) && !props.modelValue.length
145
- })
146
-
147
- function handleClear() {
148
- const emptyValue = props.multiple ? [] : null
149
- selected.value = emptyValue
150
- lcText.value = ''
151
- emit('update:modelValue', emptyValue)
152
- emit('clear')
153
- }
154
-
155
- const filteredOptions = computed(() => {
156
- const labelKey = props.optionLabel || 'label'
157
-
158
- const baseOptions =
159
- 'option' in slots
160
- ? props.options
161
- : props.options.filter(x => {
162
- const label = x[labelKey]
163
- return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
164
- })
165
-
166
- if (props.loading) {
167
- return [
168
- ...baseOptions,
169
- {
170
- __loading: true,
171
- label: '__loading__',
172
- value: '__loading__',
173
- },
174
- ]
175
- }
176
-
177
- return baseOptions
178
- })
179
-
180
- function handleCreateFromSearch() {
181
- const labelKey = props.optionLabel || 'label'
182
- const valueKey = props.optionValue || 'value'
183
-
184
- const trimmed = internalSearch.value?.trim()
185
- if (!trimmed) return
186
-
187
- const newOption = {
188
- [labelKey]: trimmed,
189
- [valueKey]: trimmed,
190
- }
191
- emit('create', newOption)
192
- handleClear()
193
- }
194
-
195
- function filterFn(val: string, update: (cb: () => void) => void) {
196
- debouncedFilter(val, update)
197
- }
198
-
199
- const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
200
- internalSearch.value = val
201
- emit('update:search', val)
202
- update(() => {
203
- lcText.value = val.toLowerCase()
204
- })
205
- }, 500)
206
-
207
- function onScroll({ to, ref: qSelectRef }) {
208
- const totalOptions = qSelectRef.options.length
209
- if (to >= totalOptions - 1 && !lcText.value) {
210
- emit('update:scroll')
211
- }
212
- }
213
-
214
- function clearInputAfterFilterSelection() {
215
- if (!props.hideSearch && select.value) {
216
- select.value.updateInputValue('')
217
- }
218
- }
219
-
220
- function debounce<T>(fn: T, ms) {
221
- let timeoutId
222
- return function (...args) {
223
- clearTimeout(timeoutId)
224
- return new Promise(resolve => {
225
- timeoutId = setTimeout(() => {
226
- resolve(fn(...args))
227
- }, ms)
228
- })
229
- }
230
- }
231
- </script>
232
-
233
- <style lang="scss" scoped>
234
- .wrapper-empty-text {
235
- display: flex;
236
- align-items: center;
237
- justify-content: space-between;
238
- flex-direction: row;
239
- .add-new-items {
240
- background: #3f8cff;
241
- color: #fff;
242
- outline: none;
243
- border: none;
244
- border-radius: 4px;
245
- padding: 5px 10px;
246
- cursor: pointer;
247
- }
248
- }
249
- .field-label {
250
- font-size: 14px;
251
- font-weight: 700;
252
- color: #7d8592;
253
- }
254
- .required {
255
- color: #f65160;
256
- font-weight: bold;
257
- }
258
-
259
- ::v-deep(.q-placeholder) {
260
- color: #7d8592;
261
- }
262
- ::v-deep(.q-field__control) {
263
- border-radius: 8px;
264
- border: 1px solid #d8e0f0;
265
- background: #fff;
266
- box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
267
- }
268
- :deep(.q-field__control:before) {
269
- display: none;
270
- }
271
- :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
272
- background: #fff !important;
273
- border: none;
274
- }
275
- ::v-deep(.q-field--with-bottom) {
276
- padding-bottom: 0;
277
- }
278
- ::v-deep(.q-field__bottom) {
279
- padding: 0;
280
- }
281
- .clear-input {
282
- color: #d8e0f0;
283
- }
284
- ::v-deep(.q-chip) {
285
- border-radius: 4px;
286
- background: #e9eff9;
287
- color: #1d425d;
288
- font-family: NunitoSansFont, sans-serif;
289
- font-size: 14px;
290
- height: 30px;
291
- line-height: 30px;
292
- padding: 0 15px;
293
- .q-chip__icon {
294
- color: #3f8cff;
295
- margin-left: 5px;
296
- }
297
- }
298
- </style>
1
+ <template>
2
+ <label v-if="label" class="field-label" :data-test="`${dataTest}-label`">
3
+ {{ label }}
4
+ <span v-if="rules?.length && isShowRequired" class="required">*</span>
5
+ </label>
6
+
7
+ <q-select
8
+ ref="select"
9
+ v-model="selected"
10
+ :data-test="dataTest"
11
+ :options="filteredOptions"
12
+ :disable="isDisabled"
13
+ :multiple="multiple"
14
+ :popup-content-class="'custom-select-menu'"
15
+ :hide-selected="!showChip && !simple"
16
+ :placeholder="isEmpty || (multiple && !showChip) ? placeholder : null"
17
+ :loading="loading"
18
+ :option-value="optionValue || 'value'"
19
+ :option-label="optionLabel || 'label'"
20
+ emit-value
21
+ filled
22
+ map-options
23
+ stack-label
24
+ :use-input="!hideSearch"
25
+ :use-chips="!simple"
26
+ :hide-bottom-space="hideBottomSpace"
27
+ input-debounce="100"
28
+ autocomplete=""
29
+ :rules="rules"
30
+ :popup-content-style="popupContentStyle"
31
+ @virtual-scroll="onScroll"
32
+ @filter="filterFn"
33
+ @add="clearInputAfterFilterSelection"
34
+ >
35
+ <template v-if="multiple || showChip || 'selected' in slots" #selected-item="scope">
36
+ <slot v-if="'selected' in slots && scope.opt" name="selected" :opt="scope.opt" />
37
+ <q-chip
38
+ v-else-if="scope.opt"
39
+ removable
40
+ :tabindex="scope.tabindex"
41
+ :style="{ backgroundColor: chipColor }"
42
+ icon-remove="close"
43
+ text-color="secondary"
44
+ @remove="scope.removeAtIndex(scope.index)"
45
+ >
46
+ {{ scope.opt[optionLabel || 'label'] }}
47
+ </q-chip>
48
+ </template>
49
+
50
+ <template #append>
51
+ <q-icon
52
+ v-if="!isDisabled && !isEmpty"
53
+ name="close"
54
+ class="cursor-pointer clear-input"
55
+ @click.stop="handleClear"
56
+ />
57
+ </template>
58
+
59
+ <template #no-option>
60
+ <div class="q-pa-sm">
61
+ <q-item>
62
+ <q-item-section class="wrapper-empty-text">
63
+ {{ emptyText || 'Нет данных' }}
64
+ <button
65
+ v-if="allowCreate && internalSearch && internalSearch.trim()"
66
+ class="add-new-items"
67
+ @click="handleCreateFromSearch"
68
+ >
69
+ Добавить
70
+ </button>
71
+ </q-item-section>
72
+ </q-item>
73
+ </div>
74
+ </template>
75
+
76
+ <template #option="scope">
77
+ <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
78
+ <q-spinner-dots size="24px" color="primary" />
79
+ </q-item>
80
+ <q-item v-else-if="'option' in slots" v-bind="scope.itemProps">
81
+ <slot name="option" :opt="scope.opt" />
82
+ </q-item>
83
+ <q-item v-else v-bind="scope.itemProps">
84
+ <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
85
+ </q-item>
86
+ </template>
87
+ </q-select>
88
+ </template>
89
+
90
+ <script setup lang="ts">
91
+ import { computed, defineEmits, defineProps, ref, Ref, useSlots } from 'vue'
92
+ import { QSelect } from 'quasar'
93
+ type Option = Record<string, any>
94
+
95
+ interface AppQSelectProps {
96
+ modelValue: any
97
+ options: Option[]
98
+ placeholder?: string | undefined
99
+ emptyText?: string
100
+ optionLabel?: string
101
+ optionValue?: string
102
+ label?: string
103
+ multiple?: boolean
104
+ loading?: boolean
105
+ isShowRequired?: boolean
106
+ isDisabled?: boolean
107
+ allowCreate?: boolean
108
+ isSearch?: boolean
109
+ hideSearch?: boolean
110
+ showChip?: boolean
111
+ simple?: boolean
112
+ hideBottomSpace?: boolean
113
+ chipColor?: string
114
+ height?: string
115
+ borderColor?: string
116
+ borderRadius?: string
117
+ menuWidth?: string
118
+ rules?: ((val: any) => boolean | string)[]
119
+ popupContentStyle?: string
120
+ dataTest?: string
121
+ }
122
+
123
+ const props = defineProps<AppQSelectProps>()
124
+ const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
125
+
126
+ const slots = useSlots()
127
+
128
+ const select = ref<QSelect | null>(null)
129
+ const lcText: Ref<string> = ref('')
130
+ const internalSearch = ref('')
131
+
132
+ const selected = computed({
133
+ get() {
134
+ return props.modelValue
135
+ },
136
+ set(value) {
137
+ emit('update:modelValue', value)
138
+ },
139
+ })
140
+
141
+ const isEmpty = computed(() => {
142
+ if (!props.modelValue && props.modelValue !== 0) return true
143
+
144
+ return Array.isArray(props.modelValue) && !props.modelValue.length
145
+ })
146
+
147
+ function handleClear() {
148
+ const emptyValue = props.multiple ? [] : null
149
+ selected.value = emptyValue
150
+ lcText.value = ''
151
+ emit('update:modelValue', emptyValue)
152
+ emit('clear')
153
+ }
154
+
155
+ const filteredOptions = computed(() => {
156
+ const labelKey = props.optionLabel || 'label'
157
+
158
+ const baseOptions =
159
+ 'option' in slots
160
+ ? props.options
161
+ : props.options.filter(x => {
162
+ const label = x[labelKey]
163
+ return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
164
+ })
165
+
166
+ if (props.loading) {
167
+ return [
168
+ ...baseOptions,
169
+ {
170
+ __loading: true,
171
+ label: '__loading__',
172
+ value: '__loading__',
173
+ },
174
+ ]
175
+ }
176
+
177
+ return baseOptions
178
+ })
179
+
180
+ function handleCreateFromSearch() {
181
+ const labelKey = props.optionLabel || 'label'
182
+ const valueKey = props.optionValue || 'value'
183
+
184
+ const trimmed = internalSearch.value?.trim()
185
+ if (!trimmed) return
186
+
187
+ const newOption = {
188
+ [labelKey]: trimmed,
189
+ [valueKey]: trimmed,
190
+ }
191
+ emit('create', newOption)
192
+ handleClear()
193
+ }
194
+
195
+ function filterFn(val: string, update: (cb: () => void) => void) {
196
+ debouncedFilter(val, update)
197
+ }
198
+
199
+ const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
200
+ internalSearch.value = val
201
+ emit('update:search', val)
202
+ update(() => {
203
+ lcText.value = val.toLowerCase()
204
+ })
205
+ }, 500)
206
+
207
+ function onScroll({ to, ref: qSelectRef }) {
208
+ const totalOptions = qSelectRef.options.length
209
+ if (to >= totalOptions - 1 && !lcText.value) {
210
+ emit('update:scroll')
211
+ }
212
+ }
213
+
214
+ function clearInputAfterFilterSelection() {
215
+ if (!props.hideSearch && select.value) {
216
+ select.value.updateInputValue('')
217
+ }
218
+ }
219
+
220
+ function debounce<T>(fn: T, ms) {
221
+ let timeoutId
222
+ return function (...args) {
223
+ clearTimeout(timeoutId)
224
+ return new Promise(resolve => {
225
+ timeoutId = setTimeout(() => {
226
+ resolve(fn(...args))
227
+ }, ms)
228
+ })
229
+ }
230
+ }
231
+ </script>
232
+
233
+ <style lang="scss" scoped>
234
+ .wrapper-empty-text {
235
+ display: flex;
236
+ align-items: center;
237
+ justify-content: space-between;
238
+ flex-direction: row;
239
+ .add-new-items {
240
+ background: #3f8cff;
241
+ color: #fff;
242
+ outline: none;
243
+ border: none;
244
+ border-radius: 4px;
245
+ padding: 5px 10px;
246
+ cursor: pointer;
247
+ }
248
+ }
249
+ .field-label {
250
+ font-size: 14px;
251
+ font-weight: 700;
252
+ color: #7d8592;
253
+ }
254
+ .required {
255
+ color: #f65160;
256
+ font-weight: bold;
257
+ }
258
+
259
+ ::v-deep(.q-placeholder) {
260
+ color: #7d8592;
261
+ }
262
+ ::v-deep(.q-field__control) {
263
+ border-radius: 8px;
264
+ border: 1px solid #d8e0f0;
265
+ background: #fff;
266
+ box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
267
+ }
268
+ :deep(.q-field__control:before) {
269
+ display: none;
270
+ }
271
+ :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
272
+ background: #fff !important;
273
+ border: none;
274
+ }
275
+ ::v-deep(.q-field--with-bottom) {
276
+ padding-bottom: 0;
277
+ }
278
+ ::v-deep(.q-field__bottom) {
279
+ padding: 0;
280
+ }
281
+ .clear-input {
282
+ color: #d8e0f0;
283
+ }
284
+ ::v-deep(.q-chip) {
285
+ border-radius: 4px;
286
+ background: #e9eff9;
287
+ color: #1d425d;
288
+ font-family: NunitoSansFont, sans-serif;
289
+ font-size: 14px;
290
+ height: 30px;
291
+ line-height: 30px;
292
+ padding: 0 15px;
293
+ .q-chip__icon {
294
+ color: #3f8cff;
295
+ margin-left: 5px;
296
+ }
297
+ }
298
+ </style>
@@ -1,45 +1,45 @@
1
- import { ref, watch, onMounted, Ref } from 'vue'
2
-
3
- export function useBaseTable(model: {
4
- initialize: (params: { search: string; page: number }) => Promise<void>
5
- loading: Ref<boolean>
6
- columnFilters: Ref<Record<string, any>>
7
- }) {
8
- const search = ref('')
9
- const currentPage = ref(1)
10
-
11
- const loadTable = async (searchVal = '', pageVal = 1) => {
12
- await model.initialize({ search: searchVal, page: pageVal })
13
- }
14
-
15
- const handleSearch = async (val: string) => {
16
- search.value = val
17
- currentPage.value = 1
18
- await loadTable(val, currentPage.value)
19
- }
20
-
21
- const handlePageChange = async (page: number) => {
22
- currentPage.value = page
23
- await loadTable(search.value, page)
24
- }
25
-
26
- watch(
27
- () => model.columnFilters.value,
28
- async () => {
29
- currentPage.value = 1
30
- await loadTable(search.value, currentPage.value)
31
- },
32
- { deep: true },
33
- )
34
-
35
- onMounted(() => loadTable(search.value, currentPage.value))
36
-
37
- return {
38
- search,
39
- currentPage,
40
- loading: model.loading,
41
- handleSearch,
42
- handlePageChange,
43
- loadTable,
44
- }
45
- }
1
+ import { ref, watch, onMounted, Ref } from 'vue'
2
+
3
+ export function useBaseTable(model: {
4
+ initialize: (params: { search: string; page: number }) => Promise<void>
5
+ loading: Ref<boolean>
6
+ columnFilters: Ref<Record<string, any>>
7
+ }) {
8
+ const search = ref('')
9
+ const currentPage = ref(1)
10
+
11
+ const loadTable = async (searchVal = '', pageVal = 1) => {
12
+ await model.initialize({ search: searchVal, page: pageVal })
13
+ }
14
+
15
+ const handleSearch = async (val: string) => {
16
+ search.value = val
17
+ currentPage.value = 1
18
+ await loadTable(val, currentPage.value)
19
+ }
20
+
21
+ const handlePageChange = async (page: number) => {
22
+ currentPage.value = page
23
+ await loadTable(search.value, page)
24
+ }
25
+
26
+ watch(
27
+ () => model.columnFilters.value,
28
+ async () => {
29
+ currentPage.value = 1
30
+ await loadTable(search.value, currentPage.value)
31
+ },
32
+ { deep: true },
33
+ )
34
+
35
+ onMounted(() => loadTable(search.value, currentPage.value))
36
+
37
+ return {
38
+ search,
39
+ currentPage,
40
+ loading: model.loading,
41
+ handleSearch,
42
+ handlePageChange,
43
+ loadTable,
44
+ }
45
+ }