shared-ritm 1.2.98 → 1.2.100
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 +2707 -2679
- package/dist/shared-ritm.umd.js +265 -265
- package/dist/types/api/services/UserService.d.ts +7 -0
- package/package.json +1 -1
- package/src/api/services/UserService.ts +14 -0
- package/src/common/app-table/components/TableModal.vue +28 -3
|
@@ -44,6 +44,13 @@ declare class UserService extends ApiService {
|
|
|
44
44
|
data: boolean;
|
|
45
45
|
status: number;
|
|
46
46
|
}>;
|
|
47
|
+
checkUserVectors(id: string): Promise<{
|
|
48
|
+
count: number;
|
|
49
|
+
}>;
|
|
50
|
+
addUserVectors(formData: FormData): Promise<{
|
|
51
|
+
response: string;
|
|
52
|
+
}>;
|
|
53
|
+
removeUserVectors(id: string): Promise<unknown>;
|
|
47
54
|
}
|
|
48
55
|
export default function useUserService(): UserService;
|
|
49
56
|
export {};
|
package/package.json
CHANGED
|
@@ -77,6 +77,20 @@ class UserService extends ApiService {
|
|
|
77
77
|
public async deleteTeam(id: string): Promise<{ data: boolean; status: number }> {
|
|
78
78
|
return await this.delete(`/teams/${id}`)
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
public async checkUserVectors(id: string): Promise<{ count: number }> {
|
|
82
|
+
return await this.get(`/user/get-vectors/${id}`)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public async addUserVectors(formData: FormData): Promise<{ response: string }> {
|
|
86
|
+
return await this.post(`/user/add-vector`, formData, {
|
|
87
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public async removeUserVectors(id: string): Promise<unknown> {
|
|
92
|
+
return await this.delete(`/user/delete-vectors/${id}`)
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
let api: UserService
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-dialog :model-value="modelValue" @update:model-value="
|
|
2
|
+
<q-dialog :model-value="modelValue" @update:model-value="toggleModal">
|
|
3
3
|
<q-card style="min-width: 700px">
|
|
4
4
|
<q-card-section>
|
|
5
5
|
<div class="modal-title">{{ title }}</div>
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
@click="submit"
|
|
89
89
|
/>
|
|
90
90
|
<q-btn v-else class="confirm" flat label="Редактировать" :disable="loading" @click="$emit('edit')" />
|
|
91
|
-
<q-btn
|
|
91
|
+
<q-btn class="cancel" flat label="Закрыть" :disable="loading" @click="close" />
|
|
92
92
|
</q-card-actions>
|
|
93
93
|
</q-card>
|
|
94
94
|
</q-dialog>
|
|
@@ -129,7 +129,7 @@ const props = defineProps<{
|
|
|
129
129
|
loading?: boolean
|
|
130
130
|
}>()
|
|
131
131
|
const emit = defineEmits<{
|
|
132
|
-
(e: 'update:modelValue', val: boolean): void
|
|
132
|
+
(e: 'update:modelValue', val: boolean, hasChanges?: boolean): void
|
|
133
133
|
(e: 'submit', data: Record<string, any>): void
|
|
134
134
|
(e: 'edit'): void
|
|
135
135
|
(e: 'delete'): void
|
|
@@ -167,6 +167,31 @@ const isSubmitDisabled = computed(() => {
|
|
|
167
167
|
|
|
168
168
|
return !hasChanges
|
|
169
169
|
})
|
|
170
|
+
function toggleModal(val: boolean) {
|
|
171
|
+
if (val) {
|
|
172
|
+
emit('update:modelValue', val)
|
|
173
|
+
} else {
|
|
174
|
+
close()
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function checkChanges() {
|
|
178
|
+
if (props.mode === 'view') {
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!props.initialData || !Object.keys(props.initialData).length) {
|
|
183
|
+
return props.fields?.some(
|
|
184
|
+
field =>
|
|
185
|
+
formData.value?.[field.key] &&
|
|
186
|
+
!(Array.isArray(formData.value?.[field.key]) && !formData.value?.[field.key].length),
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return props.fields?.some(field => !isEqual(formData.value?.[field.key], props.initialData?.[field.key]))
|
|
191
|
+
}
|
|
192
|
+
function close() {
|
|
193
|
+
emit('update:modelValue', false, checkChanges())
|
|
194
|
+
}
|
|
170
195
|
function submit() {
|
|
171
196
|
formRef.value?.validate().then(ok => {
|
|
172
197
|
if (!ok) return
|