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