ทะเบียนประวัติ ==> ปรับ 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(() => {
|
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) {
|
if (store.Ops && store.Ops.prefixOps && store.Ops.prefixOps.length === 0) {
|
||||||
fetchPerson();
|
promises.push(fetchPerson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Promise.all(promises);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,9 +172,9 @@ const fromData = reactive({
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลบิดา
|
* function fetch ข้อมูลบิดา
|
||||||
*/
|
*/
|
||||||
function fetchDataFather() {
|
async function fetchDataFather() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
|
|
@ -201,9 +201,9 @@ function fetchDataFather() {
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลมารดา
|
* function fetch ข้อมูลมารดา
|
||||||
*/
|
*/
|
||||||
function fetchDataMother() {
|
async function fetchDataMother() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
|
|
@ -229,9 +229,9 @@ function fetchDataMother() {
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลคู่สมรส
|
* function fetch ข้อมูลคู่สมรส
|
||||||
*/
|
*/
|
||||||
function fetchDataCouple() {
|
async function fetchDataCouple() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
|
|
@ -259,9 +259,9 @@ function fetchDataCouple() {
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลบุตร
|
* function fetch ข้อมูลบุตร
|
||||||
*/
|
*/
|
||||||
function fetchDataChildren() {
|
async function fetchDataChildren() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "children") +
|
config.API.profileFamily(empType.value, "children") +
|
||||||
`/${profileId.value}`
|
`/${profileId.value}`
|
||||||
|
|
@ -412,7 +412,7 @@ function onOpenDialogHistory(type: string, id: string = "") {
|
||||||
* function fetch ข้อมูลความสัมพันธ์
|
* function fetch ข้อมูลความสัมพันธ์
|
||||||
*/
|
*/
|
||||||
function fetchDataRelationship() {
|
function fetchDataRelationship() {
|
||||||
showLoader();
|
// showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.orgRelationship)
|
.get(config.API.orgRelationship)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -426,7 +426,9 @@ function fetchDataRelationship() {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
// setTimeout(() => {
|
||||||
|
// hideLoader();
|
||||||
|
// }, 2000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -472,14 +474,17 @@ function fetchHistory(id: string, type: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
Promise.all([
|
showLoader();
|
||||||
|
await Promise.all([
|
||||||
fetchDataFather(),
|
fetchDataFather(),
|
||||||
fetchDataMother(),
|
fetchDataMother(),
|
||||||
fetchDataCouple(),
|
fetchDataCouple(),
|
||||||
fetchDataChildren(),
|
fetchDataChildren(),
|
||||||
fetchDataRelationship(),
|
fetchDataRelationship(),
|
||||||
]);
|
]).then(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,9 +173,13 @@ export const useProfileDataStore = defineStore("profile", () => {
|
||||||
Ops.value.religionOps = optionreligions;
|
Ops.value.religionOps = optionreligions;
|
||||||
OpsFilter.value.religionOps = optionreligions;
|
OpsFilter.value.religionOps = optionreligions;
|
||||||
})
|
})
|
||||||
.catch((e: any) => {})
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
setTimeout(() => {
|
||||||
|
hideLoader();
|
||||||
|
}, 2500);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchProfile(id: string) {
|
function fetchProfile(id: string) {
|
||||||
showLoader();
|
// showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
|
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
@ -208,9 +208,9 @@ function fetchProfile(id: string) {
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
profilePicture.value = avatar;
|
profilePicture.value = avatar;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
// .finally(() => {
|
||||||
hideLoader();
|
// hideLoader();
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
const reasonStatus = ref<boolean>(false);
|
const reasonStatus = ref<boolean>(false);
|
||||||
|
|
@ -254,7 +254,7 @@ async function fetchDataPersonal() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
|
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
formDetail.value = res.data.result;
|
formDetail.value = res.data.result;
|
||||||
|
|
||||||
if (res.data.result.leaveReason) {
|
if (res.data.result.leaveReason) {
|
||||||
|
|
@ -275,7 +275,7 @@ async function fetchDataPersonal() {
|
||||||
|
|
||||||
fileName.value = res.data.result.avatarName;
|
fileName.value = res.data.result.avatarName;
|
||||||
if (formDetail.value?.avatarName) {
|
if (formDetail.value?.avatarName) {
|
||||||
fetchProfile(profileId.value);
|
await fetchProfile(profileId.value);
|
||||||
} else {
|
} else {
|
||||||
profilePicture.value = avatar;
|
profilePicture.value = avatar;
|
||||||
}
|
}
|
||||||
|
|
@ -291,13 +291,13 @@ async function fetchDataPersonal() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
setTimeout(() => {
|
||||||
|
hideLoader();
|
||||||
|
}, 2800);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClickDownloadKp7(type: string) {
|
function onClickDownloadKp7(type: string) {
|
||||||
console.log(empType.value);
|
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
const url =
|
const url =
|
||||||
type === "FULL"
|
type === "FULL"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue