From 2f95271b1b7f6ce6c8837ce9b23601f45d6e4ef1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 30 Aug 2024 11:16:21 +0700 Subject: [PATCH] fix bug --- src/api/02_organizational/api.organization.ts | 5 +- .../components/probation/ProbationDetail.vue | 43 +++-- src/modules/14_KPI/views/detailView.vue | 6 +- src/modules/14_KPI/views/list.vue | 11 +- src/modules/14_KPI/views/mainDetail.vue | 173 +++++++++++------- 5 files changed, 139 insertions(+), 99 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index d5a9883e0..76c8352d6 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -100,8 +100,9 @@ export default { orgDeceasedProfile: `${orgPos}/profile/search`, // - orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId/${id}`, - orgCheckAvatarAdmin: (id: string) => `${orgProfile}/avatar/profileid-admin/${id}`, + orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId-admin/${id}`, + orgCheckAvatarAdmin: (id: string) => + `${orgProfile}/avatar/profileid-admin/${id}`, orgCheckAvatarCard: (path: string) => `${organization}/${path}`, //noPernission changePosition: `${organization}/placement/change-position`, diff --git a/src/modules/05_placement/components/probation/ProbationDetail.vue b/src/modules/05_placement/components/probation/ProbationDetail.vue index ae7fee3cd..ba47394d9 100644 --- a/src/modules/05_placement/components/probation/ProbationDetail.vue +++ b/src/modules/05_placement/components/probation/ProbationDetail.vue @@ -27,6 +27,8 @@ const avatarProfile = ref(""); const filterKeyword = ref(""); const position_line = ref(""); const position_level = ref(""); +const position_type = ref(""); + const probation_status = ref(); const probation_statusold = ref(""); const pagination = ref({ @@ -148,9 +150,9 @@ async function getAssignList() { showLoader(); await http .get(config.API.probationGetAssignList(personalId.value)) - .then((res) => { - const data = res.data.data; - rows.value = data.map((item: FormProbationDetail) => ({ + .then(async (res) => { + const data = await res.data.data; + rows.value = await data.map((item: FormProbationDetail) => ({ id: item.id, round_no: item.round_no, date_start: date2Thai(new Date(item.date_start)), @@ -160,7 +162,9 @@ async function getAssignList() { chairman: item.chairman, })); }) - .catch(() => {}) + .catch((err) => { + messageError($q, err); + }) .finally(() => { hideLoader(); }); @@ -171,8 +175,8 @@ async function getpersonalList() { showLoader(); await http .get(config.API.personal(personalId.value)) - .then((res) => { - const data = res.data.data; + .then(async (res) => { + const data = await res.data.data; name.value = data.name; position_line.value = data.position_line; position_level.value = data.position_level; @@ -180,24 +184,27 @@ async function getpersonalList() { probation_status.value = data.probation_status; probation_statusold.value = data.probation_status; }) - .catch(() => {}) + .catch((err) => { + messageError($q, err); + }) .finally(() => { hideLoader(); }); } /** เปลี่ยนสถานะ */ -async function selectStatus() { +function selectStatus() { dialogConfirm( $q, - async () => { + () => { showLoader(); - await http + http .put(config.API.changestatusProbations(personalId.value), { status: probation_status.value, }) - .then((res) => { - success($q, "แก้ไขสถานะสำเร็จ"); + .then(async () => { + await getpersonalList(); + await success($q, "แก้ไขสถานะสำเร็จ"); }) .catch((err) => { messageError($q, err); @@ -205,7 +212,6 @@ async function selectStatus() { }) .finally(() => { hideLoader(); - getpersonalList(); }); }, "ยืนยันการเปลี่ยนสถานะการทดลองปฏิบัติหน้าที่ราชการ", @@ -271,9 +277,7 @@ async function fetchProfilePhoto() { /** get ค่า เมื่อโหลดหน้า */ onMounted(async () => { - await getpersonalList(); - await getAssignList(); - fetchProfilePhoto(); + await Promise.all([getpersonalList(), getAssignList(), fetchProfilePhoto()]); }); @@ -289,7 +293,7 @@ onMounted(async () => { class="q-mr-sm" @click="router.push(`/probation/`)" /> - รายละเอียดงานที่ได้รับมอบหมายของ {{ name }} + รายละเอียดงานที่ได้รับมอบหมายของ{{ name }}
@@ -322,7 +326,7 @@ onMounted(async () => {
-
ระดับ
+
ประเภทตำแหน่ง
{{ position_level }}
@@ -458,8 +462,7 @@ onMounted(async () => { รายละเอียด { - const data = res.data.result; + const data = await res.data.result; store.dataEvaluation = await data; formProfile.status = await store.convertStatus(data.evaluationStatus); formProfile.result = await store.convertResults(data.evaluationResults); @@ -240,7 +240,7 @@ async function getProfile() { .then(async (res) => { const data = await res.data.result; store.dataProfile = await data; - await setTimeout(() => { + setTimeout(() => { store.checkStep(); }, 1000); }) diff --git a/src/modules/14_KPI/views/list.vue b/src/modules/14_KPI/views/list.vue index 876eade9d..dbd5edb9e 100644 --- a/src/modules/14_KPI/views/list.vue +++ b/src/modules/14_KPI/views/list.vue @@ -112,7 +112,7 @@ function fetchRoundOption() { roundOp.value = list; store.formQuery.round = list[0].id; - fetchList(); + await fetchList(); } else { roundOp.value = []; store.formQuery.round = ""; @@ -127,7 +127,7 @@ function fetchRoundOption() { } // const status = ref(""); -function fetchList() { +async function fetchList() { showLoader(); const body = { page: formQuery.page, @@ -136,13 +136,12 @@ function fetchList() { keyword: store.formQuery.keyword ? store.formQuery.keyword.replace(/\s+/g, "") : store.formQuery.keyword, - // status: status.value, }; - http + await http .post(config.API.kpiUserEvaluation + `/list`, body) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; maxPage.value = Math.ceil(data.total / formQuery.pageSize); totalList.value = data.total; rows.value = data.data; diff --git a/src/modules/14_KPI/views/mainDetail.vue b/src/modules/14_KPI/views/mainDetail.vue index 633729e42..c7f306dc4 100644 --- a/src/modules/14_KPI/views/mainDetail.vue +++ b/src/modules/14_KPI/views/mainDetail.vue @@ -1,10 +1,8 @@