แยก dialog
This commit is contained in:
parent
e0a2a2bc35
commit
17d1cc19c8
8 changed files with 1067 additions and 876 deletions
|
|
@ -19,7 +19,6 @@ import type {
|
|||
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
||||
import InformationPage from "@/modules/04_registryPerson/components/Dialog/01_Information.vue"; //form ข้อมูลส่วนตัว
|
||||
import AddressPage from "@/modules/04_registryPerson/components/Dialog/02_Address.vue"; //form ข้อมูลที่อยู่
|
||||
import FamilyPage from "@/modules/04_registryPerson/components/Dialog/03_Family.vue"; //form ข้อมูลครอบครัว
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true }); // ตัวแปร popup
|
||||
const idCard = defineModel<string>("idCard", { required: true }); //เลขบัตร ปชช
|
||||
|
|
@ -57,7 +56,6 @@ const formInformations = reactive<RequestObject>({
|
|||
nationality: null,
|
||||
ethnicity: null,
|
||||
birthDate: null,
|
||||
phone: null,
|
||||
lastName: "",
|
||||
firstName: "",
|
||||
prefix: "",
|
||||
|
|
@ -78,38 +76,9 @@ const formDataAddress = reactive<RequestAddressObject>({
|
|||
registrationAddress: "",
|
||||
});
|
||||
|
||||
const fatherData = reactive<FormPerson>({
|
||||
isLive: 1,
|
||||
citizenId: "",
|
||||
prefix: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
job: "",
|
||||
});
|
||||
const motherData = reactive<FormPerson>({
|
||||
isLive: 1,
|
||||
citizenId: "",
|
||||
prefix: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
job: "",
|
||||
});
|
||||
const coupleData = reactive<FormPerson>({
|
||||
isLive: 1,
|
||||
citizenId: "",
|
||||
prefix: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
job: "",
|
||||
lastNameOld: "",
|
||||
statusMarital: "",
|
||||
});
|
||||
const childData = ref<FormChildren[]>([]);
|
||||
|
||||
/** ปิด popup */
|
||||
async function closeDialog() {
|
||||
modal.value = false;
|
||||
childData.value = [];
|
||||
|
||||
formInformations.bloodGroup = null;
|
||||
formInformations.relationship = null;
|
||||
|
|
@ -119,34 +88,10 @@ async function closeDialog() {
|
|||
formInformations.nationality = null;
|
||||
formInformations.ethnicity = null;
|
||||
formInformations.birthDate = null;
|
||||
formInformations.phone = null;
|
||||
formInformations.lastName = "";
|
||||
formInformations.firstName = "";
|
||||
formInformations.prefix = "";
|
||||
formInformations.rank = null;
|
||||
|
||||
fatherData.isLive = 1;
|
||||
fatherData.citizenId = "";
|
||||
fatherData.prefix = "";
|
||||
fatherData.firstName = "";
|
||||
fatherData.lastName = "";
|
||||
fatherData.job = "";
|
||||
|
||||
motherData.isLive = 1;
|
||||
motherData.citizenId = "";
|
||||
motherData.prefix = "";
|
||||
motherData.firstName = "";
|
||||
motherData.lastName = "";
|
||||
motherData.job = "";
|
||||
|
||||
coupleData.isLive = 1;
|
||||
coupleData.citizenId = "";
|
||||
coupleData.prefix = "";
|
||||
coupleData.firstName = "";
|
||||
coupleData.lastName = "";
|
||||
coupleData.job = "";
|
||||
coupleData.lastNameOld = "";
|
||||
coupleData.statusMarital = "";
|
||||
}
|
||||
|
||||
/** อัพเดตข้อมูลส่วนตัว */
|
||||
|
|
@ -195,104 +140,6 @@ async function upDateAddress() {
|
|||
.finally(() => {});
|
||||
}
|
||||
|
||||
/** อัพเดตข้อมูลครอบครัว */
|
||||
async function upDateFamily() {
|
||||
await saveFather();
|
||||
await saveMother();
|
||||
if (coupleData.citizenId !== "") {
|
||||
saveCouple();
|
||||
}
|
||||
if (childData.value.length !== 0) {
|
||||
for (const child of childData.value) {
|
||||
saveChildren(child);
|
||||
}
|
||||
}
|
||||
count.value += 1;
|
||||
}
|
||||
|
||||
async function saveFather() {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
fatherCitizenId: fatherData.citizenId,
|
||||
fatherPrefix: fatherData.prefix,
|
||||
fatherFirstName: fatherData.firstName,
|
||||
fatherLastName: fatherData.lastName,
|
||||
fatherCareer: fatherData.job,
|
||||
fatherLive: fatherData.isLive === 1 ? true : false,
|
||||
};
|
||||
http
|
||||
.post(config.API.profileFamily("", "father"), body)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
async function saveMother() {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
motherCitizenId: motherData.citizenId,
|
||||
motherPrefix: motherData.prefix,
|
||||
motherFirstName: motherData.firstName,
|
||||
motherLastName: motherData.lastName,
|
||||
motherCareer: motherData.job,
|
||||
motherLive: motherData.isLive === 1 ? true : false,
|
||||
};
|
||||
http
|
||||
.post(config.API.profileFamily("", "mother"), body)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
async function saveCouple() {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
coupleCitizenId: coupleData.citizenId,
|
||||
couplePrefix: coupleData.prefix,
|
||||
coupleFirstName: coupleData.firstName,
|
||||
coupleLastName: coupleData.lastName,
|
||||
coupleCareer: coupleData.job,
|
||||
coupleLive: coupleData.isLive === 1 ? true : false,
|
||||
relationship: coupleData.statusMarital,
|
||||
coupleLastNameOld: coupleData.lastNameOld,
|
||||
};
|
||||
http
|
||||
.post(config.API.profileFamily("", "couple"), body)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
async function saveChildren(child: FormChildren) {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
childrenCitizenId: child.childrenCitizenId,
|
||||
childrenPrefix: child.childrenPrefix,
|
||||
childrenFirstName: child.childrenFirstName,
|
||||
childrenLastName: child.childrenLastName,
|
||||
childrenCareer: child.childrenCareer,
|
||||
childrenLive: child.childrenLive === 1 ? true : false,
|
||||
};
|
||||
|
||||
return http
|
||||
.post(config.API.profileFamily("", "children"), body)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
/** ส่ง สถานะ ดำเนินการเเล้ว */
|
||||
async function upDateStatus() {
|
||||
await http
|
||||
|
|
@ -318,8 +165,7 @@ function onSubmit() {
|
|||
showLoader();
|
||||
await upDateInfomation();
|
||||
await upDateAddress();
|
||||
await upDateFamily();
|
||||
if (count.value == 3) {
|
||||
if (count.value == 2) {
|
||||
await upDateStatus();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
|
|
@ -334,53 +180,6 @@ async function amiRequest() {
|
|||
data.value = profile;
|
||||
|
||||
data.value = profile;
|
||||
data.value = {
|
||||
titleCode: 3,
|
||||
titleDesc: "นาย",
|
||||
titleName: "นาย",
|
||||
titleSex: 1,
|
||||
firstName: "ชัยชนะ",
|
||||
middleName: "",
|
||||
lastName: "เรืองโรจน์",
|
||||
genderCode: 1,
|
||||
genderDesc: "ชาย",
|
||||
dateOfBirth: 25211228,
|
||||
nationalityCode: 99,
|
||||
nationalityDesc: "ไทย",
|
||||
ownerStatusDesc: "เจ้าบ้าน",
|
||||
statusOfPersonCode: 0,
|
||||
statusOfPersonDesc: "บุคคลนี้มีภูมิลำเนาอยู่ในบ้านนี้",
|
||||
dateOfMoveIn: 25580728,
|
||||
age: 45,
|
||||
|
||||
fatherPersonalID: 3102100621479,
|
||||
fatherName: "บุญเชิด",
|
||||
fatherNationalityCode: 99,
|
||||
fatherNationalityDesc: "ไทย",
|
||||
|
||||
motherPersonalID: 3102100621487,
|
||||
motherName: "พยอม",
|
||||
motherNationalityCode: 99,
|
||||
motherNationalityDesc: "ไทย",
|
||||
|
||||
fullnameAndRank: "นายสุพลชัย พูลสวัสดิ์",
|
||||
englishTitleDesc: "MR.",
|
||||
englishFirstName: "SUPHONCHAI",
|
||||
englishMiddleName: "",
|
||||
englishLastName: "PHOONSAWAT",
|
||||
|
||||
registrationAddress: "1220-1222 ถนนเพชรบุรี",
|
||||
registrationProvinceId: "24bf701c-33d6-436e-ad49-6f82bb3ae017",
|
||||
registrationDistrictId: "34bf701c-33d6-436e-ad49-6f82bb3b0586",
|
||||
registrationSubDistrictId: "44bf701c-33d6-436e-ad49-6f82bb3b5649",
|
||||
registrationZipCode: "10400",
|
||||
currentAddress: "1220-1222 ถนนเพชรบุรี",
|
||||
currentProvinceId: "24bf701c-33d6-436e-ad49-6f82bb3ae017",
|
||||
currentDistrictId: "34bf701c-33d6-436e-ad49-6f82bb3b0586",
|
||||
currentSubDistrictId: "44bf701c-33d6-436e-ad49-6f82bb3b5649",
|
||||
currentZipCode: "10400",
|
||||
};
|
||||
|
||||
formInformations.citizenId = idCard.value;
|
||||
formInformations.prefix = data.value.titleName;
|
||||
fullName.value = data.value.fullnameAndRank;
|
||||
|
|
@ -496,17 +295,6 @@ watch(
|
|||
v-model:present-address="presentAddress"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-separator />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<FamilyPage
|
||||
v-model:father-data="fatherData"
|
||||
v-model:mother-data="motherData"
|
||||
v-model:couple-data="coupleData"
|
||||
v-model:child-data="childData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue