แก้ ลบ วันที่ไม่หาย

This commit is contained in:
setthawutttty 2024-02-20 11:42:11 +07:00
parent 998e654eb4
commit 8acdc13370
3 changed files with 76 additions and 28 deletions

View file

@ -79,6 +79,7 @@
:error="yearInputCheck"
error-message="กรุณากรอก ปี ที่ยื่นขอพระราชทานเครื่องราชฯ"
/>
<datepicker
v-else
menu-class-name="modalfix"
@ -102,7 +103,7 @@
dense
lazy-rules
:borderless="!edit"
:model-value="year + 543"
:model-value="year !== 0 ? (year as number) + 543:null"
:rules="[
(val:string) =>
!!val ||
@ -576,7 +577,7 @@ const OpsFilter = ref<InsigniaOps>({
insigniaOptions: [],
});
const insigniaType = ref<string>();
const year = ref<number>(0);
const year = ref<number|null>(0);
const no = ref<string>();
const issue = ref<string>();
const volumeNo = ref<string>();
@ -1043,6 +1044,7 @@ const fetchData = async () => {
createdAt: e.createdAt,
});
});
console.log(data)
})
.catch((e) => {
messageError($q, e);
@ -1081,7 +1083,7 @@ const getData = () => {
const row = rows.value[rowIndex.value];
insigniaId.value = row.insigniaId;
insigniaType.value = row.insigniaType;
year.value = row.year;
year.value = row.year == null ? null:row.year;
no.value = row.no;
issue.value = row.issue;
volumeNo.value = row.volumeNo;
@ -1093,7 +1095,7 @@ const getData = () => {
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
yearInput.value = (Number(row.year) + 543).toLocaleString();
yearInput.value = row.year !== 0 ? (Number(row.year) + 543).toLocaleString():'';
receiveDateInput.value = row.receiveDate
? convertDateDisplay(row.receiveDate)
: "";
@ -1303,7 +1305,7 @@ const selectData = async (props: DataProps) => {
rowIndex.value = props.rowIndex;
insigniaId.value = props.row.insigniaId;
insigniaType.value = props.row.insigniaType;
year.value = props.row.year;
year.value = props.row.year == 0 ? 0:props.row.year;
no.value = props.row.no;
issue.value = props.row.issue;
volumeNo.value = props.row.volumeNo;
@ -1318,7 +1320,7 @@ const selectData = async (props: DataProps) => {
props.row.refCommandDate == "-" ? null : props.row.refCommandDate;
id.value = props.row.id;
yearInput.value = (Number(props.row.year) + 543).toLocaleString();
yearInput.value = props.row.year !== 0 ? (Number(props.row.year) + 543).toLocaleString():'';
receiveDateInput.value = convertDateDisplay(props.row.receiveDate);
dateAnnounceInput.value = props.row.dateAnnounce
? convertDateDisplay(props.row.dateAnnounce as Date)
@ -1466,6 +1468,9 @@ watch(
dateAnnounceInput.value = "";
}
}
else if (value.length === 0) {
dateAnnounce.value = null;
}
}
);
watch(
@ -1479,6 +1484,9 @@ watch(
refCommandDateInput.value = "";
}
}
else if (value.length === 0) {
refCommandDate.value = null;
}
}
);
@ -1506,6 +1514,9 @@ watch(
yearInputCheck.value = false;
year.value = dateVal;
}
else if (value.length === 0) {
year.value = 0;
}
}
);
</script>