shared-ritm 1.2.71 → 1.2.73
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/index.css +1 -1
- package/dist/shared-ritm.es.js +1293 -1270
- package/dist/shared-ritm.umd.js +105 -105
- package/dist/types/api/types/Api_Repairs.d.ts +3 -3
- package/package.json +1 -1
- package/src/api/types/Api_Repairs.ts +3 -3
- package/src/common/app-table/AppTable.vue +67 -20
|
@@ -78,9 +78,9 @@ export type Api_Create_Repair_With_Template = Omit<Api_Create_Repair_With_Equipm
|
|
|
78
78
|
export type Api_Update_Repair = {
|
|
79
79
|
name?: string;
|
|
80
80
|
display_name?: string;
|
|
81
|
-
description?: string;
|
|
82
|
-
power_output_MWh?: number;
|
|
83
|
-
cost_per_MWh?: number;
|
|
81
|
+
description?: string | null;
|
|
82
|
+
power_output_MWh?: number | null;
|
|
83
|
+
cost_per_MWh?: number | null;
|
|
84
84
|
category?: number;
|
|
85
85
|
user_id_list?: string[];
|
|
86
86
|
team_id_list?: string[];
|
package/package.json
CHANGED
|
@@ -83,9 +83,9 @@ export type Api_Create_Repair_With_Template = Omit<Api_Create_Repair_With_Equipm
|
|
|
83
83
|
export type Api_Update_Repair = {
|
|
84
84
|
name?: string
|
|
85
85
|
display_name?: string
|
|
86
|
-
description?: string
|
|
87
|
-
power_output_MWh?: number
|
|
88
|
-
cost_per_MWh?: number
|
|
86
|
+
description?: string | null
|
|
87
|
+
power_output_MWh?: number | null
|
|
88
|
+
cost_per_MWh?: number | null
|
|
89
89
|
category?: number
|
|
90
90
|
user_id_list?: string[]
|
|
91
91
|
team_id_list?: string[]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<q-table
|
|
4
4
|
v-model:selected="selected"
|
|
5
5
|
:rows="rows.value"
|
|
6
|
-
:columns="
|
|
6
|
+
:columns="resCols"
|
|
7
7
|
row-key="id"
|
|
8
8
|
flat
|
|
9
9
|
bordered
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
:rows-per-page-options="[0]"
|
|
13
13
|
:selection="props.enableMultiSelect ? 'multiple' : 'none'"
|
|
14
14
|
style="height: 100%"
|
|
15
|
-
@row-click="
|
|
15
|
+
@row-click="rowClick"
|
|
16
16
|
>
|
|
17
17
|
<template #header-selection="scope">
|
|
18
18
|
<q-toggle v-model="scope.selected" />
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
<q-toggle v-model="scope.selected" />
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
<template #body-cell-index="
|
|
26
|
-
<q-td :props="
|
|
27
|
-
{{
|
|
25
|
+
<template #body-cell-index="cellProps">
|
|
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 }}
|
|
28
28
|
</q-td>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
|
-
<template v-for="col in
|
|
32
|
-
<q-th :props="propsSlot" :class="{ 'cursor-pointer': col.filterType }">
|
|
31
|
+
<template v-for="col in resCols" :key="col.name" #[`header-cell-${col.name}`]="propsSlot">
|
|
32
|
+
<q-th :props="propsSlot" :class="{ 'cursor-pointer': col.filterType, actions: col.name === 'actions' }">
|
|
33
33
|
<div
|
|
34
34
|
v-if="col.filterType"
|
|
35
35
|
class="row items-center no-wrap"
|
|
@@ -90,26 +90,35 @@
|
|
|
90
90
|
</q-th>
|
|
91
91
|
</template>
|
|
92
92
|
|
|
93
|
-
<template #body-cell="
|
|
94
|
-
<q-td
|
|
93
|
+
<template #body-cell="cellProps">
|
|
94
|
+
<q-td
|
|
95
|
+
:props="cellProps"
|
|
96
|
+
:class="{
|
|
97
|
+
'q-td--no-hover': noHover || cellProps.col.name === 'actions',
|
|
98
|
+
actions: cellProps.col.name === 'actions',
|
|
99
|
+
}"
|
|
100
|
+
>
|
|
101
|
+
<div v-if="cellProps.col.name === 'actions'" class="actions__btns">
|
|
102
|
+
<q-btn square icon="edit" size="sm" unelevated title="Редактировать" @click="emit('edit', cellProps.row)" />
|
|
103
|
+
</div>
|
|
95
104
|
<q-badge
|
|
96
|
-
v-if="
|
|
105
|
+
v-else-if="cellProps.col.badge && typeof cellProps.value === 'boolean'"
|
|
97
106
|
:color="
|
|
98
|
-
|
|
99
|
-
?
|
|
100
|
-
:
|
|
101
|
-
?
|
|
102
|
-
:
|
|
107
|
+
cellProps.col.badge.colorTrue && cellProps.value
|
|
108
|
+
? cellProps.col.badge.colorTrue
|
|
109
|
+
: cellProps.col.badge.colorFalse && !cellProps.value
|
|
110
|
+
? cellProps.col.badge.colorFalse
|
|
111
|
+
: cellProps.value
|
|
103
112
|
? 'green'
|
|
104
113
|
: 'red'
|
|
105
114
|
"
|
|
106
115
|
outline
|
|
107
116
|
class="text-bold"
|
|
108
117
|
>
|
|
109
|
-
{{
|
|
118
|
+
{{ cellProps.value ? cellProps.col.badge.true ?? 'Да' : cellProps.col.badge.false ?? 'Нет' }}
|
|
110
119
|
</q-badge>
|
|
111
|
-
<span v-else-if="
|
|
112
|
-
<span v-else>{{
|
|
120
|
+
<span v-else-if="cellProps.col.html" v-html="cellProps.value"></span>
|
|
121
|
+
<span v-else>{{ cellProps.value }}</span>
|
|
113
122
|
</q-td>
|
|
114
123
|
</template>
|
|
115
124
|
</q-table>
|
|
@@ -131,6 +140,7 @@ interface TableEmits {
|
|
|
131
140
|
'open-filter-menu': [colName: string, isOpen: boolean]
|
|
132
141
|
'row-click': [row: Record<string, any>]
|
|
133
142
|
'update:selectedRows': [rows: any[]] // синтаксис defineEmits для эмита с именованными параметрами
|
|
143
|
+
edit: [row: Record<string, any>]
|
|
134
144
|
}
|
|
135
145
|
|
|
136
146
|
const props = defineProps<{
|
|
@@ -143,12 +153,19 @@ const props = defineProps<{
|
|
|
143
153
|
enableMultiSelect?: boolean
|
|
144
154
|
noHover?: boolean
|
|
145
155
|
selectedRows: any[]
|
|
156
|
+
actions?: string[]
|
|
146
157
|
}>()
|
|
147
158
|
const emit = defineEmits<TableEmits>()
|
|
148
159
|
|
|
149
160
|
const localSearches = ref<Record<string, string>>({})
|
|
150
161
|
const selected = ref<any[]>([])
|
|
151
162
|
|
|
163
|
+
const resCols = computed(() => {
|
|
164
|
+
if (!props.actions?.length) return props.columns
|
|
165
|
+
|
|
166
|
+
return [...props.columns, { name: 'actions', label: 'Действия', align: 'center' }]
|
|
167
|
+
})
|
|
168
|
+
|
|
152
169
|
const filteredOptions = computed(() => {
|
|
153
170
|
const result: Record<string, FilterOption[]> = {}
|
|
154
171
|
for (const col of props.columns) {
|
|
@@ -159,6 +176,14 @@ const filteredOptions = computed(() => {
|
|
|
159
176
|
return result
|
|
160
177
|
})
|
|
161
178
|
|
|
179
|
+
const rowClick = (e: Event, row: Record<string, any>) => {
|
|
180
|
+
const target = e?.target
|
|
181
|
+
|
|
182
|
+
if (!(target instanceof HTMLElement) || target.closest('.actions') || document.getSelection()?.toString()) return
|
|
183
|
+
|
|
184
|
+
emit('row-click', row)
|
|
185
|
+
}
|
|
186
|
+
|
|
162
187
|
watch(
|
|
163
188
|
() => props.selectedRows,
|
|
164
189
|
val => {
|
|
@@ -176,6 +201,28 @@ watch(
|
|
|
176
201
|
)
|
|
177
202
|
</script>
|
|
178
203
|
<style scoped lang="scss">
|
|
204
|
+
.actions {
|
|
205
|
+
width: 100px;
|
|
206
|
+
background-color: #f2f7fb;
|
|
207
|
+
position: sticky;
|
|
208
|
+
right: 0;
|
|
209
|
+
z-index: 1;
|
|
210
|
+
border-left: 1px solid #d7e0ef;
|
|
211
|
+
|
|
212
|
+
&__btns {
|
|
213
|
+
display: flex;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
gap: 0.5rem;
|
|
216
|
+
|
|
217
|
+
button {
|
|
218
|
+
background-color: #a4b4cf50;
|
|
219
|
+
width: 32px;
|
|
220
|
+
height: 32px;
|
|
221
|
+
border-radius: 8px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
179
226
|
.cursor-pointer {
|
|
180
227
|
cursor: pointer;
|
|
181
228
|
}
|
|
@@ -196,7 +243,7 @@ watch(
|
|
|
196
243
|
}
|
|
197
244
|
.q-item__section {
|
|
198
245
|
min-width: 30px;
|
|
199
|
-
padding:
|
|
246
|
+
padding: 0;
|
|
200
247
|
}
|
|
201
248
|
::v-deep(.q-radio__inner),
|
|
202
249
|
::v-deep(.q-checkbox__inner) {
|
|
@@ -214,7 +261,7 @@ watch(
|
|
|
214
261
|
position: sticky;
|
|
215
262
|
top: 0;
|
|
216
263
|
background: #f2f7fb;
|
|
217
|
-
z-index:
|
|
264
|
+
z-index: 2;
|
|
218
265
|
}
|
|
219
266
|
|
|
220
267
|
::v-deep(.q-table th) {
|