feat : suite refactoring
This commit is contained in:
parent
910cf503d8
commit
778f9a2c44
3 changed files with 297 additions and 339 deletions
|
@ -123,7 +123,7 @@ th .vue-select {
|
||||||
background-color: rgba(179, 209, 67, 0.27);
|
background-color: rgba(179, 209, 67, 0.27);
|
||||||
}
|
}
|
||||||
|
|
||||||
#app .select {
|
.vue-gamutable .select {
|
||||||
background-color: rgba(179, 209, 67, 0.47);
|
background-color: rgba(179, 209, 67, 0.47);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
includespip="#ENV{includespip}"
|
includespip="#ENV{includespip}"
|
||||||
ref="montableau"
|
ref="montableau"
|
||||||
filtrer="#ENV{filtrer}"
|
filtrer="#ENV{filtrer}"
|
||||||
_id="#ENV{_id}"
|
:_id="[(#ENV{_id}|intval)]"
|
||||||
filtreselect="[(#ENV{filtrerselect})]"
|
filtreselect="[(#ENV{filtrerselect})]"
|
||||||
></gamu-table>
|
></gamu-table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
includespip="#ENV{includespip}"
|
includespip="#ENV{includespip}"
|
||||||
ref="montableau_deux"
|
ref="montableau_deux"
|
||||||
filtrer="#ENV{filtrer}"
|
filtrer="#ENV{filtrer}"
|
||||||
_id="#ENV{_id}"
|
:_id="[(#ENV{_id}|intval)]"
|
||||||
filtreselect="[(#ENV{filtrerselect_deux})]"
|
filtreselect="[(#ENV{filtrerselect_deux})]"
|
||||||
></gamu-table>
|
></gamu-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -653,84 +653,8 @@ function gererConfig(config) {
|
||||||
}
|
}
|
||||||
return filtreCol;
|
return filtreCol;
|
||||||
}
|
}
|
||||||
function chargerJson(id) {
|
|
||||||
console.log("chargerJson pour ", id);
|
function gererData(filtreColRecup, data, id = null) {
|
||||||
chargement.value = true;
|
|
||||||
let url = props.apiuri;
|
|
||||||
if (parseInt(id) > 0) {
|
|
||||||
url += "&id=" + id;
|
|
||||||
} else if (id === "maj") {
|
|
||||||
url += "&maj=" + maj.value;
|
|
||||||
} else {
|
|
||||||
let config = localStorage.getItem("header_" + nameLocalStorage.value);
|
|
||||||
config = recupJson(config);
|
|
||||||
if (config && config.header !== undefined) {
|
|
||||||
let filtreColRecup = gererConfig(config);
|
|
||||||
localforage
|
|
||||||
.getItem(nameLocalStorage.value)
|
|
||||||
.then(function (data) {
|
|
||||||
data = recupJson(data);
|
|
||||||
if (data && data.length) {
|
|
||||||
table.value = data;
|
|
||||||
if (data[0].search) {
|
|
||||||
champ_search.value = "search";
|
|
||||||
}
|
|
||||||
if (filtreColRecup !== undefined) {
|
|
||||||
filtreColType.value = filtreColRecup;
|
|
||||||
Object.keys(filtreColType.value).forEach((col) => {
|
|
||||||
let Tval = [];
|
|
||||||
// let Tval = [''];
|
|
||||||
table.value.forEach((t) => {
|
|
||||||
let valCol = t[champ_search.value][col];
|
|
||||||
if (Tval.indexOf(valCol) === -1) {
|
|
||||||
Tval.push(valCol);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// filtreCol.value.push(col);
|
|
||||||
filtreColVal.value[col] = Tval.sort();
|
|
||||||
filtreColSelected.value[col] = [];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (props.nomblocajaxreload) {
|
|
||||||
ajaxReload(props.nomblocajaxreload);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function (err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fetch(url)
|
|
||||||
.then((response) => response.json())
|
|
||||||
.then((data) => {
|
|
||||||
let config = data.shift();
|
|
||||||
let filtreColRecup = gererConfig(config);
|
|
||||||
// header.value = config.header;
|
|
||||||
// if (config.maj !== undefined) {
|
|
||||||
// maj.value = config.maj?.lastMAJ;
|
|
||||||
// }
|
|
||||||
// if (config.crayons !== undefined) {
|
|
||||||
// crayons.value = config.crayons;
|
|
||||||
// } else {
|
|
||||||
// crayons.value = [];
|
|
||||||
// }
|
|
||||||
// if (config.classes !== undefined) {
|
|
||||||
// classes.value = config.classes;
|
|
||||||
// } else {
|
|
||||||
// classes.value = [];
|
|
||||||
// }
|
|
||||||
// if (config.checkbox !== undefined) {
|
|
||||||
// checkbox.value = config.checkbox;
|
|
||||||
// Object.keys(checkbox.value).forEach((head) => {
|
|
||||||
// Tcheckbox.value[head] = [];
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// if (config.ordreCol !== undefined) {
|
|
||||||
// ordreCol.value = config.ordreCol;
|
|
||||||
// } else {
|
|
||||||
// ordreCol.value = [];
|
|
||||||
// }
|
|
||||||
if (parseInt(id) > 0) {
|
if (parseInt(id) > 0) {
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
let i = trouver_index(table.value, id);
|
let i = trouver_index(table.value, id);
|
||||||
|
@ -767,6 +691,40 @@ function chargerJson(id) {
|
||||||
filtreColSelected.value[col] = [];
|
filtreColSelected.value[col] = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
function chargerJson(id) {
|
||||||
|
console.log("chargerJson pour ", id);
|
||||||
|
chargement.value = true;
|
||||||
|
let url = props.apiuri;
|
||||||
|
if (parseInt(id) > 0) {
|
||||||
|
url += "&id=" + id;
|
||||||
|
} else if (id === "maj") {
|
||||||
|
url += "&maj=" + maj.value;
|
||||||
|
} else {
|
||||||
|
let config = localStorage.getItem("header_" + nameLocalStorage.value);
|
||||||
|
config = recupJson(config);
|
||||||
|
if (config && config.header !== undefined) {
|
||||||
|
let filtreColRecup = gererConfig(config);
|
||||||
|
localforage
|
||||||
|
.getItem(nameLocalStorage.value)
|
||||||
|
.then(function (data) {
|
||||||
|
data = recupJson(data);
|
||||||
|
gererData(filtreColRecup, data, id);
|
||||||
|
if (props.nomblocajaxreload) {
|
||||||
|
ajaxReload(props.nomblocajaxreload);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fetch(url)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
let config = data.shift();
|
||||||
|
let filtreColRecup = gererConfig(config);
|
||||||
|
gererData(filtreColRecup, data, id);
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
chargement.value = false;
|
chargement.value = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue