refs #5056 refresh list when delete
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-03-23 10:34:22 +01:00
parent 8877f97e93
commit a92bc8c713
4 changed files with 33 additions and 12 deletions

View File

@ -401,13 +401,14 @@ export default {
submit: 'Submit',
reset: 'Reset',
trayColor: 'Tray color',
removeItem: 'Wagon type removed successfully',
},
list: {
plate: 'Plate',
volume: 'Volume',
type: 'Type',
remove: 'Remove'
remove: 'Remove',
removeItem: 'Wagon removed successfully',
},
create: {
plate: 'Plate',

View File

@ -401,12 +401,14 @@ export default {
submit: 'Guardar',
reset: 'Deshacer cambios',
trayColor: 'Color de la bandeja',
removeItem: 'Tipo de vagón borrado correctamente',
},
list: {
plate: 'Matrícula',
volume: 'Volumen',
type: 'Tipo',
remove: 'Borrar'
remove: 'Borrar',
removeItem: 'Vagón borrado correctamente',
},
create: {
plate: 'Matrícula',

View File

@ -1,9 +1,15 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import Paginate from 'src/components/PaginateData.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
const quasar = useQuasar();
const arrayData = useArrayData('WagonTypeList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
@ -15,13 +21,17 @@ function create() {
router.push({ path: `/wagon/type/create` });
}
async function remove(id) {
async function remove(row) {
try {
const id = row.id;
await axios
.delete(`WagonTypes/deleteWagonType`, { params: { id } })
.then(async () => {
// TODO: RELOAD PAGE
// router.push({ path: `/wagon/type/list` });
quasar.notify({
message: t('wagon.type.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
});
} catch (error) {
//
@ -67,7 +77,7 @@ async function remove(id) {
round
color="primary"
icon="delete"
@click="remove(row.id)"
@click="remove(row)"
>
<q-tooltip>
{{ t('wagon.list.remove') }}

View File

@ -1,9 +1,14 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import Paginate from 'src/components/PaginateData.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
const quasar = useQuasar();
const arrayData = useArrayData('WagonList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
@ -24,11 +29,14 @@ function create() {
router.push({ path: `/wagon/create` });
}
async function remove(id) {
async function remove(row) {
try {
await axios.delete(`Wagons/${id}`).then(async () => {
// TODO: RELOAD PAGE
// router.push({ path: `/wagon/list` });
await axios.delete(`Wagons/${row.id}`).then(async () => {
quasar.notify({
message: t('wagon.list.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
});
} catch (error) {
//
@ -103,7 +111,7 @@ async function remove(id) {
round
color="primary"
icon="delete"
@click="remove(row.id)"
@click="remove(row)"
>
<q-tooltip>
{{ t('wagon.list.remove') }}