แก้โหลด หน้า

This commit is contained in:
setthawutttty 2024-11-04 13:48:11 +07:00
parent 57f145784e
commit 419ccf61fa
10 changed files with 43 additions and 20 deletions

View file

@ -1043,16 +1043,28 @@ function updateAppointMent() {
/** เมื่อโหลดหน้า เรียกใช้งานฟังชั่น */ /** เมื่อโหลดหน้า เรียกใช้งานฟังชั่น */
onMounted(async () => { onMounted(async () => {
await getAssignNew(personalId); const promises = [
await getLaw(personalId); getAssignNew(personalId),
await getSkill(personalId); getLaw(personalId),
await getKnowledge(personalId); getSkill(personalId),
await getcompetency(personalId); getKnowledge(personalId),
await getCompetencyGroup(personalId); getcompetency(personalId),
await getAppoint(personalId); getCompetencyGroup(personalId),
getAppoint(personalId),
];
if (assignId.value !== undefined) { if (assignId.value !== undefined) {
await getAssign(); promises.push(getAssign());
} }
showLoader();
await Promise.all(promises)
.then(() => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}); });
</script> </script>

View file

@ -102,7 +102,6 @@ const optionText = ref<ListDataText[]>([
/** get ข้อมูลมอบหมายงาน */ /** get ข้อมูลมอบหมายงาน */
async function fecthAssign() { async function fecthAssign() {
showLoader();
await http await http
.get(config.API.evaluateCreate(assignId.value)) .get(config.API.evaluateCreate(assignId.value))
.then(async (res) => { .then(async (res) => {
@ -116,15 +115,16 @@ async function fecthAssign() {
date_finish.value = res.data.result.end_date; date_finish.value = res.data.result.end_date;
// } // }
// Autherise.value = probationStore.director; // Autherise.value = probationStore.director;
!probationStore.checkLoad && hideLoader();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
!probationStore.checkLoad && hideLoader();
}) })
.finally(() => { .finally(() => {
if (props.action == "edit") { if (props.action == "edit") {
fetchEvaluate(); fetchEvaluate();
} }
hideLoader();
}); });
} }

View file

@ -214,7 +214,6 @@ function cancel() {
/** get ข้อมูล */ /** get ข้อมูล */
async function fecthAssign() { async function fecthAssign() {
showLoader();
await http await http
.get(config.API.evaluateChairman(assignId.value)) .get(config.API.evaluateChairman(assignId.value))
.then(async (res: any) => { .then(async (res: any) => {
@ -228,15 +227,16 @@ async function fecthAssign() {
if (res.data.result.mentors.length != 0) { if (res.data.result.mentors.length != 0) {
director_id3.value = res.data.result.mentors[0]; director_id3.value = res.data.result.mentors[0];
} }
!probationStore.checkLoad && hideLoader();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
!probationStore.checkLoad && hideLoader();
}) })
.finally(() => { .finally(() => {
if (props.action == "edit") { if (props.action == "edit") {
fetchEvaluate(); fetchEvaluate();
} }
hideLoader();
}); });
} }

View file

@ -105,8 +105,12 @@ async function fecthFormdata() {
.then(async (res: any) => { .then(async (res: any) => {
await fecthAssignoutput(res.data.result); await fecthAssignoutput(res.data.result);
await fectFormfull(); await fectFormfull();
!probationStore.checkLoad && hideLoader()
})
.catch((e: any) => {
messageError($q,e)
!probationStore.checkLoad && hideLoader()
}) })
.catch((e: any) => {})
.finally(() => { .finally(() => {
if (props.action == "edit") { if (props.action == "edit") {
fecthFormRound(); fecthFormRound();

View file

@ -148,8 +148,11 @@ async function fecthFormdata() {
.then(async (res: any) => { .then(async (res: any) => {
await fecthAssignoutput(res.data.result); await fecthAssignoutput(res.data.result);
await fectFormfull(); await fectFormfull();
!probationStore.checkLoad && hideLoader();
})
.catch((e: any) => {
!probationStore.checkLoad && hideLoader();
}) })
.catch((e: any) => {})
.finally(() => { .finally(() => {
if (props.action == "edit") { if (props.action == "edit") {
fecthFormRound(); fecthFormRound();

View file

@ -32,6 +32,7 @@ const { showLoader, hideLoader, messageError } = mixin;
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const tab = ref<string>("save1"); const tab = ref<string>("save1");
const dataArrayNumber = ref<number>(); const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor"); const dataRole = ref<string>("mentor");
@ -51,7 +52,7 @@ async function fecthAssign(id: string) {
// messageError($q, e); // messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); probationStore.checkLoad && hideLoader();
}); });
} }

View file

@ -53,7 +53,7 @@ async function fecthAssign(id: string) {
// messageError($q, e); // messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); probationStore.checkLoad && hideLoader();
}); });
} }

View file

@ -65,7 +65,7 @@ async function fecthAssign(id: string) {
// messageError($q, e); // messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); probationStore.checkLoad && hideLoader();
}); });
} }

View file

@ -59,7 +59,7 @@ const fecthAssign = async (id: string) => {
// messageError($q, e); // messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); probationStore.checkLoad && hideLoader();
}); });
}; };

View file

@ -13,15 +13,17 @@ export const useProbationDataStore = defineStore("probationStore", () => {
const evaluate = ref<any>([]); const evaluate = ref<any>([]);
const tabs = ref<any>([]); const tabs = ref<any>([]);
const mainTab = ref<string>(""); const mainTab = ref<string>("");
const checkLoad = ref<boolean>(false)
const assignOutput = ref<any>([]); const assignOutput = ref<any>([]);
const director = ref<any>([]); const director = ref<any>([]);
const person = ref<any>([]); const person = ref<any>([]);
const fecthdataAssign = async (data: any) => { const fecthdataAssign = async (data: any) => {
checkLoad.value = data.evaluate.length == 0 ? true:false
assign.value = await data.assign; assign.value = await data.assign;
evaluate.value = await data.evaluate; evaluate.value = await data.evaluate;
tabs.value = await data.evaluate; tabs.value = await data.evaluate;
}; };
const fecthAssignoutput = (data: any) => { const fecthAssignoutput = (data: any) => {
assignOutput.value = data.assign_output; assignOutput.value = data.assign_output;
@ -111,6 +113,7 @@ export const useProbationDataStore = defineStore("probationStore", () => {
behavior_no1, behavior_no1,
behavior_no2, behavior_no2,
behavior_no3, behavior_no3,
dataPermissions dataPermissions,
checkLoad
}; };
}); });