correction si on recharge en ajax via les crayons pour ne pas vider le localstorage
This commit is contained in:
parent
93f302049e
commit
833a8a7a3f
2 changed files with 43 additions and 44 deletions
|
@ -246,6 +246,7 @@ let monTableau = {
|
|||
searchInputHead: '',
|
||||
searchInputVal: '',
|
||||
loadingVueSelect: true,
|
||||
ajaxCrayons: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -406,7 +407,9 @@ let monTableau = {
|
|||
ObfiltreSelect.push({ champ, valeurs });
|
||||
});
|
||||
}
|
||||
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(ObfiltreSelect));
|
||||
if (!this.ajaxCrayons) {
|
||||
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(ObfiltreSelect));
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
|
@ -421,9 +424,9 @@ let monTableau = {
|
|||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol,
|
||||
};
|
||||
if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
}
|
||||
// if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
// localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
// }
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
},
|
||||
deleteInputSearch(head) {
|
||||
|
@ -541,7 +544,6 @@ let monTableau = {
|
|||
this.filtreColType = config.filtreCol;
|
||||
this.filtreCol = [];
|
||||
Object.keys(this.filtreColType).forEach((col) => {
|
||||
// let Tval = [''];
|
||||
let Tval = [];
|
||||
this.table.forEach((t) => {
|
||||
let valCol = t[this.champ_search][col];
|
||||
|
@ -560,24 +562,19 @@ let monTableau = {
|
|||
Vue.nextTick(() => {
|
||||
this.chargement = false;
|
||||
let filtreselect = localStorage.getItem('filtreselect_' + this.nameLocalStorage);
|
||||
console.log(filtreselect);
|
||||
let Tfiltres = [];
|
||||
if (filtreselect) {
|
||||
let Tfiltres = JSON.parse(filtreselect);
|
||||
Tfiltres.forEach((col) => {
|
||||
let v = col.valeurs;
|
||||
this.filtreColSelected[col.champ] = [...this.filtreColSelected[col.champ], ...v];
|
||||
});
|
||||
this.filtreColModif++;
|
||||
Tfiltres = JSON.parse(filtreselect);
|
||||
} else if (this.filtreselect) {
|
||||
let Tfiltres = recupJson(decodeURIComponent(this.filtreselect));
|
||||
Tfiltres = recupJson(decodeURIComponent(this.filtreselect));
|
||||
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(Tfiltres));
|
||||
Tfiltres.forEach((col) => {
|
||||
this.filtreColSelected[col.champ] = [
|
||||
...this.filtreColSelected[col.champ],
|
||||
...col.valeurs,
|
||||
];
|
||||
});
|
||||
this.filtreColModif++;
|
||||
}
|
||||
Tfiltres.forEach((col) => {
|
||||
this.filtreColSelected[col.champ] = [...this.filtreColSelected[col.champ], ...col.valeurs];
|
||||
});
|
||||
this.filtreColModif++;
|
||||
this.ajaxCrayons = false;
|
||||
|
||||
if (parseInt(this._id) > 0) {
|
||||
let _id = parseInt(this._id);
|
||||
|
@ -863,10 +860,12 @@ let monTableau = {
|
|||
const gamuTable = {
|
||||
components: { monTableau },
|
||||
methods: {
|
||||
rechargerJson(id) {
|
||||
rechargerJson(id, ajaxCrayons = true) {
|
||||
this.$refs.montableau.ajaxCrayons = ajaxCrayons;
|
||||
this.$refs.montableau.chargerJson(id);
|
||||
},
|
||||
rechargerJson_deux(id) {
|
||||
rechargerJson_deux(id, ajaxCrayons = true) {
|
||||
this.$refs.montableau.ajaxCrayons = ajaxCrayons;
|
||||
this.$refs.montableau_deux.chargerJson(id);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -297,7 +297,8 @@ var monTableau = {
|
|||
options: [],
|
||||
searchInputHead: '',
|
||||
searchInputVal: '',
|
||||
loadingVueSelect: true
|
||||
loadingVueSelect: true,
|
||||
ajaxCrayons: false
|
||||
};
|
||||
},
|
||||
mounted: function mounted() {
|
||||
|
@ -470,7 +471,9 @@ var monTableau = {
|
|||
});
|
||||
}
|
||||
|
||||
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(ObfiltreSelect));
|
||||
if (!this.ajaxCrayons) {
|
||||
localStorage.setItem('filtreselect_' + this.nameLocalStorage, JSON.stringify(ObfiltreSelect));
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
|
@ -484,11 +487,9 @@ var monTableau = {
|
|||
classes: this.classes,
|
||||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol
|
||||
};
|
||||
|
||||
if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
}
|
||||
}; // if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
// localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
// }
|
||||
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
},
|
||||
|
@ -630,7 +631,6 @@ var monTableau = {
|
|||
_this4.filtreColType = config.filtreCol;
|
||||
_this4.filtreCol = [];
|
||||
Object.keys(_this4.filtreColType).forEach(function (col) {
|
||||
// let Tval = [''];
|
||||
var Tval = [];
|
||||
|
||||
_this4.table.forEach(function (t) {
|
||||
|
@ -653,26 +653,22 @@ var monTableau = {
|
|||
Vue.nextTick(function () {
|
||||
_this4.chargement = false;
|
||||
var filtreselect = localStorage.getItem('filtreselect_' + _this4.nameLocalStorage);
|
||||
console.log(filtreselect);
|
||||
var Tfiltres = [];
|
||||
|
||||
if (filtreselect) {
|
||||
var Tfiltres = JSON.parse(filtreselect);
|
||||
Tfiltres.forEach(function (col) {
|
||||
var v = col.valeurs;
|
||||
_this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(v));
|
||||
});
|
||||
_this4.filtreColModif++;
|
||||
Tfiltres = JSON.parse(filtreselect);
|
||||
} else if (_this4.filtreselect) {
|
||||
var _Tfiltres = recupJson(decodeURIComponent(_this4.filtreselect));
|
||||
|
||||
localStorage.setItem('filtreselect_' + _this4.nameLocalStorage, JSON.stringify(_Tfiltres));
|
||||
|
||||
_Tfiltres.forEach(function (col) {
|
||||
_this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(col.valeurs));
|
||||
});
|
||||
|
||||
_this4.filtreColModif++;
|
||||
Tfiltres = recupJson(decodeURIComponent(_this4.filtreselect));
|
||||
localStorage.setItem('filtreselect_' + _this4.nameLocalStorage, JSON.stringify(Tfiltres));
|
||||
}
|
||||
|
||||
Tfiltres.forEach(function (col) {
|
||||
_this4.filtreColSelected[col.champ] = [].concat(_toConsumableArray(_this4.filtreColSelected[col.champ]), _toConsumableArray(col.valeurs));
|
||||
});
|
||||
_this4.filtreColModif++;
|
||||
_this4.ajaxCrayons = false;
|
||||
|
||||
if (parseInt(_this4._id) > 0) {
|
||||
var _id = parseInt(_this4._id);
|
||||
|
||||
|
@ -843,9 +839,13 @@ var gamuTable = {
|
|||
},
|
||||
methods: {
|
||||
rechargerJson: function rechargerJson(id) {
|
||||
var ajaxCrayons = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
this.$refs.montableau.ajaxCrayons = ajaxCrayons;
|
||||
this.$refs.montableau.chargerJson(id);
|
||||
},
|
||||
rechargerJson_deux: function rechargerJson_deux(id) {
|
||||
var ajaxCrayons = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
this.$refs.montableau.ajaxCrayons = ajaxCrayons;
|
||||
this.$refs.montableau_deux.chargerJson(id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue