codevdesign 0.0.1 → 0.0.2
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/csqcAlerteErreur.vue +86 -0
- package/composants/csqcConfirmation.vue +74 -0
- package/composants/csqcDialogue.vue +118 -0
- package/composants/csqcOptionSwitch.vue +113 -0
- package/composants/csqcRecherche.vue +158 -0
- package/composants/csqcSnackbar.vue +99 -0
- package/composants/csqcTable/csqcTable.vue +314 -0
- package/composants/csqcTable/csqcTableExportExcel.vue +67 -0
- package/composants/csqcTable/csqcTableModaleChoixColonnes.vue +567 -0
- package/composants/csqcTiroir.vue +150 -0
- package/composants/gabarit/csqcMenu.vue +249 -0
- package/composants/gabarit/pivEntete.vue +109 -0
- package/composants/gabarit/pivPiedPage.vue +59 -0
- package/composants/gabarit/vueDefault.vue +6 -0
- package/index.ts +38 -0
- package/locales/en.json +9 -0
- package/locales/fr.json +126 -0
- package/modeles/composants/csqcMenuModele.ts +18 -0
- package/modeles/composants/snackbar.ts +18 -0
- package/modeles/intervention.ts +38 -0
- package/modeles/unite.ts +42 -0
- package/modeles/utilisateur.ts +33 -0
- package/package.json +21 -12
- package/codevdesign.css +0 -1
- package/codevdesign.js +0 -16104
- package/codevdesign.umd.cjs +0 -25
|
@@ -0,0 +1,314 @@
|
|
|
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
|
+
></Recherche>
|
|
22
|
+
</v-col>
|
|
23
|
+
|
|
24
|
+
<!-- Entre recherche et ajouté-->
|
|
25
|
+
<v-col
|
|
26
|
+
cols="12"
|
|
27
|
+
sm="auto"
|
|
28
|
+
class="pt-1 mt-0 pb-0 mb-0"
|
|
29
|
+
>
|
|
30
|
+
<slot name="milieu" />
|
|
31
|
+
</v-col>
|
|
32
|
+
|
|
33
|
+
<!-- Affichage des boutons et icônes-->
|
|
34
|
+
<v-col
|
|
35
|
+
cols="12"
|
|
36
|
+
sm="auto"
|
|
37
|
+
class="flex-grow-1 d-flex justify-end"
|
|
38
|
+
>
|
|
39
|
+
<slot name="droite" />
|
|
40
|
+
|
|
41
|
+
<v-btn
|
|
42
|
+
v-if="btnAjouter"
|
|
43
|
+
color="primary"
|
|
44
|
+
class="float-right"
|
|
45
|
+
@click.stop="ajouter"
|
|
46
|
+
>
|
|
47
|
+
{{ props.btnAjouterTexte ? props.btnAjouterTexte : $t('csqc-table.boutton.ajouter') }}
|
|
48
|
+
</v-btn>
|
|
49
|
+
</v-col>
|
|
50
|
+
</v-row>
|
|
51
|
+
|
|
52
|
+
<!-- ligne pour la recherche avancee -->
|
|
53
|
+
<v-row>
|
|
54
|
+
<slot name="rechercheAvancee"></slot>
|
|
55
|
+
</v-row>
|
|
56
|
+
|
|
57
|
+
<!-- datatable-->
|
|
58
|
+
<v-row>
|
|
59
|
+
<v-col
|
|
60
|
+
cols="12"
|
|
61
|
+
class="d-flex ControlesDatatable flex-wrap"
|
|
62
|
+
>
|
|
63
|
+
<v-data-table
|
|
64
|
+
color="green"
|
|
65
|
+
:headers="colonnes as any"
|
|
66
|
+
:item-key="itemKey"
|
|
67
|
+
:items="liste as any"
|
|
68
|
+
:search="recherche"
|
|
69
|
+
:loading="chargementListe"
|
|
70
|
+
@click:row="cliqueLigne"
|
|
71
|
+
>
|
|
72
|
+
<!-- utilisation des slots via le component parent-->
|
|
73
|
+
<!-- eslint-disable-next-line -->
|
|
74
|
+
<template
|
|
75
|
+
v-for="(_, slot) of $slots"
|
|
76
|
+
:key="slot"
|
|
77
|
+
#[slot]="scope"
|
|
78
|
+
>
|
|
79
|
+
<slot
|
|
80
|
+
:name="slot"
|
|
81
|
+
v-bind="scope"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<!-- boutons supprimer et modifier -->
|
|
86
|
+
<!-- eslint-disable-next-line -->
|
|
87
|
+
<template v-slot:item.action="{ item }">
|
|
88
|
+
<slot
|
|
89
|
+
name="actionsCustom"
|
|
90
|
+
v-bind:item="item"
|
|
91
|
+
></slot>
|
|
92
|
+
<v-icon
|
|
93
|
+
v-if="props.btnSupprimer"
|
|
94
|
+
size="large"
|
|
95
|
+
@click.stop.prevent="ouvrirModaleSupprimer(item)"
|
|
96
|
+
class="iconeSupprimer float-right"
|
|
97
|
+
>
|
|
98
|
+
mdi-delete
|
|
99
|
+
</v-icon>
|
|
100
|
+
|
|
101
|
+
<v-icon
|
|
102
|
+
v-if="props.btnModifier"
|
|
103
|
+
size="large"
|
|
104
|
+
class="iconeEditer float-right"
|
|
105
|
+
@click.stop.prevent="modifier(item)"
|
|
106
|
+
>
|
|
107
|
+
mdi-pencil
|
|
108
|
+
</v-icon>
|
|
109
|
+
</template>
|
|
110
|
+
</v-data-table>
|
|
111
|
+
|
|
112
|
+
<!-- Fenêtre de suppression -->
|
|
113
|
+
<confirmation
|
|
114
|
+
v-if="props.btnSupprimer"
|
|
115
|
+
ref="modaleSupprimer"
|
|
116
|
+
@confirmer="supprimer"
|
|
117
|
+
:texte="supprimerTexte"
|
|
118
|
+
:titre="supprimerTitreTexte"
|
|
119
|
+
:largeur="modaleSupprimerLargeur"
|
|
120
|
+
/>
|
|
121
|
+
</v-col>
|
|
122
|
+
</v-row>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<script setup lang="ts">
|
|
127
|
+
import { ref, computed, defineProps, type Slots } from 'vue'
|
|
128
|
+
import Recherche from '../csqcRecherche.vue'
|
|
129
|
+
import confirmation from '../csqcConfirmation.vue'
|
|
130
|
+
//import ExportExcel from './csqc-table-export-excel.vue';
|
|
131
|
+
//import ModaleChoix from './csqc-table-modale-choix-colonnes.vue';
|
|
132
|
+
//import axios from 'axios'
|
|
133
|
+
import { useI18n } from 'vue-i18n'
|
|
134
|
+
|
|
135
|
+
// Props
|
|
136
|
+
const props = defineProps({
|
|
137
|
+
btnAjouter: { type: Boolean, default: true },
|
|
138
|
+
btnAjouterTexte: { type: String, default: '' },
|
|
139
|
+
btnModifier: { type: Boolean, default: true },
|
|
140
|
+
btnSupprimer: { type: Boolean, default: true },
|
|
141
|
+
chargementListe: { type: Boolean, default: false },
|
|
142
|
+
operationEnCours: { type: Boolean, default: false },
|
|
143
|
+
//choixSwitchOptionDepart: { type: Boolean, default: false },
|
|
144
|
+
// classeRangee: { type: String, default: '' },
|
|
145
|
+
colonnes: { type: Array, default: () => [] },
|
|
146
|
+
// excelAfficher: { type: Boolean, default: false },
|
|
147
|
+
// excelNomFichier: { type: String, default: 'donnees' },
|
|
148
|
+
//filtresDepart: { type: Object, default: null },
|
|
149
|
+
//flechesTri: { type: Boolean, default: false },
|
|
150
|
+
// formulaireId: { type: Number, default: -1 },
|
|
151
|
+
//identifiant: { type: String, default: '' },
|
|
152
|
+
itemKey: { type: String, default: 'id' },
|
|
153
|
+
// itemsParPage: { type: Number, default: 10 },
|
|
154
|
+
liste: { type: Array, default: () => [] },
|
|
155
|
+
// modulerDense: { type: Boolean, default: false },
|
|
156
|
+
// multifiltre: { type: Boolean, default: false },
|
|
157
|
+
// multiTri: { type: Boolean, default: false },
|
|
158
|
+
//optionsItemsParPage: { type: Array, default: () => [10, 25, 30, -1] },
|
|
159
|
+
//pageCourante: { type: Number, default: 1 },
|
|
160
|
+
//paginationBottom: { type: Boolean, default: true },
|
|
161
|
+
// paginationTop: { type: Boolean, default: false },
|
|
162
|
+
// permettreChoixColonnes: { type: Boolean, default: false },
|
|
163
|
+
// rechercheDepart: { type: String, default: '' },
|
|
164
|
+
rechercheTexte: { type: String, default: '' },
|
|
165
|
+
rechercheAfficher: { type: Boolean, default: true },
|
|
166
|
+
// selectionChoixColonnesDepart: { type: String, default: '' },
|
|
167
|
+
// showSelect: { type: Boolean, default: false },
|
|
168
|
+
|
|
169
|
+
modaleSupprimerChamp: { type: String, default: '' },
|
|
170
|
+
modaleSupprimerTexte: { type: String, default: '' },
|
|
171
|
+
modaleSupprimerTitre: { type: String, default: '' },
|
|
172
|
+
modaleSupprimerLargeur: { type: String, default: '525px' },
|
|
173
|
+
//triParDepart: { type: Array, default: () => undefined },
|
|
174
|
+
//urlbase: { type: String, default: '' },
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
178
|
+
const slots = defineSlots<Slots>()
|
|
179
|
+
const { t } = useI18n({ useScope: 'global' })
|
|
180
|
+
const itemSelectionne = ref(null)
|
|
181
|
+
const modaleSupprimer = ref<InstanceType<typeof confirmation> | null>(null)
|
|
182
|
+
const supprimerTexte = computed(() => {
|
|
183
|
+
if (itemSelectionne.value == null) return ''
|
|
184
|
+
|
|
185
|
+
if (props.modaleSupprimerTexte != null && props.modaleSupprimerTexte != '') return props.modaleSupprimerTexte
|
|
186
|
+
|
|
187
|
+
return t('csqc-table.label.supprimerMessage', { nom: itemSelectionne?.value[props.modaleSupprimerChamp] ?? '' })
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
const supprimerTitreTexte = computed(() => props.modaleSupprimerTitre || t('csqc-table.label.supprimerTitre'))
|
|
191
|
+
|
|
192
|
+
// Fonction pour ouvrir le dialogue pour un item spécifique
|
|
193
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
|
+
const ouvrirModaleSupprimer = (item: any) => {
|
|
195
|
+
itemSelectionne.value = item
|
|
196
|
+
|
|
197
|
+
//modaleSupprimer.value?.ouvrir()
|
|
198
|
+
emit('supprimer', itemSelectionne.value)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const supprimer = () => {
|
|
202
|
+
emit('supprimer', itemSelectionne.value)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const recherche = ref<string>('')
|
|
206
|
+
const chargerRecherche = (val: string) => {
|
|
207
|
+
recherche.value = val
|
|
208
|
+
}
|
|
209
|
+
const ajouter = () => {
|
|
210
|
+
emit('ajouter')
|
|
211
|
+
}
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
213
|
+
const cliqueLigne = (e: Event, { item }: { item: any }) => {
|
|
214
|
+
emit('cliqueLigne', item)
|
|
215
|
+
}
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
|
+
const modifier = (item: any) => {
|
|
218
|
+
emit('modifier', item)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const emit = defineEmits(['ajouter', 'cliqueLigne', 'supprimer', 'modifier'])
|
|
222
|
+
</script>
|
|
223
|
+
|
|
224
|
+
<style scoped lang="css">
|
|
225
|
+
.ControlesDatatable {
|
|
226
|
+
gap: 4px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* barre de recherche design QC*/
|
|
230
|
+
.BarreRecherche {
|
|
231
|
+
min-height: 40px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.BarreRechercheBackIcone {
|
|
235
|
+
border-right: 1px solid #808a9d;
|
|
236
|
+
border-top: 1px solid #808a9d;
|
|
237
|
+
border-bottom: 1px solid #808a9d;
|
|
238
|
+
background-color: #095797 !important;
|
|
239
|
+
height: 40px !important;
|
|
240
|
+
width: 40px !important;
|
|
241
|
+
max-width: 40px !important;
|
|
242
|
+
min-width: 40px !important;
|
|
243
|
+
padding-right: 0 !important;
|
|
244
|
+
padding-left: 0 !important;
|
|
245
|
+
border-radius: 0;
|
|
246
|
+
margin-left: -16px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* icone loupe */
|
|
250
|
+
.BarreRechercheIcone {
|
|
251
|
+
font-size: 34px !important;
|
|
252
|
+
margin-left: 1px !important;
|
|
253
|
+
margin-top: 2px !important;
|
|
254
|
+
color: white !important;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* datatable contour */
|
|
258
|
+
.v-data-table {
|
|
259
|
+
border: 1px solid #d3d3d3;
|
|
260
|
+
border-radius: 5px;
|
|
261
|
+
overflow: hidden;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* hover */
|
|
265
|
+
.v-data-table:hover {
|
|
266
|
+
cursor: pointer !important;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* datatable row */
|
|
270
|
+
.v-data-table .v-table__wrapper > table > thead > tr > td,
|
|
271
|
+
.v-data-table .v-table__wrapper > table > thead > tr th,
|
|
272
|
+
.v-data-table .v-table__wrapper > table tbody > tr > td,
|
|
273
|
+
.v-data-table .v-table__wrapper > table tbody > tr th {
|
|
274
|
+
background-color: #d3d3d375 !important;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* datatable header contour */
|
|
278
|
+
.v-data-table .v-table__wrapper > table > thead > tr > th,
|
|
279
|
+
.v-data-table .v-table__wrapper > table tbody > tr > th {
|
|
280
|
+
background-color: white !important;
|
|
281
|
+
border-bottom: 4px #223654 solid !important;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* datatable header intérieur*/
|
|
285
|
+
.v-data-table-header__content {
|
|
286
|
+
background-color: white !important;
|
|
287
|
+
color: #223654 !important;
|
|
288
|
+
font-weight: 600;
|
|
289
|
+
font-size: 15px;
|
|
290
|
+
height: 46px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* datatable footer */
|
|
294
|
+
.v-data-table-footer {
|
|
295
|
+
background-color: white !important;
|
|
296
|
+
border-top: 4px #223654 solid !important;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* datatable row hover */
|
|
300
|
+
.v-data-table .v-table__wrapper > table tbody > tr:hover > td,
|
|
301
|
+
.v-data-table .v-table__wrapper > table tbody > tr:hover {
|
|
302
|
+
background-color: #e0e0e0 !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.iconeSupprimer:hover {
|
|
306
|
+
color: red;
|
|
307
|
+
}
|
|
308
|
+
.v-icon.v-icon.v-icon--link.iconeSupprimer:hover {
|
|
309
|
+
color: red !important;
|
|
310
|
+
}
|
|
311
|
+
.iconeEditer:hover {
|
|
312
|
+
color: #095797;
|
|
313
|
+
}
|
|
314
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-icon
|
|
3
|
+
right
|
|
4
|
+
color="green darken-2"
|
|
5
|
+
@click="exportSheet"
|
|
6
|
+
>
|
|
7
|
+
mdi-microsoft-excel
|
|
8
|
+
</v-icon>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import { utils, writeFileXLSX } from 'xlsx';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
props: {
|
|
15
|
+
chargementListe: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
nomFichier: {
|
|
20
|
+
required: true,
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
colonnes: {
|
|
24
|
+
required: true,
|
|
25
|
+
type: Array,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
exportSheet() {
|
|
34
|
+
this.$emit('demande', this.exportSheetEffective);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
exportSheetEffective(itemsAExporter) {
|
|
38
|
+
// https://github.com/SheetJS/SheetJS/tree/master/demos/vue/
|
|
39
|
+
|
|
40
|
+
const header = this.colonnes.map((element) => element.value);
|
|
41
|
+
const headerText = this.colonnes.map((element) => element.text);
|
|
42
|
+
|
|
43
|
+
const dataRows = [];
|
|
44
|
+
const itemsExportes = itemsAExporter.map((row) => {
|
|
45
|
+
const dataRow = [];
|
|
46
|
+
const item = {};
|
|
47
|
+
header.map((column) => {
|
|
48
|
+
dataRow.push(row[column]);
|
|
49
|
+
if (row[column] != null) item[column] = row[column];
|
|
50
|
+
return true;
|
|
51
|
+
});
|
|
52
|
+
dataRows.push(dataRow);
|
|
53
|
+
return item;
|
|
54
|
+
});
|
|
55
|
+
const ws = utils.aoa_to_sheet([headerText, ...dataRows]);
|
|
56
|
+
const wb = utils.book_new();
|
|
57
|
+
utils.book_append_sheet(wb, ws, '1');
|
|
58
|
+
writeFileXLSX(wb, `${this.nomFichier}.xlsx`);
|
|
59
|
+
|
|
60
|
+
return itemsExportes;
|
|
61
|
+
// this.$emit('apres');
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
created() {
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
</script>
|