From 48cdac33262726cfc67129c3f9b5cea1370acb24 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 28 Nov 2024 13:25:13 +0700 Subject: [PATCH] updated linkage registry --- .../components/Dialog/DialogUpdate.vue | 73 +++++++++++-------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/src/modules/04_registryPerson/components/Dialog/DialogUpdate.vue b/src/modules/04_registryPerson/components/Dialog/DialogUpdate.vue index f22c6281d..ed9e592e4 100644 --- a/src/modules/04_registryPerson/components/Dialog/DialogUpdate.vue +++ b/src/modules/04_registryPerson/components/Dialog/DialogUpdate.vue @@ -195,11 +195,12 @@ function onSubmit() { } async function amiRequest() { + let profileData: any = {}; const profile = await storeLinkage.amiRequest($q, 5000, idCard.value, "001"); if (profile !== undefined) { - data.value = profile; + profileData = await profile; } else { - data.value = { + profileData = { // titleCode: 3, // titleDesc: "นาย", titleName: "นาย", // use @@ -219,36 +220,42 @@ async function amiRequest() { // age: 45, }; - const address = { - // houseID: 12020203651, - houseNo: "62/25", // use - // houseType: 1, - // houseTypeDesc: "บ้าน", - villageNo: 5, // use - // alleyWayCode: 0, - alleyWayDesc: null, // use - // alleyCode: 0, - alleyDesc: null, // use - // roadCode: 3, - roadDesc: "เทอดพระเกียรติ", // use - // subdistrictCode: 1, - subdistrictDesc: "วัดชลอ", // use - // districtCode: 2, - districtDesc: "บางกรวย", // use - // provinceCode: 12, - provinceDesc: "นนทบุรี", // use - // rcodeCode: "1296", - // rcodeDesc: "ท้องถิ่นเทศบาลเมืองบางกรวย", - // dateOfTerminate: 0, - // alleyWayEnglishDesc: null, - // alleyEnglishDesc: null, - // roadEnglishDesc: "Terdpragied", - // subdistrictEnglishDesc: "Wat Chalo", - // districtEnglishDesc: "Bang Kruai", - // provinceEnglishDesc: "Nonthaburi", - }; + let address: any = {}; + const house = await storeLinkage.amiRequest($q, 5000, idCard.value, "008"); + if (house !== undefined) { + address = await house; + } else { + address = { + // houseID: 12020203651, + houseNo: "62/25", // use + // houseType: 1, + // houseTypeDesc: "บ้าน", + villageNo: 5, // use + // alleyWayCode: 0, + alleyWayDesc: null, // use + // alleyCode: 0, + alleyDesc: null, // use + // roadCode: 3, + roadDesc: "เทอดพระเกียรติ", // use + // subdistrictCode: 1, + subdistrictDesc: "วัดชลอ", // use + // districtCode: 2, + districtDesc: "บางกรวย", // use + // provinceCode: 12, + provinceDesc: "นนทบุรี", // use + // rcodeCode: "1296", + // rcodeDesc: "ท้องถิ่นเทศบาลเมืองบางกรวย", + // dateOfTerminate: 0, + // alleyWayEnglishDesc: null, + // alleyEnglishDesc: null, + // roadEnglishDesc: "Terdpragied", + // subdistrictEnglishDesc: "Wat Chalo", + // districtEnglishDesc: "Bang Kruai", + // provinceEnglishDesc: "Nonthaburi", + }; + } - data.value = { ...data.value, ...address }; + data.value = { ...profileData, ...address }; } formInformations.citizenId = idCard.value; formInformations.prefix = data.value.titleName; @@ -258,7 +265,9 @@ async function amiRequest() { formInformations.nationality = data.value.nationalityDesc; // แปลง dateOfBirth เป็น format 1989-01-01 - formInformations.birthDate = data.value.dateOfBirth ? conventDateOfBirth(`${data.value.dateOfBirth}`) : null; + formInformations.birthDate = data.value.dateOfBirth + ? conventDateOfBirth(`${data.value.dateOfBirth}`) + : null; age.value = storeLinkCenter.calculateAge(data.value.age); formInformations.gender = data.value.genderDesc;