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({ const $props = defineProps({
item: { item: {
type: Object, type: Object,
required: true,
default: () => {}, default: () => {},
}, },
}); });

View File

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

View File

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

View File

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

View File

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

View File

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