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