forked from verdnatura/salix-front
Handle quantity empty value
This commit is contained in:
parent
3490ba1a8c
commit
b87e88ae7f
|
@ -30,6 +30,10 @@ const crudModelRequiredData = computed(() => ({
|
||||||
ticketFk: route.params.id,
|
ticketFk: route.params.id,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const handleInputQuantityClear = (row) => {
|
||||||
|
if (row.quantity === null || row.quantity === undefined) row.quantity = 0;
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
async () => {
|
async () => {
|
||||||
|
@ -59,7 +63,7 @@ watch(
|
||||||
auto-load
|
auto-load
|
||||||
style="max-width: 800px"
|
style="max-width: 800px"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows, validate }">
|
||||||
<QCard class="q-px-lg q-py-md">
|
<QCard class="q-px-lg q-py-md">
|
||||||
<div
|
<div
|
||||||
v-for="(row, index) in rows"
|
v-for="(row, index) in rows"
|
||||||
|
@ -77,7 +81,9 @@ watch(
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ scope.opt?.name }} </QItemLabel>
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
<QItemLabel caption>
|
<QItemLabel caption>
|
||||||
#{{ scope.opt?.itemFk }}
|
#{{ scope.opt?.itemFk }}
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
@ -87,10 +93,13 @@ watch(
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('package.quantity')"
|
:label="t('package.quantity')"
|
||||||
v-model="row.quantity"
|
v-model.number="row.quantity"
|
||||||
class="col"
|
class="col"
|
||||||
type="number"
|
type="number"
|
||||||
min="1"
|
min="1"
|
||||||
|
:required="true"
|
||||||
|
@update:model-value="handleInputQuantityClear(row)"
|
||||||
|
:rules="validate('TicketPackaging.quantity')"
|
||||||
/>
|
/>
|
||||||
<VnInputDate :label="t('package.added')" v-model="row.created" />
|
<VnInputDate :label="t('package.added')" v-model="row.created" />
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
Loading…
Reference in New Issue