codevdesign 0.0.46 → 0.0.48
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 -330
- package/composants/csqcOptionSwitch.vue +124 -124
- package/composants/csqcRecherche.vue +7 -5
- package/composants/csqcTable/csqcTable.vue +389 -387
- package/composants/csqcTable/csqcTableExportExcel.vue +58 -58
- package/composants/validateurs.ts +1 -1
- package/package.json +1 -1
|
@@ -1,58 +1,58 @@
|
|
|
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 '@e965/xlsx'
|
|
13
|
-
import {
|
|
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>
|
|
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 '@e965/xlsx'
|
|
13
|
+
import { 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>
|
|
@@ -151,7 +151,7 @@ export function estUnique<T extends ModeleAvecId>(
|
|
|
151
151
|
e[champ] != null &&
|
|
152
152
|
(e[champ] as string).toLowerCase().trim() === valeur.toLowerCase().trim() &&
|
|
153
153
|
e.id !== modele.id,
|
|
154
|
-
) || t('validateurs.estUnique', {
|
|
154
|
+
) || t('validateurs.estUnique', { valeurExistante: valeur })
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
157
|
|