ทะเบียนประวัติ ==> ปรับ load
This commit is contained in:
parent
bc29de9f1c
commit
07b50dca80
4 changed files with 42 additions and 26 deletions
|
|
@ -423,10 +423,17 @@ watch(
|
|||
);
|
||||
|
||||
onMounted(() => {
|
||||
getData();
|
||||
const promises = [];
|
||||
|
||||
// Add the getData() promise
|
||||
promises.push(getData());
|
||||
|
||||
// Check the condition and add fetchPerson() if needed
|
||||
if (store.Ops && store.Ops.prefixOps && store.Ops.prefixOps.length === 0) {
|
||||
fetchPerson();
|
||||
promises.push(fetchPerson());
|
||||
}
|
||||
|
||||
Promise.all(promises);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -172,9 +172,9 @@ const fromData = reactive({
|
|||
/**
|
||||
* function fetch ข้อมูลบิดา
|
||||
*/
|
||||
function fetchDataFather() {
|
||||
async function fetchDataFather() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
|
||||
)
|
||||
|
|
@ -201,9 +201,9 @@ function fetchDataFather() {
|
|||
/**
|
||||
* function fetch ข้อมูลมารดา
|
||||
*/
|
||||
function fetchDataMother() {
|
||||
async function fetchDataMother() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
|
||||
)
|
||||
|
|
@ -229,9 +229,9 @@ function fetchDataMother() {
|
|||
/**
|
||||
* function fetch ข้อมูลคู่สมรส
|
||||
*/
|
||||
function fetchDataCouple() {
|
||||
async function fetchDataCouple() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
|
||||
)
|
||||
|
|
@ -259,9 +259,9 @@ function fetchDataCouple() {
|
|||
/**
|
||||
* function fetch ข้อมูลบุตร
|
||||
*/
|
||||
function fetchDataChildren() {
|
||||
async function fetchDataChildren() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.profileFamily(empType.value, "children") +
|
||||
`/${profileId.value}`
|
||||
|
|
@ -412,7 +412,7 @@ function onOpenDialogHistory(type: string, id: string = "") {
|
|||
* function fetch ข้อมูลความสัมพันธ์
|
||||
*/
|
||||
function fetchDataRelationship() {
|
||||
showLoader();
|
||||
// showLoader();
|
||||
http
|
||||
.get(config.API.orgRelationship)
|
||||
.then((res) => {
|
||||
|
|
@ -426,7 +426,9 @@ function fetchDataRelationship() {
|
|||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
// setTimeout(() => {
|
||||
// hideLoader();
|
||||
// }, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -472,14 +474,17 @@ function fetchHistory(id: string, type: string) {
|
|||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
Promise.all([
|
||||
onMounted(async () => {
|
||||
showLoader();
|
||||
await Promise.all([
|
||||
fetchDataFather(),
|
||||
fetchDataMother(),
|
||||
fetchDataCouple(),
|
||||
fetchDataChildren(),
|
||||
fetchDataRelationship(),
|
||||
]);
|
||||
]).then(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue