refactor: handle expire date
This commit is contained in:
parent
43ec668dce
commit
71b5123f25
1 changed files with 16 additions and 1 deletions
|
|
@ -424,7 +424,6 @@ watch(
|
|||
:id="`${prefixId}-input-citizen-issue`"
|
||||
:readonly="readonly"
|
||||
:label="$t('personnel.form.citizenIssue')"
|
||||
:disabled-dates="disabledAfterToday"
|
||||
:rules="[
|
||||
(val: string) =>
|
||||
!!val ||
|
||||
|
|
@ -432,6 +431,17 @@ watch(
|
|||
field: $t('personnel.form.citizenIssue'),
|
||||
}),
|
||||
]"
|
||||
@update:model-value="
|
||||
(v) => {
|
||||
if (!v) return;
|
||||
if (!citizenExpire) return;
|
||||
if (new Date(v).getTime() >= new Date(citizenExpire).getTime()) {
|
||||
const newValue = new Date(v);
|
||||
newValue.setDate(newValue.getDate() + 1);
|
||||
citizenExpire = newValue;
|
||||
}
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
||||
<DatePicker
|
||||
|
|
@ -441,6 +451,11 @@ watch(
|
|||
:id="`${prefixId}-input-citizen-expire`"
|
||||
:readonly="readonly"
|
||||
:label="$t('personnel.form.citizenExpire')"
|
||||
:disabled-dates="
|
||||
(date: Date) =>
|
||||
date.getTime() <
|
||||
((citizenIssue && new Date(citizenIssue).getTime()) || Date.now())
|
||||
"
|
||||
/>
|
||||
|
||||
<q-select
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue