แก้ fetch data ทะเบียน

This commit is contained in:
Kittapath 2023-07-11 10:16:51 +07:00
parent e4f153b654
commit dc05b4740c
18 changed files with 158 additions and 125 deletions

View file

@ -366,7 +366,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขผลก
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -319,7 +319,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -381,7 +381,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขวิน
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -162,7 +162,9 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const route = useRoute();
const { success, messageError } = mixin;
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const edit = ref<boolean>(false);
const uploader = ref<any>();
const files = ref<any>([]);

View file

@ -655,7 +655,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -606,27 +606,29 @@ const getNewData = async () => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
const editData = async () => {

View file

@ -316,7 +316,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขใบอ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -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 () => {

View file

@ -962,44 +962,49 @@ const calRetire = async (birth: Date) => {
};
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (data.profileType == "officer" && columnsHistory.value.length >= 15) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (
data.profileType == "officer" &&
columnsHistory.value.length >= 15
) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
}
};
const editData = async () => {

View file

@ -527,7 +527,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขเคร
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -444,7 +444,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filterTotal = ref<string>("");
const rowsTotal = ref<RequestItemsTotalObject[]>([]); //select data history

View file

@ -213,7 +213,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขอื่
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -909,7 +909,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขตำแ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(route.params.id ? route.params.id.toString() : "");
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -918,7 +918,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขตำแ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(route.params.id ? route.params.id.toString() : "");
const rows = ref<ResponseObjectEmployee[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -941,7 +941,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขตำแ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(route.params.id ? route.params.id.toString() : "");
const rows = ref<ResponseObjectEmployee[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -213,7 +213,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขควา
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -459,7 +459,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);

View file

@ -356,7 +356,9 @@ const tittleHistory = ref<string>("ประวัติแก้ไขปฏิ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(route.params.id.toString());
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);