feat: ajout de la suppression des lignes
This commit is contained in:
parent
b90a3273a5
commit
e54a7f7bde
2 changed files with 39 additions and 21 deletions
|
@ -705,6 +705,16 @@ function filtrerCol(filtreColRecup) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function supprimer_ligne(config) {
|
||||||
|
if (config.a_supprimer) {
|
||||||
|
config.a_supprimer.forEach((id) => {
|
||||||
|
let i = trouver_index(table.value, id);
|
||||||
|
if (i !== -1) {
|
||||||
|
table.value.splice(i, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
function chargerJson(id) {
|
function chargerJson(id) {
|
||||||
console.log("chargerJson pour ", id);
|
console.log("chargerJson pour ", id);
|
||||||
chargement.value = true;
|
chargement.value = true;
|
||||||
|
@ -744,6 +754,7 @@ function chargerJson(id) {
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
let config = data.shift();
|
let config = data.shift();
|
||||||
|
supprimer_ligne(config);
|
||||||
let filtreColRecup = gererConfig(config);
|
let filtreColRecup = gererConfig(config);
|
||||||
gererData(data, id);
|
gererData(data, id);
|
||||||
filtrerCol(filtreColRecup);
|
filtrerCol(filtreColRecup);
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
// https://vitejs.dev/config/#build-polyfillmodulepreload
|
// https://vitejs.dev/config/#build-polyfillmodulepreload
|
||||||
import 'vite/modulepreload-polyfill';
|
import "vite/modulepreload-polyfill";
|
||||||
|
|
||||||
// Vue
|
// Vue
|
||||||
import { createApp } from 'vue';
|
import { createApp } from "vue";
|
||||||
|
|
||||||
// if importing all is too much you can always do it manually
|
// if importing all is too much you can always do it manually
|
||||||
import GamuTable from './components/gamuTable.vue';
|
import GamuTable from "./components/gamuTable.vue";
|
||||||
import VuePapaParse from 'vue-papa-parse';
|
import VuePapaParse from "vue-papa-parse";
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
GamuTable,
|
GamuTable,
|
||||||
};
|
};
|
||||||
|
|
||||||
let i = 1;
|
let i = 1;
|
||||||
for (const el of document.getElementsByClassName('vue-gamutable')) {
|
for (const el of document.getElementsByClassName("vue-gamutable")) {
|
||||||
if (i === 1) {
|
if (i === 1) {
|
||||||
window.app = createApp({
|
window.app = createApp({
|
||||||
components,
|
components,
|
||||||
|
@ -22,55 +22,62 @@ for (const el of document.getElementsByClassName('vue-gamutable')) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
app.use(VuePapaParse);
|
app.use(VuePapaParse);
|
||||||
app.provide('$papa', app.config.globalProperties.$papa);
|
app.provide("$papa", app.config.globalProperties.$papa);
|
||||||
app.mount(el);
|
app.mount(el);
|
||||||
} else if (i === 2) {
|
} else if (i === 2) {
|
||||||
window.app_deux = createApp({
|
window.app_deux = createApp({
|
||||||
components,
|
components,
|
||||||
mounted() {
|
mounted() {
|
||||||
app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson;
|
app_deux.rechargerJson =
|
||||||
|
this.$refs.montableau_deux.rechargerJson;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
app_deux.use(VuePapaParse);
|
app_deux.use(VuePapaParse);
|
||||||
app_deux.provide('$papa', app_deux.config.globalProperties.$papa);
|
app_deux.provide("$papa", app_deux.config.globalProperties.$papa);
|
||||||
app_deux.mount(el);
|
app_deux.mount(el);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#vueGamutable').on('click', '.url_action', function (e) {
|
$("#vueGamutable").on("click", ".url_action", function (e) {
|
||||||
console.log('coucou');
|
console.log("coucou");
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let confirmation = $(this).data('confirm');
|
let confirmation = $(this).data("confirm");
|
||||||
if (confirmation !== undefined) {
|
if (confirmation !== undefined) {
|
||||||
if (!confirm(confirmation)) {
|
if (!confirm(confirmation)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let url = $(this).attr('href');
|
let url = $(this).attr("href");
|
||||||
let id = $(this).data('id');
|
let id = $(this).data("id");
|
||||||
// passer en refresh animé une éventuelle icone
|
// passer en refresh animé une éventuelle icone
|
||||||
if ($(this).has('i.icon, i.fa')) {
|
if ($(this).has("i.icon, i.fa")) {
|
||||||
$(this).find('i.icon, i.fa').eq(0).replaceWith('<i class="fa fa-refresh fa-spin"></i>');
|
$(this)
|
||||||
|
.find("i.icon, i.fa")
|
||||||
|
.eq(0)
|
||||||
|
.replaceWith('<i class="fa fa-refresh fa-spin"></i>');
|
||||||
}
|
}
|
||||||
let nomBlocAjaxReload = $(this).data('ajaxreload');
|
let nomBlocAjaxReload = $(this).data("ajaxreload");
|
||||||
console.time('Chargement de VueJs APRES Ajax');
|
console.time("Chargement de VueJs APRES Ajax");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: 'json',
|
dataType: "json",
|
||||||
async: true,
|
async: true,
|
||||||
}).done(function (retour) {
|
}).done(function (retour) {
|
||||||
if (!$.isEmptyObject(retour) && !$.isEmptyObject(retour.message_erreur)) {
|
if (
|
||||||
|
!$.isEmptyObject(retour) &&
|
||||||
|
!$.isEmptyObject(retour.message_erreur)
|
||||||
|
) {
|
||||||
alert(retour.message_erreur);
|
alert(retour.message_erreur);
|
||||||
} else {
|
} else {
|
||||||
if (parseInt(id) > 0) {
|
if (parseInt(id) > 0) {
|
||||||
app.rechargerJson(id);
|
app.rechargerJson(id);
|
||||||
} else {
|
} else {
|
||||||
app.rechargerJson();
|
app.rechargerJson("maj");
|
||||||
}
|
}
|
||||||
if (nomBlocAjaxReload !== undefined) {
|
if (nomBlocAjaxReload !== undefined) {
|
||||||
console.log('depart reload: ' + nomBlocAjaxReload);
|
console.log("depart reload: " + nomBlocAjaxReload);
|
||||||
ajaxReload(nomBlocAjaxReload, {
|
ajaxReload(nomBlocAjaxReload, {
|
||||||
args: { id },
|
args: { id },
|
||||||
callback: function () {},
|
callback: function () {},
|
||||||
|
|
Loading…
Add table
Reference in a new issue