On stocke en localstorage la conf passée par url du filtreCol

This commit is contained in:
Christophe 2022-04-25 11:03:03 +02:00
parent be5c2ba345
commit a44b88e941
2 changed files with 28 additions and 2 deletions

View file

@ -414,7 +414,6 @@ let monTableau = {
let url = this.apiuri; let url = this.apiuri;
if (parseInt(id) > 0) { if (parseInt(id) > 0) {
url += '&id=' + id; url += '&id=' + id;
console.log('url:' + url);
} else { } else {
let config = localStorage.getItem('header_' + this.nameLocalStorage); let config = localStorage.getItem('header_' + this.nameLocalStorage);
config = recupJson(config); config = recupJson(config);
@ -515,8 +514,10 @@ let monTableau = {
Vue.nextTick(() => { Vue.nextTick(() => {
this.chargement = false; this.chargement = false;
console.log(this.filtreselect);
if (this.filtreselect) { if (this.filtreselect) {
let Tfiltres = recupJson(decodeURIComponent(this.filtreselect)); let Tfiltres = recupJson(decodeURIComponent(this.filtreselect));
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(Tfiltres));
Tfiltres.forEach((col) => { Tfiltres.forEach((col) => {
this.filtreColSelected[col.champ] = [ this.filtreColSelected[col.champ] = [
...this.filtreColSelected[col.champ], ...this.filtreColSelected[col.champ],
@ -524,6 +525,18 @@ let monTableau = {
]; ];
}); });
this.filtreColModif++; this.filtreColModif++;
} else {
let filtreselect = localStorage.getItem('filtreselect_' + this.nameLocalStorage);
if (filtreselect) {
let Tfiltres = JSON.parse(filtreselect);
Tfiltres.forEach((col) => {
this.filtreColSelected[col.champ] = [
...this.filtreColSelected[col.champ],
...col.valeurs,
];
});
this.filtreColModif++;
}
} }
if (parseInt(this._id) > 0) { if (parseInt(this._id) > 0) {

View file

@ -466,7 +466,6 @@ var monTableau = {
if (parseInt(id) > 0) { if (parseInt(id) > 0) {
url += '&id=' + id; url += '&id=' + id;
console.log('url:' + url);
} else { } else {
var config = localStorage.getItem('header_' + this.nameLocalStorage); var config = localStorage.getItem('header_' + this.nameLocalStorage);
config = recupJson(config); config = recupJson(config);
@ -588,13 +587,27 @@ var monTableau = {
Vue.nextTick(function () { Vue.nextTick(function () {
_this4.chargement = false; _this4.chargement = false;
console.log(_this4.filtreselect);
if (_this4.filtreselect) { if (_this4.filtreselect) {
var Tfiltres = recupJson(decodeURIComponent(_this4.filtreselect)); var Tfiltres = recupJson(decodeURIComponent(_this4.filtreselect));
localStorage.setItem('filtreselect_' + _this4.nameLocalStorage, JSON.stringify(Tfiltres));
Tfiltres.forEach(function (col) { Tfiltres.forEach(function (col) {
_this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(col.valeurs)); _this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(col.valeurs));
}); });
_this4.filtreColModif++; _this4.filtreColModif++;
} else {
var filtreselect = localStorage.getItem('filtreselect_' + _this4.nameLocalStorage);
if (filtreselect) {
var _Tfiltres = JSON.parse(filtreselect);
_Tfiltres.forEach(function (col) {
_this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(col.valeurs));
});
_this4.filtreColModif++;
}
} }
if (parseInt(_this4._id) > 0) { if (parseInt(_this4._id) > 0) {