diff --git a/src/components/DialogAddEmployee.vue b/src/components/DialogAddEmployee.vue index 774376e20..9b1188a70 100644 --- a/src/components/DialogAddEmployee.vue +++ b/src/components/DialogAddEmployee.vue @@ -33,13 +33,13 @@ const informaData = ref({ prefixId: null, firstname: null, lastname: null, - birthDate: "", + birthDate: null, genderId: null, bloodId: null, - nationality: "ไทย", - ethnicity: "ไทย", + nationality: null, + ethnicity: null, statusId: null, - religionId: "ceaec498-71b4-4f82-b5a2-7d6ec988b753", + religionId: null, tel: null, employeeType: null, employeeClass: null, @@ -173,23 +173,23 @@ const calRetire = async (birth: Date) => { birthDate: dateToISO(birth), }; if (dateToISO(dateBefore.value) != dateToISO(birth)) { - // showLoader(); + 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(); }); } }; @@ -321,7 +321,6 @@ const fetchPerson = async () => { }); }; - +
{ :label="`${'เบอร์โทร'}`" mask="##########" /> +
diff --git a/src/modules/04_registry/components/Information/Government.vue b/src/modules/04_registry/components/Information/Government.vue index 4997e1f2f..3d9b7f808 100644 --- a/src/modules/04_registry/components/Information/Government.vue +++ b/src/modules/04_registry/components/Information/Government.vue @@ -123,39 +123,7 @@
- - - - - - {{ col.value }} + {{ date2Thai(col.value) }}
{{ col.value }} @@ -409,10 +347,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import HistoryTable from "@/components/TableHistory.vue"; import type { RequestItemsHistoryObject } from "@/modules/04_registry/interface/request/Government"; -import type { - ResponseObject, - RowHistory, -} from "@/modules/04_registry/interface/response/Government"; +import type { ResponseObject } from "@/modules/04_registry/interface/response/Government"; import { useRoute } from "vue-router"; import { useProfileDataStore } from "@/modules/04_registry/store"; import { storeToRefs } from "pinia"; @@ -445,7 +380,7 @@ const { birthDate, retireText } = storeToRefs(profileStore); const edit = ref(false); const govermentData = ref(defaultGoverment); const myform = ref(); -const rowsHistory = ref([]); //select data history +const rowsHistory = ref([]); //select data history const tittleHistory = ref("ประวัติแก้ไขข้อมูลราชการ"); // const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล @@ -698,8 +633,8 @@ const fetchData = async () => { govermentData.value.numberId = data.posNo; govermentData.value.positionExecutive = data.positionExecutive; govermentData.value.positionExecutiveSide = data.positionExecutiveSide; - govermentData.value.containDate = dateToISO(new Date(data.dateAppoint)); - govermentData.value.workDate = dateToISO(new Date(data.dateStart)); + govermentData.value.containDate = data.dateAppoint; + govermentData.value.workDate = data.dateStart; govermentData.value.retireDate = data.retireDate; govermentData.value.absent = data.govAgeAbsent; govermentData.value.age = data.govAgePlus; @@ -724,8 +659,8 @@ const editData = async () => { showLoader(); await http .put(config.API.profileGovId(route.params.id.toString()), { - dateAppoint: dateToISO(new Date(govermentData.value.containDate)), - dateStart: dateToISO(new Date(govermentData.value.workDate)), + dateAppoint: dateToISO(govermentData.value.containDate), + dateStart: dateToISO(govermentData.value.workDate), reasonSameDate: govermentData.value.reasonSameDate, }) .then((res) => { @@ -751,7 +686,7 @@ const saveData = async () => { }; const handleDate = async (modelData: Date) => { - // govermentData.value.containDate = dateToISO(modelData); + govermentData.value.containDate = modelData; await fetchCalAgeGov(modelData); }; @@ -787,24 +722,24 @@ const clickHistory = async () => { rowsHistory.value = []; data.map((e: RequestItemsHistoryObject) => { rowsHistory.value.push({ - oc: e.oc ?? "-", - position: e.position ?? "-", - positionPathSide: e.positionPathSide ?? "-", - posNo: e.posNo ?? "-", - positionLine: e.positionLine ?? "-", - positionType: e.positionType ?? "-", - positionLevel: e.positionLevel ?? "-", - positionExecutive: e.positionExecutive ?? "-", - positionExecutiveSide: e.positionExecutiveSide ?? "-", - dateAppoint: date2Thai(e.dateAppoint) ?? "-", - dateStart: date2Thai(e.dateStart) ?? "-", - retireDate: e.retireDate ?? "-", - govAge: e.govAge ?? "-", - govAgeAbsent: e.govAgeAbsent ?? "-", - govAgePlus: e.govAgePlus ?? "-", - reasonSameDate: e.reasonSameDate ?? "-", - createdFullName: e.createdFullName ?? "-", - createdAt: date2Thai(e.createdAt) ?? "-", + oc: e.oc, + position: e.position, + positionPathSide: e.positionPathSide, + posNo: e.posNo, + positionLine: e.positionLine, + positionType: e.positionType, + positionLevel: e.positionLevel, + positionExecutive: e.positionExecutive, + positionExecutiveSide: e.positionExecutiveSide, + dateAppoint: new Date(e.dateAppoint), + dateStart: new Date(e.dateStart), + retireDate: e.retireDate, + govAge: e.govAge, + govAgeAbsent: e.govAgeAbsent, + govAgePlus: e.govAgePlus, + reasonSameDate: e.reasonSameDate, + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), }); }); }) diff --git a/src/modules/04_registry/components/Information/Information.vue b/src/modules/04_registry/components/Information/Information.vue index 1a30d6c9c..25aa9631f 100644 --- a/src/modules/04_registry/components/Information/Information.vue +++ b/src/modules/04_registry/components/Information/Information.vue @@ -91,32 +91,7 @@ />
- - - { prefixId: null, firstname: null, lastname: null, - birthDate: "", + birthDate: new Date(), genderId: null, bloodId: null, nationality: null, @@ -1002,7 +977,7 @@ const filterSelector = (val: any, update: Function, refData: string) => { }; const handleDate = async (modelData: Date) => { - informaData.value.birthDate = modelData.toDateString(); + informaData.value.birthDate = modelData; await calRetire(modelData); }; @@ -1016,7 +991,7 @@ const calRetire = async (birth: Date) => { birthDate: dateToISO(birth), }; if (dateToISO(dateBefore.value) != dateToISO(birth)) { - // showLoader(); + showLoader(); await http .post(config.API.profileCalRetire, body) .then((res: any) => { @@ -1025,14 +1000,14 @@ const calRetire = async (birth: Date) => { changeRetireText(data.retireDate); dateBefore.value = birth; }) - // .catch((e: any) => { - // messageError($q, e); - // const retire = new Date(`${birth.getFullYear() + 60}-09-30`); - // informaData.value.birthDate = dateBefore.value.toDateString(); - // changeRetireText(date2Thai(retire)); - // }) + .catch((e: any) => { + messageError($q, e); + const retire = new Date(`${birth.getFullYear() + 60}-09-30`); + informaData.value.birthDate = dateBefore.value; + changeRetireText(date2Thai(retire)); + }) .finally(() => { - // hideLoader(); + hideLoader(); }); } }; @@ -1053,7 +1028,7 @@ const fetchData = async () => { : ""; informaData.value.firstname = data.firstName; informaData.value.lastname = data.lastName; - informaData.value.birthDate = dateToISO(new Date(data.birthDate)); + informaData.value.birthDate = new Date(data.birthDate); informaData.value.genderId = data.genderId !== "00000000-0000-0000-0000-000000000000" ? data.genderId @@ -1110,7 +1085,7 @@ const editData = async () => { religionId: informaData.value.religionId, birthDate: informaData.value.birthDate != null - ? dateToISO(new Date(informaData.value.birthDate)) + ? dateToISO(informaData.value.birthDate) : dateToISO(new Date()), bloodGroupId: informaData.value.bloodId, relationshipId: informaData.value.statusId, @@ -1135,11 +1110,7 @@ const editData = async () => { edit.value = false; emit("update:statusEdit", false); await fetchData(); - await changeBirth( - informaData.value.birthDate - ? new Date(informaData.value.birthDate) - : new Date() - ); + await changeBirth(informaData.value.birthDate ?? new Date()); }); }; diff --git a/src/modules/04_registry/components/profileType.ts b/src/modules/04_registry/components/profileType.ts index b8c83df11..4126189c2 100644 --- a/src/modules/04_registry/components/profileType.ts +++ b/src/modules/04_registry/components/profileType.ts @@ -14,7 +14,7 @@ interface Information { prefixId: string | null; firstname: string | null; lastname: string | null; - birthDate: string | null; + birthDate: Date | null; genderId: string | null; bloodId: string | null; nationality: string | null; @@ -78,8 +78,8 @@ interface Goverment { numberId: string | null; positionExecutive: string | null; positionExecutiveSide: string | null; - containDate: string; - workDate: string; + containDate: Date; + workDate: Date; retireDate: string | null; absent: number | null; age: number | null; @@ -118,8 +118,8 @@ const defaultGoverment: Goverment = { numberId: null, positionExecutive: null, positionExecutiveSide: null, - containDate: "", - workDate: "", + containDate: new Date(), + workDate: new Date(), retireDate: null, absent: 0, age: 0, @@ -217,5 +217,5 @@ export type { DataOption, zipCodeOption, DataOptioninfo, - docList, + docList };