codevdesign 0.0.9 → 0.0.11
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/composants/csqcChaise/chaiseConteneur.vue +330 -0
- package/composants/csqcChaise/chaiseItem.vue +53 -0
- package/composants/csqcTable/csqcTable.vue +47 -13
- package/composants/csqcTable/csqcTableExportExcel.vue +58 -67
- package/index.ts +2 -0
- package/locales/en.json +48 -4
- package/locales/fr.json +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="pa-2 mt-2 mb-1 mr-1">
|
|
3
|
+
<!--on affiche une div avec les infos de préférences si le user a déjà au moins une préférence, au moins une unité et si activerDiv est à true.-->
|
|
4
|
+
<div v-if="preferences && unites && unites.length > 0 && activerDivPreferences">
|
|
5
|
+
<v-card
|
|
6
|
+
width="375"
|
|
7
|
+
outlined
|
|
8
|
+
>
|
|
9
|
+
<v-card-text
|
|
10
|
+
flat
|
|
11
|
+
class="pt-0 mt-0"
|
|
12
|
+
>
|
|
13
|
+
<v-progress-linear
|
|
14
|
+
v-if="chargementEnCours"
|
|
15
|
+
indeterminate
|
|
16
|
+
/>
|
|
17
|
+
<div
|
|
18
|
+
v-if="!chargementEnCours"
|
|
19
|
+
class="pt-2"
|
|
20
|
+
>
|
|
21
|
+
<div class="text-overline text-h6 mb-2">{{ texteTitre }}</div>
|
|
22
|
+
<!-- <div v-if="existePreference == false">
|
|
23
|
+
Cliquer sur modifier ou lors de la soumission, vous pourrez sélectionner vos préférences de suivi.
|
|
24
|
+
</div>-->
|
|
25
|
+
<div>
|
|
26
|
+
<v-list-item
|
|
27
|
+
v-for="uniteId in Object.keys(dictChaisesReleve).map(Number)"
|
|
28
|
+
:key="uniteId"
|
|
29
|
+
class="mb-1"
|
|
30
|
+
>
|
|
31
|
+
<chaiseItem
|
|
32
|
+
:uniteId="uniteId"
|
|
33
|
+
:preferences="preferences"
|
|
34
|
+
:dictChaisesReleve="dictChaisesReleve"
|
|
35
|
+
:unites="unites"
|
|
36
|
+
/>
|
|
37
|
+
</v-list-item>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</v-card-text>
|
|
41
|
+
<v-card-actions>
|
|
42
|
+
<div class="flex-grow-1"></div>
|
|
43
|
+
<v-btn
|
|
44
|
+
v-if="chargementEnCours == false"
|
|
45
|
+
rounded
|
|
46
|
+
outlined
|
|
47
|
+
small
|
|
48
|
+
@click.stop="modifier"
|
|
49
|
+
>{{ $t('csqc.bouton.modifier') }}</v-btn
|
|
50
|
+
>
|
|
51
|
+
</v-card-actions>
|
|
52
|
+
</v-card>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<v-dialog
|
|
56
|
+
max-width="largeur"
|
|
57
|
+
:fullscreen="display.name.value == 'xs'"
|
|
58
|
+
v-model="visible"
|
|
59
|
+
@click:outside="annuler"
|
|
60
|
+
@keydown.esc="annuler"
|
|
61
|
+
>
|
|
62
|
+
<v-card :class="['pa-0', display.name.value != 'xs' ? 'v-card-color-solid' : 'v-card-color-solid-xs']">
|
|
63
|
+
<v-container :class="display.name.value == 'xs' ? 'pl-1 pr-3' : ''">
|
|
64
|
+
<h3 class="pb-3 pl-2">{{ texteTitre }}</h3>
|
|
65
|
+
<hr class="pl-2" />
|
|
66
|
+
<v-card-text flat>
|
|
67
|
+
<i>{{ info }}</i>
|
|
68
|
+
<v-progress-linear
|
|
69
|
+
v-if="chargementEnCours"
|
|
70
|
+
indeterminate
|
|
71
|
+
/>
|
|
72
|
+
<div
|
|
73
|
+
v-if="!chargementEnCours"
|
|
74
|
+
class="pt-4"
|
|
75
|
+
>
|
|
76
|
+
<v-row v-if="toutesUnitesPreferencesSelectionnees === false">
|
|
77
|
+
<v-col cols="12">
|
|
78
|
+
<v-alert
|
|
79
|
+
dismissible
|
|
80
|
+
v-model="afficherErreur"
|
|
81
|
+
type="error"
|
|
82
|
+
>{{ $t('csqc.message.chaiseSelectionToutes') }}</v-alert
|
|
83
|
+
>
|
|
84
|
+
</v-col>
|
|
85
|
+
</v-row>
|
|
86
|
+
<v-row>
|
|
87
|
+
<v-col
|
|
88
|
+
cols="12"
|
|
89
|
+
sm="4"
|
|
90
|
+
md="3"
|
|
91
|
+
v-for="uniteId in Object.keys(dictChaisesReleve).map(Number)"
|
|
92
|
+
:key="uniteId"
|
|
93
|
+
>
|
|
94
|
+
<label>{{ getUnite(uniteId)?.nom || '' }}</label>
|
|
95
|
+
<br />
|
|
96
|
+
<v-radio-group v-model="selection[uniteId]">
|
|
97
|
+
<v-radio
|
|
98
|
+
v-for="chaise in dictChaisesReleve[uniteId]"
|
|
99
|
+
:key="chaise.id"
|
|
100
|
+
:label="chaise.nom"
|
|
101
|
+
:value="chaise.id"
|
|
102
|
+
></v-radio>
|
|
103
|
+
</v-radio-group>
|
|
104
|
+
</v-col>
|
|
105
|
+
</v-row>
|
|
106
|
+
</div>
|
|
107
|
+
</v-card-text>
|
|
108
|
+
</v-container>
|
|
109
|
+
|
|
110
|
+
<v-card-actions>
|
|
111
|
+
<div class="flex-grow-1"></div>
|
|
112
|
+
<v-btn
|
|
113
|
+
color="primary"
|
|
114
|
+
outlined
|
|
115
|
+
@click.stop="annuler"
|
|
116
|
+
>Annuler</v-btn
|
|
117
|
+
>
|
|
118
|
+
<v-btn
|
|
119
|
+
color="primary"
|
|
120
|
+
@click.stop="ok"
|
|
121
|
+
>Ok</v-btn
|
|
122
|
+
>
|
|
123
|
+
</v-card-actions>
|
|
124
|
+
</v-card>
|
|
125
|
+
</v-dialog>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script lang="ts" setup>
|
|
130
|
+
import { ref, computed, defineProps, defineEmits, onMounted } from 'vue'
|
|
131
|
+
import axios from '@/outils/appAxios.ts'
|
|
132
|
+
import chaiseItem from './chaiseItem.vue'
|
|
133
|
+
import { useDisplay } from 'vuetify'
|
|
134
|
+
const display = useDisplay()
|
|
135
|
+
|
|
136
|
+
// Définition des props
|
|
137
|
+
const props = defineProps<{
|
|
138
|
+
activerDivPreferences: boolean
|
|
139
|
+
typeintervenant: string
|
|
140
|
+
demandeid: string
|
|
141
|
+
formulaireid: string
|
|
142
|
+
urlbase: string
|
|
143
|
+
titre?: string
|
|
144
|
+
texteinfo?: string
|
|
145
|
+
largeur?: number
|
|
146
|
+
}>()
|
|
147
|
+
|
|
148
|
+
// Définition des emits
|
|
149
|
+
const emit = defineEmits<{
|
|
150
|
+
(event: 'annuler'): void
|
|
151
|
+
(event: 'confirmer'): void
|
|
152
|
+
}>()
|
|
153
|
+
|
|
154
|
+
// Variables réactives
|
|
155
|
+
const visible = ref(false)
|
|
156
|
+
const chargementEnCours = ref(false)
|
|
157
|
+
const afficherErreur = ref(false)
|
|
158
|
+
const unites = ref<Array<{ id: number; nom: string }>>([])
|
|
159
|
+
const preferences = ref<Array<{ uniteId: number; chaiseId: number }>>([])
|
|
160
|
+
const dictChaisesReleve = ref<Record<number, Array<{ id: number; nom: string }>>>({})
|
|
161
|
+
const selection = ref<Record<number, number>>({})
|
|
162
|
+
const modeModifier = ref(false)
|
|
163
|
+
|
|
164
|
+
// Méthodes
|
|
165
|
+
const soumettre = async () => {
|
|
166
|
+
modeModifier.value = false
|
|
167
|
+
await ouvrir()
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const ouvrir = async () => {
|
|
171
|
+
// Mode sans les divs
|
|
172
|
+
if (props.activerDivPreferences === false) {
|
|
173
|
+
await chargementPreferences()
|
|
174
|
+
visible.value = true
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Mode avec div, mais il manque une sélection
|
|
179
|
+
if (!toutesUnitesPreferencesSelectionnees.value) {
|
|
180
|
+
visible.value = true
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Tout est beau
|
|
185
|
+
await ok()
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const definitionSelectionDepart = () => {
|
|
189
|
+
for (let uniteId in dictChaisesReleve.value) {
|
|
190
|
+
const chaises = dictChaisesReleve.value[uniteId]
|
|
191
|
+
const uniteIdNum = Number(uniteId) // Convert to number
|
|
192
|
+
|
|
193
|
+
const pref = preferences.value.find(
|
|
194
|
+
pref => pref.uniteId === uniteIdNum && chaises.some(chaise => chaise.id === pref.chaiseId),
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
const chaiseIdDefaut = pref?.chaiseId ?? (chaises.length === 1 ? chaises[0].id : -1)
|
|
198
|
+
selection.value[uniteIdNum] = chaiseIdDefaut // Ensure key consistency
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const estPrefere = (uniteId: number, chaiseId: number) => {
|
|
202
|
+
return preferences.value.some(x => x.uniteId === uniteId && x.chaiseId === chaiseId)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const annuler = () => {
|
|
206
|
+
visible.value = false
|
|
207
|
+
modeModifier.value = false
|
|
208
|
+
emit('annuler')
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const getUnite = (uniteId: number) => {
|
|
212
|
+
return unites.value.find(x => x.id === uniteId)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const modifier = () => {
|
|
216
|
+
modeModifier.value = true
|
|
217
|
+
visible.value = true
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const ok = async () => {
|
|
221
|
+
await sauvegarder()
|
|
222
|
+
if (toutesUnitesPreferencesSelectionnees.value) {
|
|
223
|
+
if (!modeModifier.value) {
|
|
224
|
+
emit('confirmer')
|
|
225
|
+
}
|
|
226
|
+
visible.value = false
|
|
227
|
+
modeModifier.value = false
|
|
228
|
+
} else {
|
|
229
|
+
afficherErreur.value = true
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const sauvegarder = async () => {
|
|
234
|
+
for (let uniteId in dictChaisesReleve.value) {
|
|
235
|
+
const chaiseId = selection.value[uniteId]
|
|
236
|
+
if (chaiseId <= 0) {
|
|
237
|
+
continue
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Cibler l'ancienne préférence reliée à une des chaises de cette unité
|
|
241
|
+
let prefIndexDeUnite = -1
|
|
242
|
+
for (let i = 0; i < dictChaisesReleve.value[uniteId].length; i++) {
|
|
243
|
+
prefIndexDeUnite = preferences.value.findIndex(p => p.chaiseId === dictChaisesReleve.value[uniteId][i].id)
|
|
244
|
+
if (prefIndexDeUnite >= 0) {
|
|
245
|
+
break
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
const response = await axios
|
|
251
|
+
.getAxios()
|
|
252
|
+
.put(
|
|
253
|
+
`${props.urlbase}/api/ComposantUI/Preferences/${props.formulaireid}/Unite/${uniteId}/Chaise/${chaiseId}/TypeIntervenant/${props.typeintervenant}`,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
const itemRecu = response.data // Extract the actual data
|
|
257
|
+
|
|
258
|
+
// Écraser l'ancienne sélection
|
|
259
|
+
if (prefIndexDeUnite >= 0) {
|
|
260
|
+
preferences.value[prefIndexDeUnite] = itemRecu
|
|
261
|
+
} else {
|
|
262
|
+
preferences.value = [itemRecu]
|
|
263
|
+
}
|
|
264
|
+
} catch (e) {
|
|
265
|
+
console.error(e)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const chargementPreferences = async () => {
|
|
271
|
+
chargementEnCours.value = true
|
|
272
|
+
// Ramasse les infos des chaises par unité
|
|
273
|
+
dictChaisesReleve.value = await axios
|
|
274
|
+
.getAxios()
|
|
275
|
+
.get(`${props.urlbase}/api/ComposantUI/ReleveDe/${props.typeintervenant}/Demande/${props.demandeid}`)
|
|
276
|
+
|
|
277
|
+
// Ramasse les préférences de l'usager
|
|
278
|
+
preferences.value = await axios
|
|
279
|
+
.getAxios()
|
|
280
|
+
.get(
|
|
281
|
+
`${props.urlbase}/api/ComposantUI/Preferences/${props.formulaireid}/TypeIntervenant/${props.typeintervenant}`,
|
|
282
|
+
)
|
|
283
|
+
definitionSelectionDepart()
|
|
284
|
+
|
|
285
|
+
await sauvegarder() // Immédiatement on sauvegarde pour les choix uniques.
|
|
286
|
+
|
|
287
|
+
chargementEnCours.value = false
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const texteTitre = computed(() => {
|
|
291
|
+
return props.titre || ''
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
const info = computed(() => {
|
|
295
|
+
return props.texteinfo || ''
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
const existePreference = computed(() => {
|
|
299
|
+
for (let uniteId in dictChaisesReleve.value) {
|
|
300
|
+
for (let i = 0; i < dictChaisesReleve.value[uniteId].length; i++) {
|
|
301
|
+
if (preferences.value.some(p => p.chaiseId === dictChaisesReleve.value[uniteId][i].id)) {
|
|
302
|
+
return true
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return false
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
const toutesUnitesPreferencesSelectionnees = computed(() => {
|
|
310
|
+
for (let uniteId in dictChaisesReleve.value) {
|
|
311
|
+
let uniteOk = false
|
|
312
|
+
for (let i = 0; i < dictChaisesReleve.value[uniteId].length; i++) {
|
|
313
|
+
if (preferences.value.some(p => p.chaiseId === dictChaisesReleve.value[uniteId][i].id)) {
|
|
314
|
+
uniteOk = true
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (!uniteOk) return false
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return true // Toutes les unités ont été sélectionnées
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
onMounted(async () => {
|
|
325
|
+
chargementEnCours.value = true
|
|
326
|
+
// Ramasse les unités de l'usager
|
|
327
|
+
unites.value = await axios.getAxios().get(`${props.urlbase}/api/ComposantUI/Unites`)
|
|
328
|
+
chargementPreferences()
|
|
329
|
+
})
|
|
330
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-list-item-content>
|
|
4
|
+
<v-list-item-title>{{ nomUnite }}</v-list-item-title>
|
|
5
|
+
<v-list-item-subtitle v-if="getPreference != ''">
|
|
6
|
+
{{ getPreference }}
|
|
7
|
+
</v-list-item-subtitle>
|
|
8
|
+
<v-list-item-subtitle
|
|
9
|
+
v-if="getPreference == ''"
|
|
10
|
+
class="messageErreurChaiseItem"
|
|
11
|
+
>
|
|
12
|
+
{{ $t('csqc.message.chaiseSelection') }}
|
|
13
|
+
</v-list-item-subtitle>
|
|
14
|
+
</v-list-item-content>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { computed } from 'vue'
|
|
19
|
+
|
|
20
|
+
// Définition des props
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
uniteId: number
|
|
23
|
+
preferences: Array<{ chaiseId: number }>
|
|
24
|
+
dictChaisesReleve: Record<number, Array<{ id: number; nom: string }>>
|
|
25
|
+
unites: Array<{ id: number; nom: string }>
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
const nomUnite = computed(() => {
|
|
29
|
+
if (!props.uniteId || !props.unites?.length) {
|
|
30
|
+
return ''
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const unite = props.unites.find(u => u.id == props.uniteId)
|
|
34
|
+
return unite?.nom || ''
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const getPreference = computed(() => {
|
|
38
|
+
for (let i = 0; i < props.dictChaisesReleve[props.uniteId]?.length; i += 1) {
|
|
39
|
+
if (props.preferences.some(p => p.chaiseId == props.dictChaisesReleve[props.uniteId][i].id)) {
|
|
40
|
+
return props.dictChaisesReleve[props.uniteId][i].nom
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return ''
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.messageErreurChaiseItem {
|
|
50
|
+
color: red !important;
|
|
51
|
+
font-style: italic;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -41,11 +41,19 @@
|
|
|
41
41
|
<v-btn
|
|
42
42
|
v-if="btnAjouter"
|
|
43
43
|
color="primary"
|
|
44
|
-
class="float-right"
|
|
44
|
+
class="ml-1 float-right"
|
|
45
45
|
@click.stop="ajouter"
|
|
46
46
|
>
|
|
47
47
|
{{ props.btnAjouterTexte ? props.btnAjouterTexte : $t('csqc.bouton.ajouter') }}
|
|
48
48
|
</v-btn>
|
|
49
|
+
|
|
50
|
+
<exportExcelComponent
|
|
51
|
+
v-if="excel"
|
|
52
|
+
:liste="filteredItems"
|
|
53
|
+
:chargement-liste="chargementListe"
|
|
54
|
+
:nom-fichier="excelNomFichier"
|
|
55
|
+
class="mt-1 ml-1 float-right"
|
|
56
|
+
/>
|
|
49
57
|
</v-col>
|
|
50
58
|
</v-row>
|
|
51
59
|
|
|
@@ -61,10 +69,11 @@
|
|
|
61
69
|
class="d-flex ControlesDatatable flex-wrap"
|
|
62
70
|
>
|
|
63
71
|
<v-data-table
|
|
72
|
+
ref="datatable"
|
|
64
73
|
color="green"
|
|
65
|
-
:headers="colonnes
|
|
74
|
+
:headers="colonnes"
|
|
66
75
|
:item-key="itemKey"
|
|
67
|
-
:items="liste
|
|
76
|
+
:items="liste"
|
|
68
77
|
:search="recherche"
|
|
69
78
|
:loading="chargementListe"
|
|
70
79
|
@click:row="cliqueLigne"
|
|
@@ -124,14 +133,23 @@
|
|
|
124
133
|
</template>
|
|
125
134
|
|
|
126
135
|
<script setup lang="ts">
|
|
127
|
-
|
|
136
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
137
|
+
|
|
138
|
+
import { ref, computed, defineProps, type Slots, type PropType } from 'vue'
|
|
128
139
|
import Recherche from '../csqcRecherche.vue'
|
|
129
140
|
import confirmation from '../csqcConfirmation.vue'
|
|
130
|
-
|
|
141
|
+
import exportExcelComponent from './csqcTableExportExcel.vue'
|
|
131
142
|
//import ModaleChoix from './csqc-table-modale-choix-colonnes.vue';
|
|
132
143
|
//import axios from 'axios'
|
|
133
144
|
import { useI18n } from 'vue-i18n'
|
|
134
145
|
|
|
146
|
+
interface Colonne {
|
|
147
|
+
title: string
|
|
148
|
+
key: string // Correspond à la clé des objets dans `liste`
|
|
149
|
+
align?: 'start' | 'center' | 'end'
|
|
150
|
+
sortable?: boolean
|
|
151
|
+
}
|
|
152
|
+
|
|
135
153
|
// Props
|
|
136
154
|
const props = defineProps({
|
|
137
155
|
btnAjouter: { type: Boolean, default: true },
|
|
@@ -142,16 +160,22 @@
|
|
|
142
160
|
operationEnCours: { type: Boolean, default: false },
|
|
143
161
|
//choixSwitchOptionDepart: { type: Boolean, default: false },
|
|
144
162
|
// classeRangee: { type: String, default: '' },
|
|
145
|
-
colonnes: {
|
|
146
|
-
|
|
147
|
-
|
|
163
|
+
colonnes: {
|
|
164
|
+
type: Array as PropType<Colonne[]>,
|
|
165
|
+
default: () => [],
|
|
166
|
+
},
|
|
167
|
+
excel: { type: Boolean, default: false },
|
|
168
|
+
excelNomFichier: { type: String, default: 'csqc' },
|
|
148
169
|
//filtresDepart: { type: Object, default: null },
|
|
149
170
|
//flechesTri: { type: Boolean, default: false },
|
|
150
171
|
// formulaireId: { type: Number, default: -1 },
|
|
151
172
|
//identifiant: { type: String, default: '' },
|
|
152
173
|
itemKey: { type: String, default: 'id' },
|
|
153
174
|
// itemsParPage: { type: Number, default: 10 },
|
|
154
|
-
liste: {
|
|
175
|
+
liste: {
|
|
176
|
+
type: Array as PropType<Record<string, any>[]>,
|
|
177
|
+
default: () => [],
|
|
178
|
+
},
|
|
155
179
|
// modulerDense: { type: Boolean, default: false },
|
|
156
180
|
// multifiltre: { type: Boolean, default: false },
|
|
157
181
|
// multiTri: { type: Boolean, default: false },
|
|
@@ -190,7 +214,6 @@
|
|
|
190
214
|
const supprimerTitreTexte = computed(() => props.modaleSupprimerTitre || t('csqc.message.supprimerTitre'))
|
|
191
215
|
|
|
192
216
|
// Fonction pour ouvrir le dialogue pour un item spécifique
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
217
|
const ouvrirModaleSupprimer = (item: any) => {
|
|
195
218
|
itemSelectionne.value = item
|
|
196
219
|
|
|
@@ -206,19 +229,25 @@
|
|
|
206
229
|
const chargerRecherche = (val: string) => {
|
|
207
230
|
recherche.value = val
|
|
208
231
|
}
|
|
232
|
+
|
|
209
233
|
const ajouter = () => {
|
|
210
234
|
emit('ajouter')
|
|
211
235
|
}
|
|
212
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
213
236
|
const cliqueLigne = (e: Event, { item }: { item: any }) => {
|
|
214
237
|
emit('cliqueLigne', item)
|
|
215
238
|
}
|
|
216
|
-
|
|
239
|
+
|
|
217
240
|
const modifier = (item: any) => {
|
|
218
241
|
emit('modifier', item)
|
|
219
242
|
}
|
|
243
|
+
const filteredItems = computed(() => {
|
|
244
|
+
if (!recherche.value) return props.liste // Si rien écrit, affiche tout
|
|
220
245
|
|
|
221
|
-
|
|
246
|
+
return props.liste.filter(item =>
|
|
247
|
+
Object.values(item).some(val => String(val).toLowerCase().includes(recherche.value.toLowerCase())),
|
|
248
|
+
)
|
|
249
|
+
})
|
|
250
|
+
const emit = defineEmits(['ajouter', 'cliqueLigne', 'supprimer', 'modifier', 'donneesExportees'])
|
|
222
251
|
</script>
|
|
223
252
|
|
|
224
253
|
<style scoped lang="css">
|
|
@@ -311,4 +340,9 @@
|
|
|
311
340
|
.iconeEditer:hover {
|
|
312
341
|
color: #095797;
|
|
313
342
|
}
|
|
343
|
+
|
|
344
|
+
/* hover icone à droite du ajouter*/
|
|
345
|
+
.text-grisMoyen:hover {
|
|
346
|
+
color: #095797 !important;
|
|
347
|
+
}
|
|
314
348
|
</style>
|
|
@@ -1,67 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-icon
|
|
3
|
-
right
|
|
4
|
-
color="
|
|
5
|
-
@click="
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</v-icon>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return itemsExportes;
|
|
61
|
-
// this.$emit('apres');
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
created() {
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<v-icon
|
|
3
|
+
right
|
|
4
|
+
color="grisMoyen"
|
|
5
|
+
@click="exportToXLSX"
|
|
6
|
+
icon="mdi-microsoft-excel"
|
|
7
|
+
>
|
|
8
|
+
</v-icon>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { utils, writeFileXLSX } from 'xlsx'
|
|
13
|
+
import { defineProps, computed } from 'vue'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
liste: any[]
|
|
18
|
+
nomFichier: string
|
|
19
|
+
chargementListe: boolean
|
|
20
|
+
}>()
|
|
21
|
+
|
|
22
|
+
// Extraction des clés uniques de tous les objets
|
|
23
|
+
const cleDynamique = computed(() => {
|
|
24
|
+
const keys = new Set<string>()
|
|
25
|
+
|
|
26
|
+
// Parcours tous les objets de la liste et ajoute leurs clés
|
|
27
|
+
props.liste.forEach(item => {
|
|
28
|
+
if (typeof item === 'object' && item !== null) {
|
|
29
|
+
Object.keys(item).forEach(key => keys.add(key))
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
return Array.from(keys)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Fonction pour exporter les données en Excel
|
|
36
|
+
const exportToXLSX = () => {
|
|
37
|
+
if (!props.liste.length) {
|
|
38
|
+
console.warn('La liste est vide, exportation annulée.')
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Récupération des en-têtes depuis la fonction cleDynamique
|
|
43
|
+
const headers = cleDynamique.value
|
|
44
|
+
|
|
45
|
+
// Construction des lignes en respectant l'ordre des en-têtes
|
|
46
|
+
const rows = props.liste.map(item => {
|
|
47
|
+
return headers.map(key => (key in item ? item[key] : '')) // Valeur ou vide si absente
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Création des données Excel (en-têtes + lignes)
|
|
51
|
+
const data = [headers, ...rows]
|
|
52
|
+
// Génération du fichier Excel
|
|
53
|
+
const ws = utils.aoa_to_sheet(data)
|
|
54
|
+
const wb = utils.book_new()
|
|
55
|
+
utils.book_append_sheet(wb, ws, '1')
|
|
56
|
+
writeFileXLSX(wb, `${props.nomFichier}.xlsx`)
|
|
57
|
+
}
|
|
58
|
+
</script>
|
package/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import pivFooter from './composants/gabarit/pivPiedPage.vue'
|
|
|
9
9
|
import csqcMenu from './composants/gabarit/csqcMenu.vue'
|
|
10
10
|
import csqcConfirmation from './composants/csqcConfirmation.vue'
|
|
11
11
|
import csqcTable from './composants/csqcTable/csqcTable.vue'
|
|
12
|
+
import csqcChaise from './composants/csqcChaise/chaiseConteneur.vue'
|
|
12
13
|
|
|
13
14
|
import modeleUtilisateur from './modeles/utilisateur'
|
|
14
15
|
import modeleUnite from './modeles/unite'
|
|
@@ -29,6 +30,7 @@ export {
|
|
|
29
30
|
csqcTable,
|
|
30
31
|
csqcTiroir,
|
|
31
32
|
csqcMenu,
|
|
33
|
+
csqcChaise,
|
|
32
34
|
pivFooter,
|
|
33
35
|
pivEntete,
|
|
34
36
|
modeleUtilisateur,
|
package/locales/en.json
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
+
"csqc": {
|
|
3
|
+
"bouton": {
|
|
4
|
+
"activer": "Activate",
|
|
5
|
+
"ajouter": "Add",
|
|
6
|
+
"annuler": "Cancel",
|
|
7
|
+
"anonymiser": "Anonymize",
|
|
8
|
+
"completer": "Complete",
|
|
9
|
+
"continuer": "Continue",
|
|
10
|
+
"desactiver": "Deactivate",
|
|
11
|
+
"envoyer": "Send",
|
|
12
|
+
"exporter": "Export",
|
|
13
|
+
"fermer": "Close",
|
|
14
|
+
"generer": "Generate",
|
|
15
|
+
"importer": "Import",
|
|
16
|
+
"modifier": "Edit",
|
|
17
|
+
"non": "No",
|
|
18
|
+
"ok": "Ok",
|
|
19
|
+
"oui": "Yes",
|
|
20
|
+
"ouvrir": "Open",
|
|
21
|
+
"recharger": "Reload",
|
|
22
|
+
"reinitialiser": "Reset",
|
|
23
|
+
"restaurer": "Restore",
|
|
24
|
+
"sauvegarder": "Save",
|
|
25
|
+
"supprimer": "Delete",
|
|
26
|
+
"televerser": "Upload"
|
|
27
|
+
},
|
|
28
|
+
"label": {
|
|
29
|
+
"actif": "Active",
|
|
30
|
+
"fermer": "Close",
|
|
31
|
+
"nom": "Name",
|
|
32
|
+
"recherche": "Search",
|
|
33
|
+
"rechercheAvanceeDefaut": "Advanced search",
|
|
34
|
+
"rechercher": "Search"
|
|
35
|
+
},
|
|
36
|
+
"message": {
|
|
37
|
+
"supprimerMessage": "Are you sure you want to delete {nom}?",
|
|
38
|
+
"supprimerTitre": "Delete confirmation!",
|
|
39
|
+
"chaiseSelection": "No selection for this unit",
|
|
40
|
+
"chaiseSelectionToutes": "Please make a selection for all units."
|
|
41
|
+
},
|
|
2
42
|
"pivEntete": {
|
|
3
|
-
|
|
4
|
-
"nom_application": "Codev Design"
|
|
43
|
+
"langue": "Français"
|
|
5
44
|
},
|
|
6
45
|
"pivFooter": {
|
|
7
|
-
|
|
46
|
+
"logoAlt": ""
|
|
47
|
+
},
|
|
48
|
+
"placeholder": {
|
|
49
|
+
"date": "Choose a date",
|
|
50
|
+
"selectionner": "Select"
|
|
8
51
|
}
|
|
9
|
-
}
|
|
52
|
+
}
|
|
53
|
+
}
|
package/locales/fr.json
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"message": {
|
|
37
37
|
"supprimerMessage": "Voulez-vous vraiment supprimer {nom}?",
|
|
38
|
-
"supprimerTitre": "Confirmation de suppression!"
|
|
38
|
+
"supprimerTitre": "Confirmation de suppression!",
|
|
39
|
+
"chaiseSelection": "Aucune sélection pour cette unité",
|
|
40
|
+
"chaiseSelectionToutes": "Veuillez faire une sélection pour toutes les unités."
|
|
39
41
|
},
|
|
40
42
|
"pivEntete": {
|
|
41
43
|
"langue": "English"
|