codevdesign 0.0.48 → 0.0.49
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/README.md +117 -117
- package/composants/csqcAide.vue +2 -2
- package/composants/csqcAlerteErreur.vue +86 -86
- package/composants/csqcChaise/chaiseItem.vue +53 -53
- package/composants/csqcConfirmation.vue +74 -74
- package/composants/csqcDialogue.vue +3 -4
- package/composants/csqcEntete.vue +127 -127
- package/composants/csqcOptionSwitch.vue +124 -124
- package/composants/csqcRecherche.vue +5 -2
- package/composants/csqcSnackbar.vue +1 -2
- package/composants/csqcTable/csqcTable.vue +389 -389
- package/composants/csqcTable/csqcTableExportExcel.vue +58 -58
- package/composants/csqcTexteBilingue.vue +13 -13
- package/composants/csqcTiroir.vue +1 -2
- package/composants/gabarit/csqcMenu.vue +7 -5
- package/composants/gabarit/pivEntete.vue +9 -6
- package/composants/gabarit/pivPiedPage.vue +70 -70
- package/composants/validateurs.ts +183 -181
- package/index.ts +68 -68
- package/modeles/apiReponse.ts +12 -12
- package/modeles/composants/datatableColonne.ts +14 -14
- package/modeles/composants/snackbar.ts +18 -18
- package/modeles/data.ts +24 -24
- package/modeles/droitIntervention.ts +14 -14
- package/modeles/groupeCE.ts +23 -23
- package/modeles/groupeCEIntervalle.ts +24 -24
- package/modeles/intervention.ts +35 -35
- package/modeles/notificationGabaritDefaut.ts +10 -10
- package/modeles/response.ts +12 -12
- package/modeles/role.ts +31 -31
- package/modeles/roleMin.ts +12 -12
- package/modeles/unite.ts +41 -41
- package/modeles/utilisateur.ts +32 -32
- package/package.json +1 -1
|
@@ -1,389 +1,389 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-row>
|
|
4
|
-
<slot name="ligne" />
|
|
5
|
-
<!-- Affichage de la boite de recherche-->
|
|
6
|
-
<v-col
|
|
7
|
-
cols="12"
|
|
8
|
-
sm="7"
|
|
9
|
-
md="6"
|
|
10
|
-
lg="5"
|
|
11
|
-
xl="4"
|
|
12
|
-
>
|
|
13
|
-
<slot name="recherche"></slot>
|
|
14
|
-
<Recherche
|
|
15
|
-
v-if="rechercheAfficher"
|
|
16
|
-
:rechercheTexte="rechercheTexte"
|
|
17
|
-
:chargement="chargementListe"
|
|
18
|
-
:recherche="recherche"
|
|
19
|
-
@update:recherche="chargerRecherche"
|
|
20
|
-
class="flex-grow-1"
|
|
21
|
-
>
|
|
22
|
-
</Recherche>
|
|
23
|
-
</v-col>
|
|
24
|
-
|
|
25
|
-
<!-- Entre recherche et ajouté-->
|
|
26
|
-
<v-col
|
|
27
|
-
cols="12"
|
|
28
|
-
sm="auto"
|
|
29
|
-
class="pt-1 mt-0 pb-0 mb-0"
|
|
30
|
-
>
|
|
31
|
-
<slot name="milieu" />
|
|
32
|
-
</v-col>
|
|
33
|
-
|
|
34
|
-
<!-- Affichage des boutons et icônes-->
|
|
35
|
-
<v-col
|
|
36
|
-
cols="12"
|
|
37
|
-
sm="auto"
|
|
38
|
-
class="flex-grow-1 d-flex justify-end"
|
|
39
|
-
>
|
|
40
|
-
<slot name="droite" />
|
|
41
|
-
|
|
42
|
-
<v-btn
|
|
43
|
-
v-if="btnAjouter"
|
|
44
|
-
color="primary"
|
|
45
|
-
class="ml-1 float-right"
|
|
46
|
-
@click.stop="ajouter"
|
|
47
|
-
>
|
|
48
|
-
{{ props.btnAjouterTexte ? props.btnAjouterTexte : $t('csqc.bouton.ajouter') }}
|
|
49
|
-
</v-btn>
|
|
50
|
-
|
|
51
|
-
<exportExcelComponent
|
|
52
|
-
v-if="excel"
|
|
53
|
-
:liste="filteredItems"
|
|
54
|
-
:chargement-liste="chargementListe"
|
|
55
|
-
:nom-fichier="excelNomFichier"
|
|
56
|
-
class="mt-1 ml-1 float-right"
|
|
57
|
-
/>
|
|
58
|
-
</v-col>
|
|
59
|
-
</v-row>
|
|
60
|
-
|
|
61
|
-
<!-- ligne pour la recherche avancee -->
|
|
62
|
-
<v-row
|
|
63
|
-
v-if="rechercheAvancee && rechercheAfficher"
|
|
64
|
-
dense
|
|
65
|
-
class="pt-0 mt-0 pl-1"
|
|
66
|
-
>
|
|
67
|
-
<v-expansion-panels
|
|
68
|
-
class="pa-0"
|
|
69
|
-
static
|
|
70
|
-
:readonly="chargementListe"
|
|
71
|
-
expand-icon=""
|
|
72
|
-
@update:modelValue="onPanelChange"
|
|
73
|
-
>
|
|
74
|
-
<v-expansion-panel
|
|
75
|
-
flat
|
|
76
|
-
elevation="0"
|
|
77
|
-
>
|
|
78
|
-
<v-expansion-panel-title
|
|
79
|
-
style="color: #095797"
|
|
80
|
-
class="pl-0 ml-0"
|
|
81
|
-
><slot name="rechercheAvanceeTitre">
|
|
82
|
-
<span
|
|
83
|
-
style="text-decoration: underline"
|
|
84
|
-
v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
|
|
85
|
-
></span
|
|
86
|
-
><slot name="rechercheAvanceeApresTitre"></slot
|
|
87
|
-
></slot>
|
|
88
|
-
</v-expansion-panel-title>
|
|
89
|
-
<v-expansion-panel-text>
|
|
90
|
-
<slot name="rechercheAvancee"></slot>
|
|
91
|
-
</v-expansion-panel-text>
|
|
92
|
-
</v-expansion-panel>
|
|
93
|
-
</v-expansion-panels>
|
|
94
|
-
</v-row>
|
|
95
|
-
|
|
96
|
-
<!-- datatable-->
|
|
97
|
-
<v-row>
|
|
98
|
-
<v-col
|
|
99
|
-
cols="12"
|
|
100
|
-
class="d-flex ControlesDatatable flex-wrap"
|
|
101
|
-
>
|
|
102
|
-
<v-data-table
|
|
103
|
-
ref="datatable"
|
|
104
|
-
color="green"
|
|
105
|
-
:headers="colonnes"
|
|
106
|
-
:item-key="itemKey"
|
|
107
|
-
:items="liste"
|
|
108
|
-
:search="recherche"
|
|
109
|
-
:loading="chargementListe"
|
|
110
|
-
:hover="hover"
|
|
111
|
-
:density="densite"
|
|
112
|
-
:items-per-page="itemsParPage"
|
|
113
|
-
:item-per-page-options="itemsParPageOptions"
|
|
114
|
-
@click:row="cliqueLigne"
|
|
115
|
-
>
|
|
116
|
-
<!-- utilisation des slots via le component parent-->
|
|
117
|
-
<!-- eslint-disable-next-line -->
|
|
118
|
-
<template
|
|
119
|
-
v-for="(_, slot) of $slots"
|
|
120
|
-
:key="slot"
|
|
121
|
-
#[slot]="scope"
|
|
122
|
-
>
|
|
123
|
-
<slot
|
|
124
|
-
:name="slot"
|
|
125
|
-
v-bind="scope"
|
|
126
|
-
/>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<!-- boutons supprimer et modifier -->
|
|
130
|
-
<!-- eslint-disable-next-line -->
|
|
131
|
-
<template v-slot:item.action="{ item }">
|
|
132
|
-
<slot
|
|
133
|
-
name="actionsCustom"
|
|
134
|
-
v-bind:item="item"
|
|
135
|
-
></slot>
|
|
136
|
-
<v-icon
|
|
137
|
-
v-if="props.btnSupprimer"
|
|
138
|
-
size="large"
|
|
139
|
-
@click.stop.prevent="ouvrirModaleSupprimer(item)"
|
|
140
|
-
class="iconeSupprimer float-right"
|
|
141
|
-
>
|
|
142
|
-
mdi-delete
|
|
143
|
-
</v-icon>
|
|
144
|
-
|
|
145
|
-
<v-icon
|
|
146
|
-
v-if="props.btnModifier"
|
|
147
|
-
size="large"
|
|
148
|
-
class="iconeEditer float-right"
|
|
149
|
-
@click.stop.prevent="modifier(item)"
|
|
150
|
-
>
|
|
151
|
-
mdi-pencil
|
|
152
|
-
</v-icon>
|
|
153
|
-
</template>
|
|
154
|
-
</v-data-table>
|
|
155
|
-
|
|
156
|
-
<!-- Fenêtre de suppression -->
|
|
157
|
-
<confirmation
|
|
158
|
-
v-if="props.btnSupprimer"
|
|
159
|
-
ref="modaleSupprimer"
|
|
160
|
-
@confirmer="supprimer"
|
|
161
|
-
:texte="supprimerTexte"
|
|
162
|
-
:titre="supprimerTitreTexte"
|
|
163
|
-
:largeur="modaleSupprimerLargeur"
|
|
164
|
-
/>
|
|
165
|
-
</v-col>
|
|
166
|
-
</v-row>
|
|
167
|
-
</div>
|
|
168
|
-
</template>
|
|
169
|
-
|
|
170
|
-
<script setup lang="ts">
|
|
171
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
172
|
-
|
|
173
|
-
import { ref, computed, type Slots, type PropType } from 'vue'
|
|
174
|
-
import Recherche from '../csqcRecherche.vue'
|
|
175
|
-
import confirmation from '../csqcConfirmation.vue'
|
|
176
|
-
import exportExcelComponent from './csqcTableExportExcel.vue'
|
|
177
|
-
//import ModaleChoix from './csqc-table-modale-choix-colonnes.vue';
|
|
178
|
-
//import axios from 'axios'
|
|
179
|
-
import { useI18n } from 'vue-i18n'
|
|
180
|
-
import Colonne from '../../modeles/composants/datatableColonne'
|
|
181
|
-
|
|
182
|
-
// Props
|
|
183
|
-
const props = defineProps({
|
|
184
|
-
btnAjouter: { type: Boolean, default: true },
|
|
185
|
-
btnAjouterTexte: { type: String, default: '' },
|
|
186
|
-
btnModifier: { type: Boolean, default: true },
|
|
187
|
-
btnSupprimer: { type: Boolean, default: true },
|
|
188
|
-
chargementListe: { type: Boolean, default: false },
|
|
189
|
-
operationEnCours: { type: Boolean, default: false },
|
|
190
|
-
//choixSwitchOptionDepart: { type: Boolean, default: false },
|
|
191
|
-
// classeRangee: { type: String, default: '' },
|
|
192
|
-
colonnes: {
|
|
193
|
-
type: Array as PropType<Colonne[]>,
|
|
194
|
-
default: () => [],
|
|
195
|
-
},
|
|
196
|
-
densite: { type: String as PropType<'default' | 'comfortable' | 'compact'>, default: 'default' },
|
|
197
|
-
excel: { type: Boolean, default: false },
|
|
198
|
-
excelNomFichier: { type: String, default: 'csqc' },
|
|
199
|
-
//filtresDepart: { type: Object, default: null },
|
|
200
|
-
//flechesTri: { type: Boolean, default: false },
|
|
201
|
-
// formulaireId: { type: Number, default: -1 },
|
|
202
|
-
//identifiant: { type: String, default: '' },
|
|
203
|
-
itemKey: { type: String, default: 'id' },
|
|
204
|
-
itemsParPage: { type: Number, default: 10 },
|
|
205
|
-
liste: {
|
|
206
|
-
type: Array as PropType<Record<string, any>[]>,
|
|
207
|
-
default: () => [],
|
|
208
|
-
},
|
|
209
|
-
hover: { type: Boolean, default: false },
|
|
210
|
-
// modulerDense: { type: Boolean, default: false },
|
|
211
|
-
// multifiltre: { type: Boolean, default: false },
|
|
212
|
-
// multiTri: { type: Boolean, default: false },
|
|
213
|
-
itemsParPageOptions: { type: Array, default: () => [10, 25, 30, -1] },
|
|
214
|
-
//pageCourante: { type: Number, default: 1 },
|
|
215
|
-
//paginationBottom: { type: Boolean, default: true },
|
|
216
|
-
// paginationTop: { type: Boolean, default: false },
|
|
217
|
-
// permettreChoixColonnes: { type: Boolean, default: false },
|
|
218
|
-
// rechercheDepart: { type: String, default: '' },
|
|
219
|
-
rechercheTexte: { type: String, default: '' },
|
|
220
|
-
rechercheAfficher: { type: Boolean, default: true },
|
|
221
|
-
rechercheAvancee: { type: Boolean, default: false },
|
|
222
|
-
rechercheAvanceeTexte: { type: String, default: '' },
|
|
223
|
-
// selectionChoixColonnesDepart: { type: String, default: '' },
|
|
224
|
-
// showSelect: { type: Boolean, default: false },
|
|
225
|
-
|
|
226
|
-
modaleSupprimerChamp: { type: String, default: '' },
|
|
227
|
-
modaleSupprimerTexte: { type: String, default: '' },
|
|
228
|
-
modaleSupprimerTitre: { type: String, default: '' },
|
|
229
|
-
modaleSupprimerLargeur: { type: String, default: '525px' },
|
|
230
|
-
//triParDepart: { type: Array, default: () => undefined },
|
|
231
|
-
//urlbase: { type: String, default: '' },
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
235
|
-
const slots = defineSlots<Slots>()
|
|
236
|
-
const { t } = useI18n({ useScope: 'global' })
|
|
237
|
-
const itemSelectionne = ref(null)
|
|
238
|
-
const modaleSupprimer = ref<InstanceType<typeof confirmation> | null>(null)
|
|
239
|
-
const supprimerTexte = computed(() => {
|
|
240
|
-
if (itemSelectionne.value == null) return ''
|
|
241
|
-
|
|
242
|
-
if (props.modaleSupprimerTexte != null && props.modaleSupprimerTexte != '') return props.modaleSupprimerTexte
|
|
243
|
-
|
|
244
|
-
return t('csqc.message.supprimerMessage', { nom: itemSelectionne?.value[props.modaleSupprimerChamp] ?? '' })
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
const supprimerTitreTexte = computed(() => props.modaleSupprimerTitre || t('csqc.message.supprimerTitre'))
|
|
248
|
-
|
|
249
|
-
// Fonction pour ouvrir le dialogue pour un item spécifique
|
|
250
|
-
const ouvrirModaleSupprimer = (item: any) => {
|
|
251
|
-
itemSelectionne.value = item
|
|
252
|
-
|
|
253
|
-
//modaleSupprimer.value?.ouvrir()
|
|
254
|
-
emit('supprimer', itemSelectionne.value)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const supprimer = () => {
|
|
258
|
-
emit('supprimer', itemSelectionne.value)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const recherche = ref<string>('')
|
|
262
|
-
const chargerRecherche = (val: string) => {
|
|
263
|
-
recherche.value = val
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const ajouter = () => {
|
|
267
|
-
emit('ajouter')
|
|
268
|
-
}
|
|
269
|
-
const cliqueLigne = (
|
|
270
|
-
emit('cliqueLigne', item)
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const modifier = (item: any) => {
|
|
274
|
-
emit('modifier', item)
|
|
275
|
-
}
|
|
276
|
-
const filteredItems = computed(() => {
|
|
277
|
-
if (!recherche.value) return props.liste // Si rien écrit, affiche tout
|
|
278
|
-
|
|
279
|
-
return props.liste.filter(item =>
|
|
280
|
-
Object.values(item).some(val => String(val).toLowerCase().includes(recherche.value.toLowerCase())),
|
|
281
|
-
)
|
|
282
|
-
})
|
|
283
|
-
const onPanelChange = (val: unknown) => {
|
|
284
|
-
if (typeof val === 'string' || typeof val === 'number' || val === null) {
|
|
285
|
-
const isOpen = val !== null && val !== ''
|
|
286
|
-
emit('panneau:etat', isOpen)
|
|
287
|
-
} else {
|
|
288
|
-
emit('panneau:etat', false)
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
const emit = defineEmits(['ajouter', 'cliqueLigne', 'supprimer', 'modifier', 'donneesExportees', 'panneau:etat'])
|
|
292
|
-
</script>
|
|
293
|
-
|
|
294
|
-
<style scoped lang="css">
|
|
295
|
-
.ControlesDatatable {
|
|
296
|
-
gap: 4px;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* barre de recherche design QC*/
|
|
300
|
-
.BarreRecherche {
|
|
301
|
-
min-height: 40px;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.BarreRechercheBackIcone {
|
|
305
|
-
border-right: 1px solid #808a9d;
|
|
306
|
-
border-top: 1px solid #808a9d;
|
|
307
|
-
border-bottom: 1px solid #808a9d;
|
|
308
|
-
background-color: #095797 !important;
|
|
309
|
-
height: 40px !important;
|
|
310
|
-
width: 40px !important;
|
|
311
|
-
max-width: 40px !important;
|
|
312
|
-
min-width: 40px !important;
|
|
313
|
-
padding-right: 0 !important;
|
|
314
|
-
padding-left: 0 !important;
|
|
315
|
-
border-radius: 0;
|
|
316
|
-
margin-left: -16px;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/* icone loupe */
|
|
320
|
-
.BarreRechercheIcone {
|
|
321
|
-
font-size: 34px !important;
|
|
322
|
-
margin-left: 1px !important;
|
|
323
|
-
margin-top: 2px !important;
|
|
324
|
-
color: white !important;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/* datatable contour */
|
|
328
|
-
.v-data-table {
|
|
329
|
-
border: 1px solid #d3d3d3;
|
|
330
|
-
border-radius: 5px;
|
|
331
|
-
overflow: hidden;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/* hover */
|
|
335
|
-
.v-data-table:hover {
|
|
336
|
-
cursor: pointer !important;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/* datatable row */
|
|
340
|
-
.v-data-table .v-table__wrapper > table > thead > tr > td,
|
|
341
|
-
.v-data-table .v-table__wrapper > table > thead > tr th,
|
|
342
|
-
.v-data-table .v-table__wrapper > table tbody > tr > td,
|
|
343
|
-
.v-data-table .v-table__wrapper > table tbody > tr th {
|
|
344
|
-
background-color: #d3d3d375 !important;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/* datatable header contour */
|
|
348
|
-
.v-data-table .v-table__wrapper > table > thead > tr > th,
|
|
349
|
-
.v-data-table .v-table__wrapper > table tbody > tr > th {
|
|
350
|
-
background-color: white !important;
|
|
351
|
-
border-bottom: 4px #223654 solid !important;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/* datatable header intérieur*/
|
|
355
|
-
.v-data-table-header__content {
|
|
356
|
-
background-color: white !important;
|
|
357
|
-
color: #223654 !important;
|
|
358
|
-
font-weight: 600;
|
|
359
|
-
font-size: 15px;
|
|
360
|
-
height: 46px;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/* datatable footer */
|
|
364
|
-
.v-data-table-footer {
|
|
365
|
-
background-color: white !important;
|
|
366
|
-
border-top: 4px #223654 solid !important;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/* datatable row hover */
|
|
370
|
-
.v-data-table .v-table__wrapper > table tbody > tr:hover > td,
|
|
371
|
-
.v-data-table .v-table__wrapper > table tbody > tr:hover {
|
|
372
|
-
background-color: #e0e0e0 !important;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
.iconeSupprimer:hover {
|
|
376
|
-
color: red;
|
|
377
|
-
}
|
|
378
|
-
.v-icon.v-icon.v-icon--link.iconeSupprimer:hover {
|
|
379
|
-
color: red !important;
|
|
380
|
-
}
|
|
381
|
-
.iconeEditer:hover {
|
|
382
|
-
color: #095797;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/* hover icone à droite du ajouter*/
|
|
386
|
-
.text-grisMoyen:hover {
|
|
387
|
-
color: #095797 !important;
|
|
388
|
-
}
|
|
389
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-row>
|
|
4
|
+
<slot name="ligne" />
|
|
5
|
+
<!-- Affichage de la boite de recherche-->
|
|
6
|
+
<v-col
|
|
7
|
+
cols="12"
|
|
8
|
+
sm="7"
|
|
9
|
+
md="6"
|
|
10
|
+
lg="5"
|
|
11
|
+
xl="4"
|
|
12
|
+
>
|
|
13
|
+
<slot name="recherche"></slot>
|
|
14
|
+
<Recherche
|
|
15
|
+
v-if="rechercheAfficher"
|
|
16
|
+
:rechercheTexte="rechercheTexte"
|
|
17
|
+
:chargement="chargementListe"
|
|
18
|
+
:recherche="recherche"
|
|
19
|
+
@update:recherche="chargerRecherche"
|
|
20
|
+
class="flex-grow-1"
|
|
21
|
+
>
|
|
22
|
+
</Recherche>
|
|
23
|
+
</v-col>
|
|
24
|
+
|
|
25
|
+
<!-- Entre recherche et ajouté-->
|
|
26
|
+
<v-col
|
|
27
|
+
cols="12"
|
|
28
|
+
sm="auto"
|
|
29
|
+
class="pt-1 mt-0 pb-0 mb-0"
|
|
30
|
+
>
|
|
31
|
+
<slot name="milieu" />
|
|
32
|
+
</v-col>
|
|
33
|
+
|
|
34
|
+
<!-- Affichage des boutons et icônes-->
|
|
35
|
+
<v-col
|
|
36
|
+
cols="12"
|
|
37
|
+
sm="auto"
|
|
38
|
+
class="flex-grow-1 d-flex justify-end"
|
|
39
|
+
>
|
|
40
|
+
<slot name="droite" />
|
|
41
|
+
|
|
42
|
+
<v-btn
|
|
43
|
+
v-if="btnAjouter"
|
|
44
|
+
color="primary"
|
|
45
|
+
class="ml-1 float-right"
|
|
46
|
+
@click.stop="ajouter"
|
|
47
|
+
>
|
|
48
|
+
{{ props.btnAjouterTexte ? props.btnAjouterTexte : $t('csqc.bouton.ajouter') }}
|
|
49
|
+
</v-btn>
|
|
50
|
+
|
|
51
|
+
<exportExcelComponent
|
|
52
|
+
v-if="excel"
|
|
53
|
+
:liste="filteredItems"
|
|
54
|
+
:chargement-liste="chargementListe"
|
|
55
|
+
:nom-fichier="excelNomFichier"
|
|
56
|
+
class="mt-1 ml-1 float-right"
|
|
57
|
+
/>
|
|
58
|
+
</v-col>
|
|
59
|
+
</v-row>
|
|
60
|
+
|
|
61
|
+
<!-- ligne pour la recherche avancee -->
|
|
62
|
+
<v-row
|
|
63
|
+
v-if="rechercheAvancee && rechercheAfficher"
|
|
64
|
+
dense
|
|
65
|
+
class="pt-0 mt-0 pl-1"
|
|
66
|
+
>
|
|
67
|
+
<v-expansion-panels
|
|
68
|
+
class="pa-0"
|
|
69
|
+
static
|
|
70
|
+
:readonly="chargementListe"
|
|
71
|
+
expand-icon=""
|
|
72
|
+
@update:modelValue="onPanelChange"
|
|
73
|
+
>
|
|
74
|
+
<v-expansion-panel
|
|
75
|
+
flat
|
|
76
|
+
elevation="0"
|
|
77
|
+
>
|
|
78
|
+
<v-expansion-panel-title
|
|
79
|
+
style="color: #095797"
|
|
80
|
+
class="pl-0 ml-0"
|
|
81
|
+
><slot name="rechercheAvanceeTitre">
|
|
82
|
+
<span
|
|
83
|
+
style="text-decoration: underline"
|
|
84
|
+
v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
|
|
85
|
+
></span
|
|
86
|
+
><slot name="rechercheAvanceeApresTitre"></slot
|
|
87
|
+
></slot>
|
|
88
|
+
</v-expansion-panel-title>
|
|
89
|
+
<v-expansion-panel-text>
|
|
90
|
+
<slot name="rechercheAvancee"></slot>
|
|
91
|
+
</v-expansion-panel-text>
|
|
92
|
+
</v-expansion-panel>
|
|
93
|
+
</v-expansion-panels>
|
|
94
|
+
</v-row>
|
|
95
|
+
|
|
96
|
+
<!-- datatable-->
|
|
97
|
+
<v-row>
|
|
98
|
+
<v-col
|
|
99
|
+
cols="12"
|
|
100
|
+
class="d-flex ControlesDatatable flex-wrap"
|
|
101
|
+
>
|
|
102
|
+
<v-data-table
|
|
103
|
+
ref="datatable"
|
|
104
|
+
color="green"
|
|
105
|
+
:headers="colonnes"
|
|
106
|
+
:item-key="itemKey"
|
|
107
|
+
:items="liste"
|
|
108
|
+
:search="recherche"
|
|
109
|
+
:loading="chargementListe"
|
|
110
|
+
:hover="hover"
|
|
111
|
+
:density="densite"
|
|
112
|
+
:items-per-page="itemsParPage"
|
|
113
|
+
:item-per-page-options="itemsParPageOptions"
|
|
114
|
+
@click:row="cliqueLigne"
|
|
115
|
+
>
|
|
116
|
+
<!-- utilisation des slots via le component parent-->
|
|
117
|
+
<!-- eslint-disable-next-line -->
|
|
118
|
+
<template
|
|
119
|
+
v-for="(_, slot) of $slots"
|
|
120
|
+
:key="slot"
|
|
121
|
+
#[slot]="scope"
|
|
122
|
+
>
|
|
123
|
+
<slot
|
|
124
|
+
:name="slot"
|
|
125
|
+
v-bind="scope"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<!-- boutons supprimer et modifier -->
|
|
130
|
+
<!-- eslint-disable-next-line -->
|
|
131
|
+
<template v-slot:item.action="{ item }">
|
|
132
|
+
<slot
|
|
133
|
+
name="actionsCustom"
|
|
134
|
+
v-bind:item="item"
|
|
135
|
+
></slot>
|
|
136
|
+
<v-icon
|
|
137
|
+
v-if="props.btnSupprimer"
|
|
138
|
+
size="large"
|
|
139
|
+
@click.stop.prevent="ouvrirModaleSupprimer(item)"
|
|
140
|
+
class="iconeSupprimer float-right"
|
|
141
|
+
>
|
|
142
|
+
mdi-delete
|
|
143
|
+
</v-icon>
|
|
144
|
+
|
|
145
|
+
<v-icon
|
|
146
|
+
v-if="props.btnModifier"
|
|
147
|
+
size="large"
|
|
148
|
+
class="iconeEditer float-right"
|
|
149
|
+
@click.stop.prevent="modifier(item)"
|
|
150
|
+
>
|
|
151
|
+
mdi-pencil
|
|
152
|
+
</v-icon>
|
|
153
|
+
</template>
|
|
154
|
+
</v-data-table>
|
|
155
|
+
|
|
156
|
+
<!-- Fenêtre de suppression -->
|
|
157
|
+
<confirmation
|
|
158
|
+
v-if="props.btnSupprimer"
|
|
159
|
+
ref="modaleSupprimer"
|
|
160
|
+
@confirmer="supprimer"
|
|
161
|
+
:texte="supprimerTexte"
|
|
162
|
+
:titre="supprimerTitreTexte"
|
|
163
|
+
:largeur="modaleSupprimerLargeur"
|
|
164
|
+
/>
|
|
165
|
+
</v-col>
|
|
166
|
+
</v-row>
|
|
167
|
+
</div>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<script setup lang="ts">
|
|
171
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
172
|
+
|
|
173
|
+
import { ref, computed, type Slots, type PropType } from 'vue'
|
|
174
|
+
import Recherche from '../csqcRecherche.vue'
|
|
175
|
+
import confirmation from '../csqcConfirmation.vue'
|
|
176
|
+
import exportExcelComponent from './csqcTableExportExcel.vue'
|
|
177
|
+
//import ModaleChoix from './csqc-table-modale-choix-colonnes.vue';
|
|
178
|
+
//import axios from 'axios'
|
|
179
|
+
import { useI18n } from 'vue-i18n'
|
|
180
|
+
import Colonne from '../../modeles/composants/datatableColonne'
|
|
181
|
+
|
|
182
|
+
// Props
|
|
183
|
+
const props = defineProps({
|
|
184
|
+
btnAjouter: { type: Boolean, default: true },
|
|
185
|
+
btnAjouterTexte: { type: String, default: '' },
|
|
186
|
+
btnModifier: { type: Boolean, default: true },
|
|
187
|
+
btnSupprimer: { type: Boolean, default: true },
|
|
188
|
+
chargementListe: { type: Boolean, default: false },
|
|
189
|
+
operationEnCours: { type: Boolean, default: false },
|
|
190
|
+
//choixSwitchOptionDepart: { type: Boolean, default: false },
|
|
191
|
+
// classeRangee: { type: String, default: '' },
|
|
192
|
+
colonnes: {
|
|
193
|
+
type: Array as PropType<Colonne[]>,
|
|
194
|
+
default: () => [],
|
|
195
|
+
},
|
|
196
|
+
densite: { type: String as PropType<'default' | 'comfortable' | 'compact'>, default: 'default' },
|
|
197
|
+
excel: { type: Boolean, default: false },
|
|
198
|
+
excelNomFichier: { type: String, default: 'csqc' },
|
|
199
|
+
//filtresDepart: { type: Object, default: null },
|
|
200
|
+
//flechesTri: { type: Boolean, default: false },
|
|
201
|
+
// formulaireId: { type: Number, default: -1 },
|
|
202
|
+
//identifiant: { type: String, default: '' },
|
|
203
|
+
itemKey: { type: String, default: 'id' },
|
|
204
|
+
itemsParPage: { type: Number, default: 10 },
|
|
205
|
+
liste: {
|
|
206
|
+
type: Array as PropType<Record<string, any>[]>,
|
|
207
|
+
default: () => [],
|
|
208
|
+
},
|
|
209
|
+
hover: { type: Boolean, default: false },
|
|
210
|
+
// modulerDense: { type: Boolean, default: false },
|
|
211
|
+
// multifiltre: { type: Boolean, default: false },
|
|
212
|
+
// multiTri: { type: Boolean, default: false },
|
|
213
|
+
itemsParPageOptions: { type: Array, default: () => [10, 25, 30, -1] },
|
|
214
|
+
//pageCourante: { type: Number, default: 1 },
|
|
215
|
+
//paginationBottom: { type: Boolean, default: true },
|
|
216
|
+
// paginationTop: { type: Boolean, default: false },
|
|
217
|
+
// permettreChoixColonnes: { type: Boolean, default: false },
|
|
218
|
+
// rechercheDepart: { type: String, default: '' },
|
|
219
|
+
rechercheTexte: { type: String, default: '' },
|
|
220
|
+
rechercheAfficher: { type: Boolean, default: true },
|
|
221
|
+
rechercheAvancee: { type: Boolean, default: false },
|
|
222
|
+
rechercheAvanceeTexte: { type: String, default: '' },
|
|
223
|
+
// selectionChoixColonnesDepart: { type: String, default: '' },
|
|
224
|
+
// showSelect: { type: Boolean, default: false },
|
|
225
|
+
|
|
226
|
+
modaleSupprimerChamp: { type: String, default: '' },
|
|
227
|
+
modaleSupprimerTexte: { type: String, default: '' },
|
|
228
|
+
modaleSupprimerTitre: { type: String, default: '' },
|
|
229
|
+
modaleSupprimerLargeur: { type: String, default: '525px' },
|
|
230
|
+
//triParDepart: { type: Array, default: () => undefined },
|
|
231
|
+
//urlbase: { type: String, default: '' },
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
235
|
+
const slots = defineSlots<Slots>()
|
|
236
|
+
const { t } = useI18n({ useScope: 'global' })
|
|
237
|
+
const itemSelectionne = ref(null)
|
|
238
|
+
const modaleSupprimer = ref<InstanceType<typeof confirmation> | null>(null)
|
|
239
|
+
const supprimerTexte = computed(() => {
|
|
240
|
+
if (itemSelectionne.value == null) return ''
|
|
241
|
+
|
|
242
|
+
if (props.modaleSupprimerTexte != null && props.modaleSupprimerTexte != '') return props.modaleSupprimerTexte
|
|
243
|
+
|
|
244
|
+
return t('csqc.message.supprimerMessage', { nom: itemSelectionne?.value[props.modaleSupprimerChamp] ?? '' })
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
const supprimerTitreTexte = computed(() => props.modaleSupprimerTitre || t('csqc.message.supprimerTitre'))
|
|
248
|
+
|
|
249
|
+
// Fonction pour ouvrir le dialogue pour un item spécifique
|
|
250
|
+
const ouvrirModaleSupprimer = (item: any) => {
|
|
251
|
+
itemSelectionne.value = item
|
|
252
|
+
|
|
253
|
+
//modaleSupprimer.value?.ouvrir()
|
|
254
|
+
emit('supprimer', itemSelectionne.value)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const supprimer = () => {
|
|
258
|
+
emit('supprimer', itemSelectionne.value)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const recherche = ref<string>('')
|
|
262
|
+
const chargerRecherche = (val: string) => {
|
|
263
|
+
recherche.value = val
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const ajouter = () => {
|
|
267
|
+
emit('ajouter')
|
|
268
|
+
}
|
|
269
|
+
const cliqueLigne = ({ item }: { item: any }) => {
|
|
270
|
+
emit('cliqueLigne', item)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const modifier = (item: any) => {
|
|
274
|
+
emit('modifier', item)
|
|
275
|
+
}
|
|
276
|
+
const filteredItems = computed(() => {
|
|
277
|
+
if (!recherche.value) return props.liste // Si rien écrit, affiche tout
|
|
278
|
+
|
|
279
|
+
return props.liste.filter(item =>
|
|
280
|
+
Object.values(item).some(val => String(val).toLowerCase().includes(recherche.value.toLowerCase())),
|
|
281
|
+
)
|
|
282
|
+
})
|
|
283
|
+
const onPanelChange = (val: unknown) => {
|
|
284
|
+
if (typeof val === 'string' || typeof val === 'number' || val === null) {
|
|
285
|
+
const isOpen = val !== null && val !== ''
|
|
286
|
+
emit('panneau:etat', isOpen)
|
|
287
|
+
} else {
|
|
288
|
+
emit('panneau:etat', false)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const emit = defineEmits(['ajouter', 'cliqueLigne', 'supprimer', 'modifier', 'donneesExportees', 'panneau:etat'])
|
|
292
|
+
</script>
|
|
293
|
+
|
|
294
|
+
<style scoped lang="css">
|
|
295
|
+
.ControlesDatatable {
|
|
296
|
+
gap: 4px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* barre de recherche design QC*/
|
|
300
|
+
.BarreRecherche {
|
|
301
|
+
min-height: 40px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.BarreRechercheBackIcone {
|
|
305
|
+
border-right: 1px solid #808a9d;
|
|
306
|
+
border-top: 1px solid #808a9d;
|
|
307
|
+
border-bottom: 1px solid #808a9d;
|
|
308
|
+
background-color: #095797 !important;
|
|
309
|
+
height: 40px !important;
|
|
310
|
+
width: 40px !important;
|
|
311
|
+
max-width: 40px !important;
|
|
312
|
+
min-width: 40px !important;
|
|
313
|
+
padding-right: 0 !important;
|
|
314
|
+
padding-left: 0 !important;
|
|
315
|
+
border-radius: 0;
|
|
316
|
+
margin-left: -16px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* icone loupe */
|
|
320
|
+
.BarreRechercheIcone {
|
|
321
|
+
font-size: 34px !important;
|
|
322
|
+
margin-left: 1px !important;
|
|
323
|
+
margin-top: 2px !important;
|
|
324
|
+
color: white !important;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/* datatable contour */
|
|
328
|
+
.v-data-table {
|
|
329
|
+
border: 1px solid #d3d3d3;
|
|
330
|
+
border-radius: 5px;
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* hover */
|
|
335
|
+
.v-data-table:hover {
|
|
336
|
+
cursor: pointer !important;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* datatable row */
|
|
340
|
+
.v-data-table .v-table__wrapper > table > thead > tr > td,
|
|
341
|
+
.v-data-table .v-table__wrapper > table > thead > tr th,
|
|
342
|
+
.v-data-table .v-table__wrapper > table tbody > tr > td,
|
|
343
|
+
.v-data-table .v-table__wrapper > table tbody > tr th {
|
|
344
|
+
background-color: #d3d3d375 !important;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* datatable header contour */
|
|
348
|
+
.v-data-table .v-table__wrapper > table > thead > tr > th,
|
|
349
|
+
.v-data-table .v-table__wrapper > table tbody > tr > th {
|
|
350
|
+
background-color: white !important;
|
|
351
|
+
border-bottom: 4px #223654 solid !important;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* datatable header intérieur*/
|
|
355
|
+
.v-data-table-header__content {
|
|
356
|
+
background-color: white !important;
|
|
357
|
+
color: #223654 !important;
|
|
358
|
+
font-weight: 600;
|
|
359
|
+
font-size: 15px;
|
|
360
|
+
height: 46px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* datatable footer */
|
|
364
|
+
.v-data-table-footer {
|
|
365
|
+
background-color: white !important;
|
|
366
|
+
border-top: 4px #223654 solid !important;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/* datatable row hover */
|
|
370
|
+
.v-data-table .v-table__wrapper > table tbody > tr:hover > td,
|
|
371
|
+
.v-data-table .v-table__wrapper > table tbody > tr:hover {
|
|
372
|
+
background-color: #e0e0e0 !important;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.iconeSupprimer:hover {
|
|
376
|
+
color: red;
|
|
377
|
+
}
|
|
378
|
+
.v-icon.v-icon.v-icon--link.iconeSupprimer:hover {
|
|
379
|
+
color: red !important;
|
|
380
|
+
}
|
|
381
|
+
.iconeEditer:hover {
|
|
382
|
+
color: #095797;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/* hover icone à droite du ajouter*/
|
|
386
|
+
.text-grisMoyen:hover {
|
|
387
|
+
color: #095797 !important;
|
|
388
|
+
}
|
|
389
|
+
</style>
|