แก้ fetch data ทะเบียน
This commit is contained in:
parent
e4f153b654
commit
dc05b4740c
18 changed files with 158 additions and 125 deletions
|
|
@ -1299,61 +1299,63 @@ const fetchHistory = async () => {
|
|||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.profileFamiId(route.params.id.toString()))
|
||||
.then((res) => {
|
||||
const data: ResponseObject = res.data.result;
|
||||
familyData.value.prefixC = "";
|
||||
familyData.value.prefixIdC = data.couplePrefixId;
|
||||
familyData.value.firstnameC = data.coupleFirstName;
|
||||
familyData.value.lastnameC = data.coupleLastName;
|
||||
familyData.value.lastnameCOld = data.coupleLastNameOld;
|
||||
familyData.value.occupationC = data.coupleCareer;
|
||||
familyData.value.liveC = data.coupleLive ? "1" : "0";
|
||||
familyData.value.citizenIdC = data.coupleCitizenId;
|
||||
if (route.params.id) {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.profileFamiId(route.params.id.toString()))
|
||||
.then((res) => {
|
||||
const data: ResponseObject = res.data.result;
|
||||
familyData.value.prefixC = "";
|
||||
familyData.value.prefixIdC = data.couplePrefixId;
|
||||
familyData.value.firstnameC = data.coupleFirstName;
|
||||
familyData.value.lastnameC = data.coupleLastName;
|
||||
familyData.value.lastnameCOld = data.coupleLastNameOld;
|
||||
familyData.value.occupationC = data.coupleCareer;
|
||||
familyData.value.liveC = data.coupleLive ? "1" : "0";
|
||||
familyData.value.citizenIdC = data.coupleCitizenId;
|
||||
|
||||
familyData.value.prefixM = "";
|
||||
familyData.value.prefixIdM = data.fatherPrefixId;
|
||||
familyData.value.firstnameM = data.fatherFirstName;
|
||||
familyData.value.lastnameM = data.fatherLastName;
|
||||
familyData.value.occupationM = data.fatherCareer;
|
||||
familyData.value.liveM = data.fatherLive ? "1" : "0";
|
||||
familyData.value.citizenIdM = data.fatherCitizenId;
|
||||
familyData.value.prefixM = "";
|
||||
familyData.value.prefixIdM = data.fatherPrefixId;
|
||||
familyData.value.firstnameM = data.fatherFirstName;
|
||||
familyData.value.lastnameM = data.fatherLastName;
|
||||
familyData.value.occupationM = data.fatherCareer;
|
||||
familyData.value.liveM = data.fatherLive ? "1" : "0";
|
||||
familyData.value.citizenIdM = data.fatherCitizenId;
|
||||
|
||||
familyData.value.prefixF = "";
|
||||
familyData.value.prefixIdF = data.motherPrefixId;
|
||||
familyData.value.firstnameF = data.motherFirstName;
|
||||
familyData.value.lastnameF = data.motherLastName;
|
||||
familyData.value.occupationF = data.motherCareer;
|
||||
familyData.value.liveF = data.motherLive ? "1" : "0";
|
||||
familyData.value.citizenIdF = data.motherCitizenId;
|
||||
familyData.value.same = data.couple ? "1" : "0";
|
||||
familyData.value.prefixF = "";
|
||||
familyData.value.prefixIdF = data.motherPrefixId;
|
||||
familyData.value.firstnameF = data.motherFirstName;
|
||||
familyData.value.lastnameF = data.motherLastName;
|
||||
familyData.value.occupationF = data.motherCareer;
|
||||
familyData.value.liveF = data.motherLive ? "1" : "0";
|
||||
familyData.value.citizenIdF = data.motherCitizenId;
|
||||
familyData.value.same = data.couple ? "1" : "0";
|
||||
|
||||
if (data.childrens.length > 0) {
|
||||
let dataChild: childrenFamily[] = [];
|
||||
data.childrens.map((row: childrenFamily, index: number) => {
|
||||
dataChild.push({
|
||||
id: `${index + 1}`,
|
||||
childrenPrefixId: row.childrenPrefixId,
|
||||
childrenFirstName: row.childrenFirstName,
|
||||
childrenLastName: row.childrenLastName,
|
||||
childrenCareer: row.childrenCareer,
|
||||
childrenLive: row.childrenLive,
|
||||
childrenCitizenId: row.childrenCitizenId,
|
||||
if (data.childrens.length > 0) {
|
||||
let dataChild: childrenFamily[] = [];
|
||||
data.childrens.map((row: childrenFamily, index: number) => {
|
||||
dataChild.push({
|
||||
id: `${index + 1}`,
|
||||
childrenPrefixId: row.childrenPrefixId,
|
||||
childrenFirstName: row.childrenFirstName,
|
||||
childrenLastName: row.childrenLastName,
|
||||
childrenCareer: row.childrenCareer,
|
||||
childrenLive: row.childrenLive,
|
||||
childrenCitizenId: row.childrenCitizenId,
|
||||
});
|
||||
});
|
||||
});
|
||||
familyData.value.childrens = dataChild;
|
||||
} else {
|
||||
familyData.value.childrens = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
familyData.value.childrens = dataChild;
|
||||
} else {
|
||||
familyData.value.childrens = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const editData = async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue