diff --git a/src/modules/08_registryEmployee/components/DialogAddEmployee.vue b/src/modules/08_registryEmployee/components/DialogAddEmployee.vue index 7a44e1458..9a5f19525 100644 --- a/src/modules/08_registryEmployee/components/DialogAddEmployee.vue +++ b/src/modules/08_registryEmployee/components/DialogAddEmployee.vue @@ -216,19 +216,17 @@ function calculateMaxDate() { } function onSubmit() { - dialogConfirm($q, () => { + dialogConfirm($q, async () => { showLoader(); - http + await http .post(config.API.registryNew("-employee"), formData) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); closeDialog(); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); }); }); diff --git a/src/modules/08_registryEmployee/components/DialogSelectPos.vue b/src/modules/08_registryEmployee/components/DialogSelectPos.vue index e925afa3b..3d0bbd403 100644 --- a/src/modules/08_registryEmployee/components/DialogSelectPos.vue +++ b/src/modules/08_registryEmployee/components/DialogSelectPos.vue @@ -378,9 +378,9 @@ async function onClickSubmit() { await http .put(config.API.positionEmployee(props?.dataRow?.id), body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchData?.(); + .then(async () => { + await props.fetchData?.(); + await success($q, "บันทึกข้อมูลสำเร็จ"); closePopup(); }) .catch((err) => { diff --git a/src/modules/08_registryEmployee/components/DialogSendOrder.vue b/src/modules/08_registryEmployee/components/DialogSendOrder.vue index 465f6f655..52b209789 100644 --- a/src/modules/08_registryEmployee/components/DialogSendOrder.vue +++ b/src/modules/08_registryEmployee/components/DialogSendOrder.vue @@ -182,10 +182,10 @@ function onClickSendOrder() { }; http .post(config.API.orgProfileReport, data) - .then(() => { - success($q, "บันทึกสำเร็จ"); + .then(async() => { + await props?.fetchData?.(); + await success($q, "บันทึกสำเร็จ"); closeDialog(); - props?.fetchData?.(); }) .catch((err) => { messageError($q, err); diff --git a/src/modules/08_registryEmployee/components/DialogSendToCommand.vue b/src/modules/08_registryEmployee/components/DialogSendToCommand.vue index b87a817cc..522a2bbc7 100644 --- a/src/modules/08_registryEmployee/components/DialogSendToCommand.vue +++ b/src/modules/08_registryEmployee/components/DialogSendToCommand.vue @@ -258,16 +258,16 @@ const sendToCommand = async () => { showLoader(); await http .post(config.API.organizationEmployeeSendOrder, data) - .then((res: any) => { - success($q, "บันทึกสำเร็จ"); + .then(async () => { + await props.fetchNewList(); + await success($q, "บันทึกสำเร็จ"); + props.closeDialog(); + selected.value = []; }) .catch((e: any) => { messageError($q, e); }) .finally(async () => { - props.fetchNewList(); - props.closeDialog(); - selected.value = []; hideLoader(); }); }; diff --git a/src/modules/08_registryEmployee/views/Main.vue b/src/modules/08_registryEmployee/views/Main.vue index 7b968d47a..6b914c99f 100644 --- a/src/modules/08_registryEmployee/views/Main.vue +++ b/src/modules/08_registryEmployee/views/Main.vue @@ -218,7 +218,7 @@ watch( function fetchList() { showLoader(); http - .get(config.API.registryNew("-employee"), { params: queryParams }) + .get(config.API.registryNew("-temp"), { params: queryParams }) .then((res) => { maxPage.value = Math.ceil(res.data.result.total / queryParams.pageSize); total.value = res.data.result.total; @@ -233,18 +233,16 @@ function fetchList() { } function onClickDelete(id: string) { - dialogRemove($q, () => { + dialogRemove($q, async () => { showLoader(); - http + await http .delete(config.API.registryNew("-employee") + `/${id}`) - .then(() => { - success($q, "ลบข้อมูลสำเร็จ"); - fetchList(); + .then(async () => { + await fetchList(); + await success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); }); });