แก้โหลด หน้า

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 () => {
await getAssignNew(personalId);
await getLaw(personalId);
await getSkill(personalId);
await getKnowledge(personalId);
await getcompetency(personalId);
await getCompetencyGroup(personalId);
await getAppoint(personalId);
const promises = [
getAssignNew(personalId),
getLaw(personalId),
getSkill(personalId),
getKnowledge(personalId),
getcompetency(personalId),
getCompetencyGroup(personalId),
getAppoint(personalId),
];
if (assignId.value !== undefined) {
await getAssign();
promises.push(getAssign());
}
showLoader();
await Promise.all(promises)
.then(() => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
</script>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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