From dd1dd14d060c8e5a4b019ff6de43be9c7cd654f4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 5 Sep 2024 11:24:39 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=20=3D=3D>=20=E0=B8=82=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=84=E0=B8=A3=E0=B8=AD=E0=B8=9A?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=B1=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PersonalInformation/04_FamilyNew.vue | 85 ++++++++++--------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue b/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue index 023677173..df1ac2ba4 100644 --- a/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue +++ b/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue @@ -25,6 +25,7 @@ const route = useRoute(); const store = useProfileDataStore(); const { filterSelector } = store; const { + date2Thai, dialogConfirm, showLoader, hideLoader, @@ -47,6 +48,8 @@ const visibleColumns = ref([ "job", "isLive", "lastNameOld", + "lastUpdateFullName", + "lastUpdatedAt", ]); const columns = ref([ { @@ -114,6 +117,25 @@ const columns = ref([ style: "font-size: 14px", format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"), }, + { + name: "lastUpdateFullName", + align: "left", + label: "ผู้ดำเนินการ", + sortable: true, + field: "lastUpdateFullName", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "lastUpdatedAt", + align: "left", + label: "วันที่แก้ไข", + sortable: true, + field: "lastUpdatedAt", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + format: (val) => date2Thai(val), + }, ]); const rows = ref([]); @@ -173,13 +195,12 @@ const fromData = reactive({ * function fetch ข้อมูลบิดา */ async function fetchDataFather() { - showLoader(); await http .get( config.API.profileFamily(empType.value, "father") + `/${profileId.value}` ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; if (data) { fatherData.isLive = data.fatherLive; @@ -192,9 +213,6 @@ async function fetchDataFather() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -202,13 +220,12 @@ async function fetchDataFather() { * function fetch ข้อมูลมารดา */ async function fetchDataMother() { - showLoader(); await http .get( config.API.profileFamily(empType.value, "mother") + `/${profileId.value}` ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; if (data) { motherData.isLive = data.motherLive; motherData.citizenId = data.motherCitizenId; @@ -220,9 +237,6 @@ async function fetchDataMother() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -230,13 +244,12 @@ async function fetchDataMother() { * function fetch ข้อมูลคู่สมรส */ async function fetchDataCouple() { - showLoader(); await http .get( config.API.profileFamily(empType.value, "couple") + `/${profileId.value}` ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; if (data) { coupleData.isLive = data.coupleLive; coupleData.citizenId = data.coupleCitizenId; @@ -250,9 +263,6 @@ async function fetchDataCouple() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -260,21 +270,17 @@ async function fetchDataCouple() { * function fetch ข้อมูลบุตร */ async function fetchDataChildren() { - showLoader(); await http .get( config.API.profileFamily(empType.value, "children") + `/${profileId.value}` ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; childData.value = data; }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -339,6 +345,7 @@ function closeDialog() { fromData.job = ""; fromData.lastNameOld = ""; fromData.statusMarital = ""; + rows.value = []; } /** @@ -412,7 +419,6 @@ function onOpenDialogHistory(type: string, id: string = "") { * function fetch ข้อมูลความสัมพันธ์ */ function fetchDataRelationship() { - // showLoader(); http .get(config.API.orgRelationship) .then((res) => { @@ -424,11 +430,6 @@ function fetchDataRelationship() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - // setTimeout(() => { - // hideLoader(); - // }, 2000); }); } @@ -450,13 +451,13 @@ function filterSelectorRelation(val: any, update: Function) { * @param id * @param type */ -function fetchHistory(id: string, type: string) { - hideLoader(); - http +async function fetchHistory(id: string, type: string) { + showLoader(); + await http .get(config.API.profileFamilyHistory(id, empType.value, type)) - .then((res) => { - const data = res.data.result; - rows.value = data.map((e: any) => ({ + .then(async (res) => { + const data = await res.data.result; + rows.value = await data.map((e: any) => ({ citizenId: e[`${type}CitizenId`], prefix: e[`${type}Prefix`], firstName: e[`${type}FirstName`], @@ -464,6 +465,8 @@ function fetchHistory(id: string, type: string) { job: e[`${type}Career`], isLive: e[`${type}Live`], lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined, + lastUpdateFullName: e.lastUpdateFullName, + lastUpdatedAt: e.lastUpdatedAt, })); }) .catch((err) => { @@ -482,9 +485,13 @@ onMounted(async () => { fetchDataCouple(), fetchDataChildren(), fetchDataRelationship(), - ]).then(() => { - hideLoader(); - }); + ]) + .then(() => { + hideLoader(); + }) + .catch(() => { + hideLoader(); + }); });