PSR
This commit is contained in:
parent
b7e2f3ef79
commit
09d6d5a108
1 changed files with 34 additions and 72 deletions
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="gamutable">
|
||||
|
||||
<div class="gamutable--surTable">
|
||||
<select id="parPage" v-model="parPageSelect">
|
||||
<option v-for="v in tparpage" :key="v">{{ v }}</option>
|
||||
|
@ -49,14 +50,8 @@
|
|||
</button>
|
||||
|
||||
<span v-show="chargement" class="rouge">
|
||||
<i class="
|
||||
gt-spin
|
||||
animate-spin
|
||||
rouge
|
||||
"></i>
|
||||
<span class="texteMajBDD">
|
||||
Mise à jour de la base de donnée
|
||||
</span>
|
||||
<i class="gt-spin animate-spin rouge"></i>
|
||||
<span class="texteMajBDD"> Mise à jour de la base de donnée </span>
|
||||
</span>
|
||||
<span v-show="!chargement" class="btn verte" style="cursor: auto" title="Base de donnée synchronisée !">
|
||||
<i class="gt-database"></i>
|
||||
|
@ -90,17 +85,14 @@
|
|||
<div v-if="checkbox[head] !== undefined" :id="'filtreCol_' + head" :class="classes[head]"
|
||||
class="flex justify-between">
|
||||
<input class="ml-2" type="checkbox" @click.stop="validerCheckboxCol(head)" />
|
||||
<button @click.stop="
|
||||
checkboxValider(head, checkbox[head])
|
||||
">
|
||||
<button @click.stop="checkboxValider(head, checkbox[head])">
|
||||
<i class="gt-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="filtreCol.indexOf(head) !== -1" :id="'filtreCol_' + head" :class="classes[head]">
|
||||
<vue-select v-if="filtreColType[head] === 'select'" v-model="filtreColSelected[head]"
|
||||
:options="filtreColVal[head].sort(ordonnerSelect)
|
||||
" hide-selected multiple taggable close-on-select clear-on-close searchable @selected="selectValCol"
|
||||
@search:focus="">
|
||||
:options="filtreColVal[head].sort(ordonnerSelect)" hide-selected multiple taggable
|
||||
close-on-select clear-on-close searchable @selected="selectValCol" @search:focus="">
|
||||
<template #tag="{ option, remove }">
|
||||
<div class="tag--un">
|
||||
{{ option }}
|
||||
|
@ -158,7 +150,7 @@
|
|||
<div class="page-item">
|
||||
<button type="button" class="page-link" :class="{ on: pageNumber === page }" v-for="pageNumber in pages.slice(
|
||||
page - 4 < 0 ? 0 : page - 4,
|
||||
page + 3
|
||||
page + 3,
|
||||
)" @click="page = pageNumber">
|
||||
{{ pageNumber }}
|
||||
</button>
|
||||
|
@ -277,18 +269,18 @@ let page = ref(1);
|
|||
let parPage = ref(
|
||||
sessionStorage.getItem("nbItems")
|
||||
? sessionStorage.getItem("nbItems")
|
||||
: props.tparpage[0]
|
||||
: props.tparpage[0],
|
||||
);
|
||||
let parPageSelect = ref(
|
||||
sessionStorage.getItem("nbItemsChaine")
|
||||
? sessionStorage.getItem("nbItemsChaine")
|
||||
: props.tparpage[0]
|
||||
: props.tparpage[0],
|
||||
);
|
||||
let pages = ref([]);
|
||||
let triOrders = ref([]);
|
||||
let triProps = ref([]);
|
||||
let selectTr = ref([]);
|
||||
let champ_search = ref(props.champcsv ?? 'html');
|
||||
let champ_search = ref(props.champcsv ?? "html");
|
||||
let chargement = ref(true);
|
||||
let quelleVue = ref(props.vueblocdefaut);
|
||||
let vuebloc = ref(false);
|
||||
|
@ -302,8 +294,6 @@ let nameLocalStorage = calculer_nameLocalStorage();
|
|||
|
||||
let filtreColValeurs = [];
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
localforage.setDriver(localforage[props.stockage.toUpperCase()]);
|
||||
chargerJson("maj");
|
||||
|
@ -367,9 +357,7 @@ const tableau = computed(() => {
|
|||
let Trsearch = TcolValue.some((uneValeur) => {
|
||||
if (Number.isInteger(uneValeur)) {
|
||||
if (
|
||||
parseInt(
|
||||
ligne[champ_search.value][colName]
|
||||
) === uneValeur
|
||||
parseInt(ligne[champ_search.value][colName]) === uneValeur
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -377,21 +365,14 @@ const tableau = computed(() => {
|
|||
// on test si on vient d'un filtrage avec recup des valeurs en header
|
||||
if (filtreColValeurs[colName]) {
|
||||
if (
|
||||
ligne[champ_search.value][
|
||||
colName
|
||||
] !== undefined &&
|
||||
ligne[champ_search.value][colName] !== undefined &&
|
||||
!(
|
||||
ligne[champ_search.value][
|
||||
colName
|
||||
]
|
||||
ligne[champ_search.value][colName]
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.toString()
|
||||
.indexOf(uneValeur) ===
|
||||
-1 ||
|
||||
!ligne[champ_search.value][
|
||||
colName
|
||||
]
|
||||
.indexOf(uneValeur) === -1 ||
|
||||
!ligne[champ_search.value][colName]
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
)
|
||||
|
@ -400,21 +381,15 @@ const tableau = computed(() => {
|
|||
}
|
||||
} else {
|
||||
if (
|
||||
ligne[champ_search.value][
|
||||
colName
|
||||
] !== undefined &&
|
||||
ligne[champ_search.value][colName] !== undefined &&
|
||||
!(
|
||||
uneValeur.indexOf(
|
||||
ligne[champ_search.value][
|
||||
colName
|
||||
]
|
||||
ligne[champ_search.value][colName]
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.toString()
|
||||
.toString(),
|
||||
) === -1 ||
|
||||
!ligne[champ_search.value][
|
||||
colName
|
||||
]
|
||||
!ligne[champ_search.value][colName]
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
)
|
||||
|
@ -492,23 +467,21 @@ watch(
|
|||
() => {
|
||||
let ObfiltreSelect = [];
|
||||
if (filtreColSelected.value) {
|
||||
Object.entries(filtreColSelected.value).forEach(
|
||||
([champ, valeurs]) => {
|
||||
Object.entries(filtreColSelected.value).forEach(([champ, valeurs]) => {
|
||||
if (!Array.isArray(valeurs)) {
|
||||
valeurs = [valeurs];
|
||||
}
|
||||
ObfiltreSelect.push({ champ, valeurs });
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
if (!ajaxCrayons) {
|
||||
localStorage.setItem(
|
||||
"filtreselect_" + nameLocalStorage,
|
||||
JSON.stringify(ObfiltreSelect)
|
||||
JSON.stringify(ObfiltreSelect),
|
||||
);
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -674,19 +647,15 @@ function chargerJson(id) {
|
|||
nextTick(() => {
|
||||
chargement.value = false;
|
||||
const filtreselectLS = localStorage.getItem(
|
||||
"filtreselect_" + nameLocalStorage
|
||||
);
|
||||
const triColLS = localStorage.getItem(
|
||||
"triCol_" + nameLocalStorage
|
||||
"filtreselect_" + nameLocalStorage,
|
||||
);
|
||||
const triColLS = localStorage.getItem("triCol_" + nameLocalStorage);
|
||||
|
||||
let Tfiltres = [];
|
||||
if (props.filtreselect) {
|
||||
props.filtreselect.split(",").forEach((unFiltre) => {
|
||||
const [champ, ...valeurs] = unFiltre.split("|");
|
||||
const index = Tfiltres.findIndex(
|
||||
(col) => col.champ === champ
|
||||
);
|
||||
const index = Tfiltres.findIndex((col) => col.champ === champ);
|
||||
if (index === -1) {
|
||||
Tfiltres.push({ champ, valeurs });
|
||||
} else {
|
||||
|
@ -695,7 +664,7 @@ function chargerJson(id) {
|
|||
});
|
||||
localStorage.setItem(
|
||||
"filtreselect_" + nameLocalStorage,
|
||||
JSON.stringify(Tfiltres)
|
||||
JSON.stringify(Tfiltres),
|
||||
);
|
||||
} else if (filtreselectLS) {
|
||||
Tfiltres = JSON.parse(filtreselectLS);
|
||||
|
@ -723,10 +692,7 @@ function chargerJson(id) {
|
|||
tri(col, sens);
|
||||
}
|
||||
});
|
||||
localStorage.setItem(
|
||||
"triCol_" + nameLocalStorage,
|
||||
trierVal
|
||||
);
|
||||
localStorage.setItem("triCol_" + nameLocalStorage, trierVal);
|
||||
} else if (triColLS) {
|
||||
triColLS.split(",").forEach((unTri) => {
|
||||
const [col, sens] = unTri.split("|");
|
||||
|
@ -791,9 +757,7 @@ function selectValCol() {
|
|||
// }
|
||||
function calculer_nameLocalStorage() {
|
||||
if (props.apiuri) {
|
||||
return (
|
||||
props.apiuri.match(/.*page=(.*)/)[1] + "&gamuId=" + props.id_auteur
|
||||
);
|
||||
return props.apiuri.match(/.*page=(.*)/)[1] + "&gamuId=" + props.id_auteur;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -827,7 +791,7 @@ function tri(col, sens = false) {
|
|||
table.value,
|
||||
triProps.value,
|
||||
triOrders.value,
|
||||
champ_search.value
|
||||
champ_search.value,
|
||||
);
|
||||
ordreCol.value[col] = sens;
|
||||
saveHeader();
|
||||
|
@ -946,9 +910,7 @@ function checkboxValider(head, url) {
|
|||
chargerJson("maj");
|
||||
});
|
||||
} else {
|
||||
const Tcheck = encodeURIComponent(
|
||||
JSON.stringify(Tcheckbox.value[head])
|
||||
);
|
||||
const Tcheck = encodeURIComponent(JSON.stringify(Tcheckbox.value[head]));
|
||||
url += "&data=" + Tcheck;
|
||||
url += "&var_zajax=content";
|
||||
const data = {};
|
||||
|
|
Loading…
Add table
Reference in a new issue