no message
This commit is contained in:
parent
335d500e11
commit
84d61cbb6d
1 changed files with 53 additions and 36 deletions
|
|
@ -21,6 +21,8 @@ const {
|
|||
dateToISO,
|
||||
dialogConfirm,
|
||||
success,
|
||||
dateToPost,
|
||||
dateToDisplay,
|
||||
} = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
|
||||
|
|
@ -33,13 +35,13 @@ const informaData = ref<any>({
|
|||
prefixId: null,
|
||||
firstname: null,
|
||||
lastname: null,
|
||||
birthDate: null,
|
||||
birthDate: "",
|
||||
genderId: null,
|
||||
bloodId: null,
|
||||
nationality: null,
|
||||
ethnicity: null,
|
||||
nationality: "ไทย",
|
||||
ethnicity: "ไทย",
|
||||
statusId: null,
|
||||
religionId: null,
|
||||
religionId: "ceaec498-71b4-4f82-b5a2-7d6ec988b753",
|
||||
tel: null,
|
||||
employeeType: null,
|
||||
employeeClass: null,
|
||||
|
|
@ -170,26 +172,26 @@ const calculateMaxDate = () => {
|
|||
// เช็คเรื่องการเกษียณ
|
||||
const calRetire = async (birth: Date) => {
|
||||
const body = {
|
||||
birthDate: dateToISO(birth),
|
||||
birthDate: dateToPost(birth),
|
||||
};
|
||||
if (dateToISO(dateBefore.value) != dateToISO(birth)) {
|
||||
showLoader();
|
||||
if (dateToISO(dateBefore.value) > dateToPost(birth)) {
|
||||
// showLoader();
|
||||
await http
|
||||
.post(config.API.profileCalRetire, body)
|
||||
.then((res: any) => {
|
||||
const data = res.data.result;
|
||||
informaData.value.age = data.age;
|
||||
informaData.value.birthDate = birth;
|
||||
// informaData.value.birthDate = birth;
|
||||
changeRetireText(data.retireDate);
|
||||
dateBefore.value = birth;
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
informaData.value.birthDate = null;
|
||||
informaData.value.age = "";
|
||||
})
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// informaData.value.birthDate = null;
|
||||
// informaData.value.age = "";
|
||||
// })
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
// hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -242,20 +244,24 @@ const addData = async () => {
|
|||
if (informaData.value.employeeClass != undefined)
|
||||
formData.append("employeeClass", informaData.value.employeeClass);
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.createProfileOfficer(), formData)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
modal.value = false;
|
||||
await changeBirth(informaData.value.birthDate ?? new Date());
|
||||
hideLoader();
|
||||
});
|
||||
console.log("informaData===>", informaData.value);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .post(config.API.createProfileOfficer(), formData)
|
||||
// .then((res) => {
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// modal.value = false;
|
||||
// await changeBirth(
|
||||
// new Date(dateToPost(new Date(informaData.value.birthDate))) ??
|
||||
// new Date()
|
||||
// );
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/*** get รายการข้อมูลเกี่ยวกับบุคคล (dropdown list) */
|
||||
|
|
@ -321,6 +327,7 @@ const fetchPerson = async () => {
|
|||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="modal">
|
||||
<q-card style="min-width: 60vw">
|
||||
|
|
@ -403,6 +410,22 @@ const fetchPerson = async () => {
|
|||
</div>
|
||||
<div class="row col-12 q-col-gutter-x-sm q-mb-xs">
|
||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
||||
<!-- เปลี่ยนเป็นเลือกปฏิทิน -->
|
||||
<!-- <q-input
|
||||
v-model="informaData.birthDate"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
|
||||
:label="`${'วัน/เดือน/ปี เกิด'}`"
|
||||
type="date"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
@update:model-value="
|
||||
(val:any) => {
|
||||
calRetire(new Date(val));
|
||||
}
|
||||
"
|
||||
/> -->
|
||||
<datepicker
|
||||
v-model="informaData.birthDate"
|
||||
:locale="'th'"
|
||||
|
|
@ -418,8 +441,8 @@ const fetchPerson = async () => {
|
|||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
<template #trigger
|
||||
><q-input
|
||||
for="#birthDate"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
|
|
@ -578,12 +601,6 @@ const fetchPerson = async () => {
|
|||
:label="`${'เบอร์โทร'}`"
|
||||
mask="##########"
|
||||
/>
|
||||
<!-- :rules="[
|
||||
(val: string) => !!val || `${'กรุณากรอก เบอร์โทร'}`,
|
||||
(val: string) =>
|
||||
val.length >= 10 ||
|
||||
`${'กรุณากรอกเบอร์โทรให้ครบ'}`,
|
||||
]" -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue