refactor: dueDate set rules
This commit is contained in:
parent
ae21dc7ad7
commit
fa5a99d90f
2 changed files with 17 additions and 1 deletions
|
|
@ -119,7 +119,7 @@ const currentFormData = ref<DebitNotePayload>({
|
|||
payBillDate: new Date(),
|
||||
paySplitCount: 0,
|
||||
payCondition: PayCondition.Full,
|
||||
dueDate: new Date(),
|
||||
dueDate: new Date(Date.now() + 86400000),
|
||||
discount: 0,
|
||||
status: 'CREATED',
|
||||
remark: '#[quotation-labor]<br/><br/>#[quotation-payment]',
|
||||
|
|
|
|||
|
|
@ -69,6 +69,22 @@ const quotationCreatedBy = defineModel<string>('quotationCreatedBy');
|
|||
if (typeof v === 'string') dueDate = v;
|
||||
}
|
||||
"
|
||||
:rules="[
|
||||
() => {
|
||||
if (!dueDate) return $t('form.error.required');
|
||||
|
||||
const currentDate = new Date(dueDate);
|
||||
const toDate = new Date();
|
||||
if (
|
||||
!readonly &&
|
||||
(currentDate.getTime() === toDate.getTime() ||
|
||||
currentDate.getTime() < toDate.getTime())
|
||||
)
|
||||
return $t('quotation.validateDueDate');
|
||||
return true;
|
||||
},
|
||||
]"
|
||||
:disabled-dates="(date: Date) => date.getTime() <= Date.now()"
|
||||
:readonly
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue