From 1f679bd6b4fd316d096d5a9eb6c0eb0864e471ea Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 17 Jul 2024 13:16:02 +0700 Subject: [PATCH] fix bug --- .../components/PersonalDetail/Education.vue | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modules/05_placement/components/PersonalDetail/Education.vue b/src/modules/05_placement/components/PersonalDetail/Education.vue index 6215e1905..a6695458f 100644 --- a/src/modules/05_placement/components/PersonalDetail/Education.vue +++ b/src/modules/05_placement/components/PersonalDetail/Education.vue @@ -383,8 +383,11 @@ const clickNext = async () => { */ const getData = () => { const row = rows.value[rowIndex.value]; + const checkLevelEducation = OpsFilter.value.levelOptions.find( + (e) => e.id === row.educationLevelId + ); - levelId.value = row.educationLevelId; + levelId.value = checkLevelEducation ? row.educationLevelId : ""; isDate.value = row.isDate; isEducation.value = row.isEducation; // positionPathId.value = resultPath; @@ -494,7 +497,7 @@ const saveData = async () => { messageError($q, e); }) .finally(async () => { - await props.fetch('Education'); + await props.fetch("Education"); rows.value = props.data; }); }; @@ -503,12 +506,6 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - // const filter = OpsFilter.value.levelOptions.filter( - // (r: any) => r.id == levelId.value - // ); - // const filterPositionPath = OpsFilter.value.positionPathOptions.filter( - // (r: any) => r.id == positionPathId.value - // ); showLoader(); await http .put(config.API.placementEducationId(route.params.personalId.toString()), { @@ -544,7 +541,7 @@ const editData = async () => { messageError($q, e); }) .finally(async () => { - await props.fetch('Education'); + await props.fetch("Education"); rows.value = props.data; }); }; @@ -559,18 +556,16 @@ const deletePlacementEducation = async () => { showLoader(); await http .delete(config.API.placementEducationId(id.value)) - .then(async(res) => { + .then(async (res) => { success($q, "ลบข้อมูลสำเร็จ"); modal.value = false; - await props.fetch('Education'); + await props.fetch("Education"); rows.value = props.data; }) .catch((e) => { messageError($q, e); }) - .finally(async () => { - - }); + .finally(async () => {}); }; /** @@ -600,12 +595,17 @@ const clickClose = async () => { * @param _props ค่า props ใน row ที่เลือก */ const selectData = async (_props: DataProps) => { + const checkLevelEducation = OpsFilter.value.levelOptions.find( + (e) => e.id === _props.row.educationLevelId + ); + modalEdit.value = true; modal.value = true; edit.value = false; rawItem.value = _props.row; rowIndex.value = _props.rowIndex; - levelId.value = _props.row.educationLevelId; + levelId.value = checkLevelEducation ? _props.row.educationLevelId : ""; + // positionPathId.value = resultPath; // levelId.value = _props.row.levelId; // positionPathId.value = _props.row.positionPathId;