Implement shelving logs
This commit is contained in:
parent
babaf47653
commit
524e89319e
|
@ -19,6 +19,18 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
mapper: {
|
||||||
|
type: Function,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
filter: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
|
@ -65,17 +77,18 @@ function actionColor(action) {
|
||||||
<template>
|
<template>
|
||||||
<div class="column items-center">
|
<div class="column items-center">
|
||||||
<QTimeline class="q-pa-md">
|
<QTimeline class="q-pa-md">
|
||||||
<QTimelineEntry heading tag="h4"> {{ t('Audit logs') }} </QTimelineEntry>
|
<QTimelineEntry heading tag="h4"> {{ t('Audit logs') }}</QTimelineEntry>
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:data-key="`${props.model}Logs`"
|
:data-key="`${props.model}Logs`"
|
||||||
:url="`${props.model}s/${route.params.id}/logs`"
|
:url="props.url ?? `${props.model}s/${route.params.id}/logs`"
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:offset="100"
|
:offset="100"
|
||||||
:limit="5"
|
:limit="5"
|
||||||
|
:filter="props.filter"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<template v-for="log of rows" :key="log.id">
|
<template v-for="log of (props.mapper ? (rows || []).map(props.mapper) :rows)" :key="log.id">
|
||||||
<QTimelineEntry
|
<QTimelineEntry
|
||||||
:avatar="`/api/Images/user/160x160/${log.userFk}/download?access_token=${token}`"
|
:avatar="`/api/Images/user/160x160/${log.userFk}/download?access_token=${token}`"
|
||||||
>
|
>
|
||||||
|
@ -144,65 +157,67 @@ function actionColor(action) {
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
actions:
|
actions:
|
||||||
insert: Creates
|
insert: Creates
|
||||||
update: Updates
|
update: Updates
|
||||||
delete: Deletes
|
delete: Deletes
|
||||||
models:
|
models:
|
||||||
Claim: Claim
|
Claim: Claim
|
||||||
ClaimDms: Document
|
ClaimDms: Document
|
||||||
ClaimBeginning: Claimed Sales
|
ClaimBeginning: Claimed Sales
|
||||||
ClaimObservation: Observation
|
ClaimObservation: Observation
|
||||||
properties:
|
Shelving: Shelving
|
||||||
id: ID
|
properties:
|
||||||
claimFk: Claim ID
|
id: ID
|
||||||
saleFk: Sale ID
|
claimFk: Claim ID
|
||||||
quantity: Quantity
|
saleFk: Sale ID
|
||||||
observation: Observation
|
quantity: Quantity
|
||||||
ticketCreated: Created
|
observation: Observation
|
||||||
created: Created
|
ticketCreated: Created
|
||||||
isChargedToMana: Charged to mana
|
created: Created
|
||||||
hasToPickUp: Has to pick Up
|
isChargedToMana: Charged to mana
|
||||||
dmsFk: Document ID
|
hasToPickUp: Has to pick Up
|
||||||
text: Description
|
dmsFk: Document ID
|
||||||
claimStateFk: Claim State
|
text: Description
|
||||||
workerFk: Worker
|
claimStateFk: Claim State
|
||||||
clientFk: Customer
|
workerFk: Worker
|
||||||
rma: RMA
|
clientFk: Customer
|
||||||
responsibility: Responsibility
|
rma: RMA
|
||||||
packages: Packages
|
responsibility: Responsibility
|
||||||
|
packages: Packages
|
||||||
es:
|
es:
|
||||||
Audit logs: Registros de auditoría
|
Audit logs: Registros de auditoría
|
||||||
Property: Propiedad
|
Property: Propiedad
|
||||||
Before: Antes
|
Before: Antes
|
||||||
After: Después
|
After: Después
|
||||||
Yes: Si
|
Yes: Si
|
||||||
Nothing: Nada
|
Nothing: Nada
|
||||||
actions:
|
actions:
|
||||||
insert: Crea
|
insert: Crea
|
||||||
update: Actualiza
|
update: Actualiza
|
||||||
delete: Elimina
|
delete: Elimina
|
||||||
models:
|
models:
|
||||||
Claim: Reclamación
|
Claim: Reclamación
|
||||||
ClaimDms: Documento
|
ClaimDms: Documento
|
||||||
ClaimBeginning: Línea reclamada
|
ClaimBeginning: Línea reclamada
|
||||||
ClaimObservation: Observación
|
ClaimObservation: Observación
|
||||||
properties:
|
Shelving: Carro
|
||||||
id: ID
|
properties:
|
||||||
claimFk: ID reclamación
|
id: ID
|
||||||
saleFk: ID linea de venta
|
claimFk: ID reclamación
|
||||||
quantity: Cantidad
|
saleFk: ID linea de venta
|
||||||
observation: Observación
|
quantity: Cantidad
|
||||||
ticketCreated: Creado
|
observation: Observación
|
||||||
created: Creado
|
ticketCreated: Creado
|
||||||
isChargedToMana: Cargado a maná
|
created: Creado
|
||||||
hasToPickUp: Se debe recoger
|
isChargedToMana: Cargado a maná
|
||||||
dmsFk: ID documento
|
hasToPickUp: Se debe recoger
|
||||||
text: Descripción
|
dmsFk: ID documento
|
||||||
claimStateFk: Estado de la reclamación
|
text: Descripción
|
||||||
workerFk: Trabajador
|
claimStateFk: Estado de la reclamación
|
||||||
clientFk: Cliente
|
workerFk: Trabajador
|
||||||
rma: RMA
|
clientFk: Cliente
|
||||||
responsibility: Responsabilidad
|
rma: RMA
|
||||||
packages: Bultos
|
responsibility: Responsabilidad
|
||||||
|
packages: Bultos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -149,13 +149,13 @@ export function useArrayData(key, userOptions) {
|
||||||
return { filter, params };
|
return { filter, params };
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizerParams(params) {
|
function sanitizerParams(params, exprBuilder) {
|
||||||
for (const param in params) {
|
for (const param in params) {
|
||||||
if (params[param] === '' || params[param] === null) {
|
if (params[param] === '' || params[param] === null) {
|
||||||
delete store.userParams[param];
|
delete store.userParams[param];
|
||||||
delete params[param];
|
delete params[param];
|
||||||
if (store.filter?.where) {
|
if (store.filter?.where) {
|
||||||
delete store.filter.where[Object.keys(store?.exprBuilder(param))[0]];
|
delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]];
|
||||||
if (Object.keys(store.filter.where).length === 0) {
|
if (Object.keys(store.filter.where).length === 0) {
|
||||||
delete store.filter.where;
|
delete store.filter.where;
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,6 +437,7 @@ export default {
|
||||||
create: 'Create',
|
create: 'Create',
|
||||||
summary: 'Summary',
|
summary: 'Summary',
|
||||||
basicData: 'Basic Data',
|
basicData: 'Basic Data',
|
||||||
|
log: 'Logs'
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
parking: 'Parking',
|
parking: 'Parking',
|
||||||
|
|
|
@ -439,6 +439,7 @@ export default {
|
||||||
create: 'Crear',
|
create: 'Crear',
|
||||||
summary: 'Resumen',
|
summary: 'Resumen',
|
||||||
basicData: 'Datos básicos',
|
basicData: 'Datos básicos',
|
||||||
|
log: 'Registros de auditoría'
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
parking: 'Parking',
|
parking: 'Parking',
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<script setup>
|
||||||
|
import VnLog from 'src/components/common/VnLog.vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const getChanges = (oldInstance, newInstance) => {
|
||||||
|
const changes = [];
|
||||||
|
Object.entries(newInstance).forEach(([key, newValue]) => {
|
||||||
|
const oldValue = oldInstance?.[key];
|
||||||
|
if (oldValue !== newValue) {
|
||||||
|
changes.push({
|
||||||
|
property: key,
|
||||||
|
before: oldValue,
|
||||||
|
after: newValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return changes;
|
||||||
|
};
|
||||||
|
|
||||||
|
const shelvingMapper = (shelving) => ({
|
||||||
|
...shelving,
|
||||||
|
action: shelving.action,
|
||||||
|
created: shelving.creationDate,
|
||||||
|
model: shelving.changedModel,
|
||||||
|
userFk: shelving.userFk,
|
||||||
|
userName: shelving.user?.name,
|
||||||
|
changes: getChanges(shelving.oldInstance, shelving.newInstance),
|
||||||
|
});
|
||||||
|
|
||||||
|
const shelvingFilter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['nickname', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
where: {
|
||||||
|
originFk: route.params.id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnLog
|
||||||
|
model="Shelving"
|
||||||
|
url="/ShelvingLogs"
|
||||||
|
:mapper="shelvingMapper"
|
||||||
|
:filter="shelvingFilter"
|
||||||
|
></VnLog>
|
||||||
|
</template>
|
|
@ -11,7 +11,7 @@ export default {
|
||||||
redirect: { name: 'ShelvingMain' },
|
redirect: { name: 'ShelvingMain' },
|
||||||
menus: {
|
menus: {
|
||||||
main: ['ShelvingList'],
|
main: ['ShelvingList'],
|
||||||
card: ['ShelvingBasicData']
|
card: ['ShelvingBasicData', 'ShelvingLog']
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('pages/Shelving/ShelvingBasicData.vue'),
|
component: () => import('pages/Shelving/ShelvingBasicData.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ShelvingLog',
|
||||||
|
path: 'log',
|
||||||
|
meta: {
|
||||||
|
title: 'log',
|
||||||
|
icon: 'history',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Shelving/Card/ShelvingLog.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue