fix: 1. Warehouse default
This commit is contained in:
parent
5425902918
commit
7108444a44
|
@ -5,7 +5,8 @@ import { useI18n } from 'vue-i18n';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
const DEFAULT_WAREHOUSE = 'Algemesi';
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
|
@ -17,12 +18,25 @@ const props = defineProps({
|
|||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
||||
const defaultParams = {
|
||||
warehouse: null,
|
||||
};
|
||||
|
||||
const warehouses = ref();
|
||||
|
||||
const handleWarehouses = async (data) => {
|
||||
warehouses.value = data;
|
||||
defaultParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<FetchData url="Warehouses" @on-fetch="handleWarehouses" auto-load />
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:params="defaultParams"
|
||||
:search-button="true"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`ticket.negative.${tag.label}`) }}: </strong>
|
||||
|
@ -33,7 +47,12 @@ const warehouses = ref();
|
|||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput v-model="params.id" :label="t('negative.id')" dense />
|
||||
<VnInput
|
||||
v-model="params.id"
|
||||
:label="t('negative.id')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -42,6 +61,7 @@ const warehouses = ref();
|
|||
v-model="params.producer"
|
||||
:label="t('negative.producer')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -51,6 +71,7 @@ const warehouses = ref();
|
|||
v-model="params.colour"
|
||||
:label="t('negative.colour')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -60,6 +81,7 @@ const warehouses = ref();
|
|||
v-model="params.size"
|
||||
:label="t('negative.size')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -69,6 +91,7 @@ const warehouses = ref();
|
|||
v-model="params.origen"
|
||||
:label="t('negative.origen')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -78,12 +101,13 @@ const warehouses = ref();
|
|||
v-model="params.lack"
|
||||
:label="t('negative.value')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-if="warehouses">
|
||||
<QItemSection>
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('Warehouse')"
|
||||
v-model="params.warehouse"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -92,7 +116,12 @@ const warehouses = ref();
|
|||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
Loading…
Reference in New Issue