shared-ritm 1.3.102 → 1.3.103
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/package.json
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
|
-
import ApiService from '../settings/ApiService'
|
|
2
|
-
import { ResponseApi } from '../types/Api_Service'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public
|
|
12
|
-
return this.
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public
|
|
16
|
-
return this.
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public
|
|
20
|
-
return this.
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public
|
|
24
|
-
return this.
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public
|
|
28
|
-
return this.get<Api_Equipment_Type
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public
|
|
32
|
-
return this.
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public
|
|
36
|
-
return this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
import ApiService from '../settings/ApiService'
|
|
2
|
+
import { ResponseApi } from '../types/Api_Service'
|
|
3
|
+
import {
|
|
4
|
+
Api_Create_Equipment_Dto,
|
|
5
|
+
Api_Equipment_Dto,
|
|
6
|
+
Api_Equipment_Type,
|
|
7
|
+
Api_Equipment_Type_Body,
|
|
8
|
+
} from '@/api/types/Api_Equipment'
|
|
9
|
+
|
|
10
|
+
class EquipmentService extends ApiService {
|
|
11
|
+
public fetchEquipment(params?: any): Promise<ResponseApi<Api_Equipment_Dto[]>> {
|
|
12
|
+
return this.get<ResponseApi<Api_Equipment_Dto[]>>('repairs/equipment/list', { params })
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public createEquipment(payload: Api_Create_Equipment_Dto): Promise<Api_Equipment_Dto> {
|
|
16
|
+
return this.post<Api_Create_Equipment_Dto, Api_Equipment_Dto>('repairs/equipment', payload)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public editEquipment(id: string, payload: Api_Create_Equipment_Dto): Promise<Api_Equipment_Dto> {
|
|
20
|
+
return this.put<Partial<Api_Create_Equipment_Dto>, Api_Equipment_Dto>(`repairs/equipment/${id}`, payload)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public deleteEquipment(id: string): Promise<{ data: boolean; status: number }> {
|
|
24
|
+
return this.delete(`repairs/equipment/${id}`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public fetchEquipmentTypeList(params?: any): Promise<ResponseApi<Api_Equipment_Type[]>> {
|
|
28
|
+
return this.get<ResponseApi<Api_Equipment_Type[]>>('repairs/equipments/get_equipment_type_list', { params })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public fetchEquipmentType(id: string): Promise<Api_Equipment_Type> {
|
|
32
|
+
return this.get<Api_Equipment_Type>(`repairs/equipments/get_equipment_type/${id}`)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public createEquipmentType(body: Api_Equipment_Type_Body): Promise<Api_Equipment_Type> {
|
|
36
|
+
return this.post<Api_Equipment_Type_Body, Api_Equipment_Type>('repairs/equipments/create_equipment_type', body)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public editEquipmentType(id: string, body: Partial<Api_Equipment_Type_Body>): Promise<Api_Equipment_Type> {
|
|
40
|
+
return this.put<Partial<Api_Equipment_Type_Body>, Api_Equipment_Type>(
|
|
41
|
+
`repairs/equipments/update_equipment_type/${id}`,
|
|
42
|
+
body,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public deleteEquipmentType(id: string): Promise<{ data: boolean; status: number }> {
|
|
47
|
+
return this.delete(`repairs/equipments/delete_equipment_type/${id}`)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let api: EquipmentService
|
|
52
|
+
|
|
53
|
+
export default function useEquipmentService() {
|
|
54
|
+
if (!api) api = new EquipmentService()
|
|
55
|
+
return api
|
|
56
|
+
}
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import { Api_Equipment_Full_Dto } from '@/api/types/Api_Repairs'
|
|
2
|
-
|
|
3
|
-
export type Api_Equipment_Create = Omit<Api_Equipment_Full_Dto, 'id'>
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
id: string
|
|
7
|
-
name: string
|
|
8
|
-
model
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Api_Equipment_Full_Dto } from '@/api/types/Api_Repairs'
|
|
2
|
+
|
|
3
|
+
export type Api_Equipment_Create = Omit<Api_Equipment_Full_Dto, 'id'>
|
|
4
|
+
|
|
5
|
+
export type Api_Equipment_Element_Dto = {
|
|
6
|
+
id: string
|
|
7
|
+
name: string
|
|
8
|
+
model: string
|
|
9
|
+
registration_number: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Api_Equipment_Dto = {
|
|
13
|
+
id: string
|
|
14
|
+
name: string
|
|
15
|
+
model: string
|
|
16
|
+
registration_number: string
|
|
17
|
+
repair_frequency: number
|
|
18
|
+
repair_range: number
|
|
19
|
+
parent: Api_Equipment_Element_Dto
|
|
20
|
+
root: Api_Equipment_Element_Dto
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Api_Create_Equipment_Dto = {
|
|
24
|
+
equipment_type_id: string
|
|
25
|
+
parent_id: string
|
|
26
|
+
children: string[]
|
|
27
|
+
registration_number: string
|
|
28
|
+
repair_frequency: number
|
|
29
|
+
repair_range: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type Api_Equipment_Type = {
|
|
33
|
+
id: string
|
|
34
|
+
name: string
|
|
35
|
+
model?: string | null
|
|
36
|
+
description?: string | null
|
|
37
|
+
updated_at: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Api_Equipment_Type_Body = Omit<Api_Equipment_Type, 'id' | 'updated_at'>
|
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-select
|
|
3
|
-
ref="select"
|
|
4
|
-
v-model="selected"
|
|
5
|
-
:data-test="dataTest"
|
|
6
|
-
:options="filteredOptions"
|
|
7
|
-
:option-value="optionValue"
|
|
8
|
-
:option-label="optionLabel"
|
|
9
|
-
emit-value
|
|
10
|
-
map-options
|
|
11
|
-
:disable="isDisabled"
|
|
12
|
-
:multiple="multiple"
|
|
13
|
-
outlined
|
|
14
|
-
stack-label
|
|
15
|
-
:use-input="search"
|
|
16
|
-
:class="[$style.select]"
|
|
17
|
-
:label="label"
|
|
18
|
-
input-debounce="100"
|
|
19
|
-
:popup-content-class="$style['app-select__menu']"
|
|
20
|
-
:clearable="clearable"
|
|
21
|
-
rounded
|
|
22
|
-
autocomplete=""
|
|
23
|
-
@filter="filterFn"
|
|
24
|
-
>
|
|
25
|
-
<template v-if="multiple" #selected-item="scope">
|
|
26
|
-
<q-chip
|
|
27
|
-
v-if="scope.opt"
|
|
28
|
-
removable
|
|
29
|
-
class="q-ma-none"
|
|
30
|
-
dense
|
|
31
|
-
:tabindex="scope.tabindex"
|
|
32
|
-
color="white"
|
|
33
|
-
text-color="secondary"
|
|
34
|
-
@remove="scope.removeAtIndex(scope.index)"
|
|
35
|
-
>
|
|
36
|
-
{{ scope.opt[`${optionLabel}`] }}
|
|
37
|
-
</q-chip>
|
|
38
|
-
</template>
|
|
39
|
-
<template #no-option>
|
|
40
|
-
<q-item>{{ emptyText }}</q-item>
|
|
41
|
-
</template>
|
|
42
|
-
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
43
|
-
</q-select>
|
|
44
|
-
</template>
|
|
45
|
-
<script setup lang="ts">
|
|
46
|
-
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
47
|
-
|
|
48
|
-
import { QSelect } from 'quasar'
|
|
49
|
-
|
|
50
|
-
type Option = Record<string, any>
|
|
51
|
-
|
|
52
|
-
interface AppQSelectProps {
|
|
53
|
-
modelValue: any
|
|
54
|
-
options: Option[]
|
|
55
|
-
placeholder: string
|
|
56
|
-
emptyText: string
|
|
57
|
-
optionLabel?: string
|
|
58
|
-
optionValue?: string
|
|
59
|
-
label?: string
|
|
60
|
-
multiple?: boolean
|
|
61
|
-
borderColor: string
|
|
62
|
-
isDisabled?: boolean
|
|
63
|
-
clearable?: boolean
|
|
64
|
-
search?: boolean
|
|
65
|
-
dataTest?: string
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const props = defineProps<AppQSelectProps>()
|
|
69
|
-
const select = ref({})
|
|
70
|
-
const emit = defineEmits(['update:modelValue'])
|
|
71
|
-
const selected = computed({
|
|
72
|
-
get() {
|
|
73
|
-
return props.modelValue
|
|
74
|
-
},
|
|
75
|
-
set(value) {
|
|
76
|
-
emit('update:modelValue', value)
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const type = () => {
|
|
81
|
-
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
82
|
-
return typeof selected.value === 'string' && !selected.value
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const lcText: Ref<string> = ref('')
|
|
86
|
-
const filteredOptions = computed(() => {
|
|
87
|
-
return props.options.filter(x => x[props?.optionLabel || 'label'].toLowerCase().includes(lcText.value))
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
91
|
-
update(() => {
|
|
92
|
-
lcText.value = val.toLowerCase()
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
<style module lang="scss">
|
|
97
|
-
.wrap {
|
|
98
|
-
position: relative;
|
|
99
|
-
|
|
100
|
-
&:global(.--option-tree) {
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.select {
|
|
106
|
-
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
107
|
-
border-radius: 14px;
|
|
108
|
-
}
|
|
109
|
-
&:global(.q-field--outlined .q-field__control:before) {
|
|
110
|
-
border-color: v-bind(borderColor);
|
|
111
|
-
}
|
|
112
|
-
&:global(.q-select .q-field__input) {
|
|
113
|
-
padding: 0 6px;
|
|
114
|
-
}
|
|
115
|
-
//&:global(.q-field--filled .q-field__control) {
|
|
116
|
-
// //color: red;
|
|
117
|
-
//}
|
|
118
|
-
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
119
|
-
//}
|
|
120
|
-
//&:global(.q-field--filled .q-field__control:after) {
|
|
121
|
-
// left: 8px;
|
|
122
|
-
// right: 8px;
|
|
123
|
-
//}
|
|
124
|
-
&:global(.q-field--outlined .q-item) {
|
|
125
|
-
color: #1d1d1d;
|
|
126
|
-
position: absolute;
|
|
127
|
-
padding: 0 4px;
|
|
128
|
-
top: 18px;
|
|
129
|
-
left: 0;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.append-wrapper {
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
column-gap: 4px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.menu-wrap {
|
|
140
|
-
padding: 8px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.search-wrapper {
|
|
144
|
-
position: sticky;
|
|
145
|
-
top: 0;
|
|
146
|
-
padding: 4px;
|
|
147
|
-
background: var(--main-bg);
|
|
148
|
-
z-index: 1;
|
|
149
|
-
}
|
|
150
|
-
.app-select__menu {
|
|
151
|
-
border-radius: 14px;
|
|
152
|
-
.q-item__label {
|
|
153
|
-
word-break: break-word;
|
|
154
|
-
}
|
|
155
|
-
&:global(.q-menu) {
|
|
156
|
-
max-height: 200px !important;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-select
|
|
3
|
+
ref="select"
|
|
4
|
+
v-model="selected"
|
|
5
|
+
:data-test="dataTest"
|
|
6
|
+
:options="filteredOptions"
|
|
7
|
+
:option-value="optionValue"
|
|
8
|
+
:option-label="optionLabel"
|
|
9
|
+
emit-value
|
|
10
|
+
map-options
|
|
11
|
+
:disable="isDisabled"
|
|
12
|
+
:multiple="multiple"
|
|
13
|
+
outlined
|
|
14
|
+
stack-label
|
|
15
|
+
:use-input="search"
|
|
16
|
+
:class="[$style.select]"
|
|
17
|
+
:label="label"
|
|
18
|
+
input-debounce="100"
|
|
19
|
+
:popup-content-class="$style['app-select__menu']"
|
|
20
|
+
:clearable="clearable"
|
|
21
|
+
rounded
|
|
22
|
+
autocomplete=""
|
|
23
|
+
@filter="filterFn"
|
|
24
|
+
>
|
|
25
|
+
<template v-if="multiple" #selected-item="scope">
|
|
26
|
+
<q-chip
|
|
27
|
+
v-if="scope.opt"
|
|
28
|
+
removable
|
|
29
|
+
class="q-ma-none"
|
|
30
|
+
dense
|
|
31
|
+
:tabindex="scope.tabindex"
|
|
32
|
+
color="white"
|
|
33
|
+
text-color="secondary"
|
|
34
|
+
@remove="scope.removeAtIndex(scope.index)"
|
|
35
|
+
>
|
|
36
|
+
{{ scope.opt[`${optionLabel}`] }}
|
|
37
|
+
</q-chip>
|
|
38
|
+
</template>
|
|
39
|
+
<template #no-option>
|
|
40
|
+
<q-item>{{ emptyText }}</q-item>
|
|
41
|
+
</template>
|
|
42
|
+
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
43
|
+
</q-select>
|
|
44
|
+
</template>
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
47
|
+
|
|
48
|
+
import { QSelect } from 'quasar'
|
|
49
|
+
|
|
50
|
+
type Option = Record<string, any>
|
|
51
|
+
|
|
52
|
+
interface AppQSelectProps {
|
|
53
|
+
modelValue: any
|
|
54
|
+
options: Option[]
|
|
55
|
+
placeholder: string
|
|
56
|
+
emptyText: string
|
|
57
|
+
optionLabel?: string
|
|
58
|
+
optionValue?: string
|
|
59
|
+
label?: string
|
|
60
|
+
multiple?: boolean
|
|
61
|
+
borderColor: string
|
|
62
|
+
isDisabled?: boolean
|
|
63
|
+
clearable?: boolean
|
|
64
|
+
search?: boolean
|
|
65
|
+
dataTest?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const props = defineProps<AppQSelectProps>()
|
|
69
|
+
const select = ref({})
|
|
70
|
+
const emit = defineEmits(['update:modelValue'])
|
|
71
|
+
const selected = computed({
|
|
72
|
+
get() {
|
|
73
|
+
return props.modelValue
|
|
74
|
+
},
|
|
75
|
+
set(value) {
|
|
76
|
+
emit('update:modelValue', value)
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const type = () => {
|
|
81
|
+
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
82
|
+
return typeof selected.value === 'string' && !selected.value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const lcText: Ref<string> = ref('')
|
|
86
|
+
const filteredOptions = computed(() => {
|
|
87
|
+
return props.options.filter(x => (x[props?.optionLabel || 'label'] || '-').toLowerCase().includes(lcText.value))
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
91
|
+
update(() => {
|
|
92
|
+
lcText.value = val.toLowerCase()
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
<style module lang="scss">
|
|
97
|
+
.wrap {
|
|
98
|
+
position: relative;
|
|
99
|
+
|
|
100
|
+
&:global(.--option-tree) {
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.select {
|
|
106
|
+
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
107
|
+
border-radius: 14px;
|
|
108
|
+
}
|
|
109
|
+
&:global(.q-field--outlined .q-field__control:before) {
|
|
110
|
+
border-color: v-bind(borderColor);
|
|
111
|
+
}
|
|
112
|
+
&:global(.q-select .q-field__input) {
|
|
113
|
+
padding: 0 6px;
|
|
114
|
+
}
|
|
115
|
+
//&:global(.q-field--filled .q-field__control) {
|
|
116
|
+
// //color: red;
|
|
117
|
+
//}
|
|
118
|
+
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
119
|
+
//}
|
|
120
|
+
//&:global(.q-field--filled .q-field__control:after) {
|
|
121
|
+
// left: 8px;
|
|
122
|
+
// right: 8px;
|
|
123
|
+
//}
|
|
124
|
+
&:global(.q-field--outlined .q-item) {
|
|
125
|
+
color: #1d1d1d;
|
|
126
|
+
position: absolute;
|
|
127
|
+
padding: 0 4px;
|
|
128
|
+
top: 18px;
|
|
129
|
+
left: 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.append-wrapper {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
column-gap: 4px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.menu-wrap {
|
|
140
|
+
padding: 8px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.search-wrapper {
|
|
144
|
+
position: sticky;
|
|
145
|
+
top: 0;
|
|
146
|
+
padding: 4px;
|
|
147
|
+
background: var(--main-bg);
|
|
148
|
+
z-index: 1;
|
|
149
|
+
}
|
|
150
|
+
.app-select__menu {
|
|
151
|
+
border-radius: 14px;
|
|
152
|
+
.q-item__label {
|
|
153
|
+
word-break: break-word;
|
|
154
|
+
}
|
|
155
|
+
&:global(.q-menu) {
|
|
156
|
+
max-height: 200px !important;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</style>
|