perf: #6321 updates

This commit is contained in:
Javier Segarra 2024-05-24 11:54:31 +02:00
parent ceae5eaa9e
commit 1eedb6f79b
6 changed files with 78 additions and 34 deletions

View File

@ -11,6 +11,7 @@ const session = useSession();
const $props = defineProps({
item: {
type: Object,
required: true,
default: () => {},
},
});

View File

@ -40,7 +40,7 @@ const selectedRows = ref([]);
const originalRowDataCopy = ref(null);
const $props = defineProps({
id: {
item: {
type: Number,
required: true,
},
@ -97,7 +97,7 @@ const saveChange = async (field, { rowIndex, row }) => {
console.error('Error saving changes', err);
}
};
const entityId = computed(() => $props.id);
const entityId = computed(() => $props.item.itemFk);
function isComponentVn(col) {
return tableColumnComponents?.value[col.name]?.component === 'span' ?? false;
}
@ -464,11 +464,11 @@ const handleRows = (rows) => {
</template>
<template v-if="col.name === 'ticketFk'"
>{{ col.value }}
<ItemDescriptorProxy :id="$props.id"
<ItemDescriptorProxy :id="$props.entityId"
/></template>
<template v-if="col.name === 'itemFk'"
>{{ col.value }}
<ItemDescriptorProxy :id="$props.id"
<ItemDescriptorProxy :id="$props.entityId"
/></template>
</component>
</template>
@ -498,10 +498,11 @@ const handleRows = (rows) => {
v-model="showSplitDialog"
:tickets="resultSplit"
></HandleSplited>
{{ item }}
<ItemProposal
ref="proposalDialogRef"
@hide="onDialogHide"
v-model="showProposalDialog"
:item="currentRow"
:item="item"
></ItemProposal>
</template>

View File

@ -26,6 +26,8 @@ to.setDate(to.getDate() + 1);
const warehouses = ref();
const categoriesOptions = ref([]);
const itemTypesRef = ref(null);
const itemTypesOptions = ref([]);
const itemTypesFilter = {
fields: ['id', 'name', 'categoryFk'],
include: 'category',
@ -53,10 +55,17 @@ const onCategoryChange = async (categoryFk, search) => {
auto-load
/>
<FetchData
ref="itemTypesRef"
url="ItemTypes"
:filter="itemTypesFilter"
@on-fetch="(data) => (itemTypesOptions = data)"
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`negative.${tag.label}`) }}: </strong>
<strong>{{ t(`negative.${tag.label}`) }}</strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
@ -103,31 +112,62 @@ const onCategoryChange = async (categoryFk, search) => {
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="categoriesOptions">
<VnSelect
:label="t('negative.categoryFk')"
v-model="params.categoryFk"
@update:model-value="
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/> </QItemSection
><QItemSection v-else>
<QSkeleton class="full-width" type="QSelect" />
</QItemSection>
</QItem>
<QCard bordered>
<QItem>
<QItemSection v-if="categoriesOptions">
<VnSelect
:label="t('negative.category')"
v-model="params.categoryFk"
@update:model-value="
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/> </QItemSection
><QItemSection v-else>
<QSkeleton class="full-width" type="QSelect" />
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="itemTypesOptions">
<VnSelect
:label="t('negative.type')"
v-model="params.typeFk"
@update:model-value="searchFn()"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect> </QItemSection
><QItemSection v-else>
<QSkeleton class="full-width" type="QSelect" />
</QItemSection>
</QItem>
</QCard>
<QItem>
<QItemSection v-if="warehouses">
<VnSelect
:label="t('Warehouse')"
:label="t('negative.warehouse')"
v-model="params.warehouse"
@update:model-value="searchFn()"
:options="warehouses"

View File

@ -224,7 +224,7 @@ const handleWarehouses = async (data) => {
<div v-if="currentRow" class="list">
<TicketLackDetail
ref="ticketDetailRef"
:id="currentRow?.itemFk"
:item="currentRow"
@close="(evt) => (currentRow = null)"
></TicketLackDetail>
</div>

View File

@ -8,19 +8,20 @@ negative:
origen: 'Origin'
value: 'Negative'
itemFk: 'Article'
warehouseFk: 'Warehouse'
producer: 'Producer'
category: 'category'
warehouse: 'Warehouse'
warehouseFk: 'Warehouse'
category: 'Category'
categoryFk: 'Family'
warehouse: 'warehouse'
type: 'Type'
typeFk: 'Type'
lack: 'Negative'
inkFk: 'inkFk'
timed: 'timed'
minTimed: 'minTimed'
type: 'Type'
negativeAction: 'Negative'
totalNegative: 'Total negatives'
days: Dias
days: Days
modalOrigin:
title: 'Update negatives'
question: 'Select a state to update'

View File

@ -11,8 +11,9 @@ negative:
value: 'Negativo'
warehouseFk: 'Almacen'
producer: 'Producer'
category: 'Categoria'
category: 'Categoría'
categoryFk: 'Familia'
typeFk: 'Familia'
warehouse: 'Almacen'
lack: 'Negativo'
inkFk: 'Color'