From f1c056fc8d2c6aa711c65fcb474edf7ed8e89944 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 18 Jul 2025 16:43:51 +0700 Subject: [PATCH] =?UTF-8?q?fix=20fetch=20=E0=B8=8A=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppointEmployee/DialogOrders.vue | 1 + .../components/AppointMent/DialogOrders.vue | 1 + .../Help-Government/DialogOrders.vue | 1 + .../components/Other/DialogOrders.vue | 1 + .../components/PersonalList/DialogOrders.vue | 1 + .../components/PersonalList/Table.vue | 12 ++++++---- .../components/Receive/DialogOrders.vue | 1 + .../components/Repatriate/DialogOrders.vue | 4 ++-- .../components/Transfer/DialogOrders.vue | 1 + .../components/probation/DialogOrder.vue | 24 ++++++++++--------- .../DialogOrder/DialogSendToCommand.vue | 1 + .../components/probation/MainProbation.vue | 2 +- .../05_placement/views/02_transferMain.vue | 1 + .../05_placement/views/03_receiveMain.vue | 1 + .../views/04_helpGovernmentMain.vue | 3 ++- .../05_placement/views/05_repatriateMain.vue | 3 ++- .../views/06_appointPromoteMain.vue | 5 ++-- .../views/07_appointEmployeeMain.vue | 3 ++- .../05_placement/views/08_otherMain.vue | 5 ++-- .../02_resign/DialogSendToCommand.vue | 1 + .../components/02_resign/Table.vue | 3 ++- .../03_resignEmp/DialogSendToCommand.vue | 1 + .../components/03_resignEmp/Table.vue | 1 + .../06_dismissOrder/DialogSendToCommand.vue | 3 +-- .../DialogSendToCommandEmp.vue | 3 +-- .../components/DialogSendOrder.vue | 1 + .../4_Result/DialogSendToCommand.vue | 1 + .../7_ListSuspend/DialogSendToCommand.vue | 2 ++ .../components/7_ListSuspend/ListsPage.vue | 6 ++++- .../components/PopupSendToNext.vue | 1 + .../components/DialogCreateCommand.vue | 7 +++++- 31 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/modules/05_placement/components/AppointEmployee/DialogOrders.vue b/src/modules/05_placement/components/AppointEmployee/DialogOrders.vue index 4e1bbce3f..92021ae56 100644 --- a/src/modules/05_placement/components/AppointEmployee/DialogOrders.vue +++ b/src/modules/05_placement/components/AppointEmployee/DialogOrders.vue @@ -496,5 +496,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="dataMapToSend" + :fetch-data="props.fetchData" /> diff --git a/src/modules/05_placement/components/AppointMent/DialogOrders.vue b/src/modules/05_placement/components/AppointMent/DialogOrders.vue index 1dd5b9783..2c980c2dd 100644 --- a/src/modules/05_placement/components/AppointMent/DialogOrders.vue +++ b/src/modules/05_placement/components/AppointMent/DialogOrders.vue @@ -534,5 +534,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="dataMapToSend" + :fetch-data="props.fetchData" /> diff --git a/src/modules/05_placement/components/Help-Government/DialogOrders.vue b/src/modules/05_placement/components/Help-Government/DialogOrders.vue index d74d93e9f..f8b837900 100644 --- a/src/modules/05_placement/components/Help-Government/DialogOrders.vue +++ b/src/modules/05_placement/components/Help-Government/DialogOrders.vue @@ -334,5 +334,6 @@ function onSearch() { v-model:modal="modalCommand" :command-type-code="'C-PM-15'" :persons="dataMapToSend" + :fetch-data="props.getData" /> diff --git a/src/modules/05_placement/components/Other/DialogOrders.vue b/src/modules/05_placement/components/Other/DialogOrders.vue index 12816b288..6408d94c5 100644 --- a/src/modules/05_placement/components/Other/DialogOrders.vue +++ b/src/modules/05_placement/components/Other/DialogOrders.vue @@ -422,5 +422,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="dataMapToSend" + :fetch-data="props.fecthlistOthet" /> diff --git a/src/modules/05_placement/components/PersonalList/DialogOrders.vue b/src/modules/05_placement/components/PersonalList/DialogOrders.vue index 4367c6fe2..14a9c20f7 100644 --- a/src/modules/05_placement/components/PersonalList/DialogOrders.vue +++ b/src/modules/05_placement/components/PersonalList/DialogOrders.vue @@ -484,5 +484,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="dataMapToSend" + :fetch-data="props.fetchData" /> diff --git a/src/modules/05_placement/components/PersonalList/Table.vue b/src/modules/05_placement/components/PersonalList/Table.vue index dd467f1e0..894e5a789 100644 --- a/src/modules/05_placement/components/PersonalList/Table.vue +++ b/src/modules/05_placement/components/PersonalList/Table.vue @@ -832,13 +832,13 @@ async function getWorkFlow() { "positionCandidate", ]; } - hideLoader(); }) .catch((e) => { messageError($q, e); - hideLoader(); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } function onclickViewinfo(id: string) { @@ -1716,7 +1716,11 @@ onMounted(async () => { - + { v-model:modal="modalCommand" :command-type-code="'C-PM-14'" :persons="dataMapToSend" + :fetch-data="props.fecthlistRecevice" /> diff --git a/src/modules/05_placement/components/Repatriate/DialogOrders.vue b/src/modules/05_placement/components/Repatriate/DialogOrders.vue index dbee9ad51..f392cabb8 100644 --- a/src/modules/05_placement/components/Repatriate/DialogOrders.vue +++ b/src/modules/05_placement/components/Repatriate/DialogOrders.vue @@ -16,8 +16,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom const $q = useQuasar(); const { statusText } = useTransferDataStore(); const mixin = useCounterMixin(); -const { dialogConfirm, findPosMasterNoOld, date2Thai, onSearchDataTable } = - mixin; +const { dialogConfirm, date2Thai, onSearchDataTable } = mixin; /** props*/ const props = defineProps({ @@ -298,5 +297,6 @@ watch( v-model:modal="modalCommand" :command-type-code="'C-PM-16'" :persons="dataMapToSend" + :fetch-data="props.getData" /> diff --git a/src/modules/05_placement/components/Transfer/DialogOrders.vue b/src/modules/05_placement/components/Transfer/DialogOrders.vue index 562819344..4130f28df 100644 --- a/src/modules/05_placement/components/Transfer/DialogOrders.vue +++ b/src/modules/05_placement/components/Transfer/DialogOrders.vue @@ -292,5 +292,6 @@ watch( v-model:modal="modalCommand" command-type-code="C-PM-13" :persons="dataMapToSend" + :fetch-data="props.fetchData" /> diff --git a/src/modules/05_placement/components/probation/DialogOrder.vue b/src/modules/05_placement/components/probation/DialogOrder.vue index 414ef0ba0..58a391f44 100644 --- a/src/modules/05_placement/components/probation/DialogOrder.vue +++ b/src/modules/05_placement/components/probation/DialogOrder.vue @@ -3,8 +3,6 @@ import { ref, watch, computed } from "vue"; import { useQuasar } from "quasar"; import { useRoute } from "vue-router"; -import avatar from "@/assets/avatar_user.jpg"; - import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; @@ -15,11 +13,7 @@ import { useTransferDataStore } from "@/modules/05_placement/store"; import type { QTableProps } from "quasar"; import type { ResponseData } from "@/modules/05_placement/interface/response/Transfer"; import type { ListCommand } from "@/modules/18_command/interface/index/Main"; -import type { - FormMainProbation, - FormMainProbation2, - OpfillterType, -} from "@/modules/05_placement/interface/request/Main"; +import type { FormMainProbation } from "@/modules/05_placement/interface/request/Main"; import DialogHeader from "@/components/DialogHeader.vue"; import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue"; @@ -33,6 +27,14 @@ const storeCommand = useCommandMainStore(); const { dialogConfirm, dateText, showLoader, hideLoader, messageError } = mixin; const modal = defineModel("modal", { required: true }); +const props = defineProps({ + fetchData: { + type: Function, + default: () => { + console.warn("fetchData function is not "); + }, + }, +}); const examId = route.params.examId; const rows = ref([]); @@ -212,13 +214,13 @@ async function getList() { rows.value = data; totalList.value = Math.ceil(resTotal / pagination.value.rowsPerPage); total.value = resTotal; - hideLoader(); }) .catch((e) => { messageError($q, e); - hideLoader(); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } function updatePagination(newPagination: any) { @@ -298,7 +300,6 @@ watch( borderless outlined dense - v-model="filter" placeholder="ค้นหา" style="width: 200px; max-width: auto" @@ -427,5 +428,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="selected ? dataMapToSend : []" + :fetch-data="props.fetchData" /> diff --git a/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue index 021d6555c..7c63d807a 100644 --- a/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue +++ b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue @@ -261,5 +261,6 @@ watchEffect(() => { :command-type-code="'C-PM-10'" :persons="selected ? dataMapToSend : []" :not-person="false" + :fetch-data="props.getData" /> diff --git a/src/modules/05_placement/components/probation/MainProbation.vue b/src/modules/05_placement/components/probation/MainProbation.vue index d8a3e52c3..3af5063cf 100644 --- a/src/modules/05_placement/components/probation/MainProbation.vue +++ b/src/modules/05_placement/components/probation/MainProbation.vue @@ -866,5 +866,5 @@ onMounted(() => { - + diff --git a/src/modules/05_placement/views/02_transferMain.vue b/src/modules/05_placement/views/02_transferMain.vue index 362da553b..259d0e0f3 100644 --- a/src/modules/05_placement/views/02_transferMain.vue +++ b/src/modules/05_placement/views/02_transferMain.vue @@ -150,6 +150,7 @@ async function fetchData() { const data = await res.data.result; rows.value = data; dataTransfer.value = data; + onSearch(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/05_placement/views/03_receiveMain.vue b/src/modules/05_placement/views/03_receiveMain.vue index f6ff6729c..6c1ca08bf 100644 --- a/src/modules/05_placement/views/03_receiveMain.vue +++ b/src/modules/05_placement/views/03_receiveMain.vue @@ -230,6 +230,7 @@ async function fecthlistRecevice() { rows.value = data; rowsData.value = data; filters.value = data; + onSearch(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/05_placement/views/04_helpGovernmentMain.vue b/src/modules/05_placement/views/04_helpGovernmentMain.vue index e59bd9e47..ff8f70751 100644 --- a/src/modules/05_placement/views/04_helpGovernmentMain.vue +++ b/src/modules/05_placement/views/04_helpGovernmentMain.vue @@ -187,6 +187,7 @@ async function getData() { const data = await res.data.result; rows.value = data; rowsData.value = data; + await onSearch(); }) .catch((e) => { messageError($q, e); @@ -249,7 +250,7 @@ function closeModal() { filterKeyword2.value = ""; } -function onSearch() { +async function onSearch() { rows.value = onSearchDataTable( filterKeyword.value, rowsData.value, diff --git a/src/modules/05_placement/views/05_repatriateMain.vue b/src/modules/05_placement/views/05_repatriateMain.vue index d728066f3..d06584550 100644 --- a/src/modules/05_placement/views/05_repatriateMain.vue +++ b/src/modules/05_placement/views/05_repatriateMain.vue @@ -31,7 +31,7 @@ const { hideLoader, success, dialogRemove, - findPosMasterNoOld, + onSearchDataTable, } = useCounterMixin(); @@ -166,6 +166,7 @@ async function getData() { const data = await res.data.result; rows.value = data; rowsData.value = data; + onSearch(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/05_placement/views/06_appointPromoteMain.vue b/src/modules/05_placement/views/06_appointPromoteMain.vue index b65d53f18..e5dbf1df9 100644 --- a/src/modules/05_placement/views/06_appointPromoteMain.vue +++ b/src/modules/05_placement/views/06_appointPromoteMain.vue @@ -247,7 +247,7 @@ async function fecthlistappointment() { showLoader(); await http .get(config.API.appointmentMain() + `?status=${status.value}`) - .then((res) => { + .then(async (res) => { let response = res.data.result; listRecevice.value = response; rows.value = response; @@ -267,6 +267,7 @@ async function fecthlistappointment() { ); rows2.value = listData; rows2Data.value = listData; + await onSearch(); }) .catch((e) => { messageError($q, e); @@ -367,7 +368,7 @@ function clickClose() { modal.value = false; } -function onSearch() { +async function onSearch() { rows.value = onSearchDataTable( filterKeyword.value, rowsData.value, diff --git a/src/modules/05_placement/views/07_appointEmployeeMain.vue b/src/modules/05_placement/views/07_appointEmployeeMain.vue index 3487b2061..58949a1ad 100644 --- a/src/modules/05_placement/views/07_appointEmployeeMain.vue +++ b/src/modules/05_placement/views/07_appointEmployeeMain.vue @@ -256,6 +256,7 @@ async function fecthlistappointment() { ); rows2.value = listData; rows2Data.value = listData; + await onSearch(); }) .catch((e) => { messageError($q, e); @@ -356,7 +357,7 @@ async function onSave(data: FormDataAppoint) { }); } -function onSearch() { +async function onSearch() { rows.value = onSearchDataTable( filterKeyword.value, rowsData.value, diff --git a/src/modules/05_placement/views/08_otherMain.vue b/src/modules/05_placement/views/08_otherMain.vue index b3849c42e..68dd96bd2 100644 --- a/src/modules/05_placement/views/08_otherMain.vue +++ b/src/modules/05_placement/views/08_otherMain.vue @@ -181,7 +181,7 @@ async function fecthlistOthet() { showLoader(); await http .get(config.API.otherMain() + `?status=${status.value}`) - .then((res) => { + .then(async (res) => { let response = res.data.result; rows.value = response; rowsData.value = response; @@ -199,6 +199,7 @@ async function fecthlistOthet() { ); rows2.value = listData; rows2Data.value = listData; + await onSearch(); }) .catch((e) => { messageError($q, e); @@ -312,7 +313,7 @@ function nextPage(id: string) { }); } -function onSearch() { +async function onSearch() { rows.value = onSearchDataTable( filterKeyword.value, rowsData.value, diff --git a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue index 0854bc10e..4faf818c6 100644 --- a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue +++ b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue @@ -334,5 +334,6 @@ watch( v-model:modal="modalCommand" :command-type-code="props.mainTabs === '1' ? 'C-PM-17' : 'C-PM-41'" :persons="dataMapToSend" + :fetch-data="props.fecthList" /> diff --git a/src/modules/06_retirement/components/02_resign/Table.vue b/src/modules/06_retirement/components/02_resign/Table.vue index 4379ec5c7..f7ce244ae 100644 --- a/src/modules/06_retirement/components/02_resign/Table.vue +++ b/src/modules/06_retirement/components/02_resign/Table.vue @@ -219,8 +219,9 @@ async function fecthlist() { .get(pathAPI) .then(async (res) => { const data = await res.data.result; - rows.value = data; rowsData.value = data; + rows.value = data; + onSearch(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/06_retirement/components/03_resignEmp/DialogSendToCommand.vue b/src/modules/06_retirement/components/03_resignEmp/DialogSendToCommand.vue index b90c88e31..c5aef2397 100644 --- a/src/modules/06_retirement/components/03_resignEmp/DialogSendToCommand.vue +++ b/src/modules/06_retirement/components/03_resignEmp/DialogSendToCommand.vue @@ -309,5 +309,6 @@ watch( v-model:modal="modalCommand" :command-type-code="props.mainTabs === '1' ? 'C-PM-23' : 'C-PM-42'" :persons="dataMapToSend" + :fecth-list="props.fecthList" /> diff --git a/src/modules/06_retirement/components/03_resignEmp/Table.vue b/src/modules/06_retirement/components/03_resignEmp/Table.vue index eb1e17795..0b9c8db2f 100644 --- a/src/modules/06_retirement/components/03_resignEmp/Table.vue +++ b/src/modules/06_retirement/components/03_resignEmp/Table.vue @@ -215,6 +215,7 @@ async function fecthlist() { const data = await res.data.result; rows.value = data; rowsData.value = data; + onSearch(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommand.vue b/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommand.vue index 3c4aca498..4c37564ea 100644 --- a/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommand.vue +++ b/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommand.vue @@ -3,8 +3,6 @@ import { ref, computed, watchEffect } from "vue"; import { useQuasar } from "quasar"; import type { QTableProps } from "quasar"; -import http from "@/plugins/http"; -import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store"; @@ -297,5 +295,6 @@ watchEffect(() => { v-model:modal="modalCommand" :command-type-code="'C-PM-18'" :persons="dataMapToSend" + :fetch-data="props.fecthlistRecevice" /> diff --git a/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommandEmp.vue b/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommandEmp.vue index fa2c3d6be..9c71feb3a 100644 --- a/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommandEmp.vue +++ b/src/modules/06_retirement/components/06_dismissOrder/DialogSendToCommandEmp.vue @@ -3,8 +3,6 @@ import { ref, computed, watchEffect } from "vue"; import { useQuasar } from "quasar"; import type { QTableProps } from "quasar"; -import http from "@/plugins/http"; -import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store"; @@ -297,5 +295,6 @@ watchEffect(() => { v-model:modal="modalCommand" :command-type-code="'C-PM-43'" :persons="dataMapToSend" + :fetch-data="props.fecthlistRecevice" /> diff --git a/src/modules/08_registryEmployee/components/DialogSendOrder.vue b/src/modules/08_registryEmployee/components/DialogSendOrder.vue index aa71abd62..63ec5ecfc 100644 --- a/src/modules/08_registryEmployee/components/DialogSendOrder.vue +++ b/src/modules/08_registryEmployee/components/DialogSendOrder.vue @@ -354,6 +354,7 @@ watch( v-model:modal="modalCommand" :command-type-code="'C-PM-21'" :persons="dataMapToSend" + :fetch-data="props.fetchData" /> diff --git a/src/modules/11_discipline/components/4_Result/DialogSendToCommand.vue b/src/modules/11_discipline/components/4_Result/DialogSendToCommand.vue index 2189cdf14..362400c53 100644 --- a/src/modules/11_discipline/components/4_Result/DialogSendToCommand.vue +++ b/src/modules/11_discipline/components/4_Result/DialogSendToCommand.vue @@ -322,5 +322,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="selected ? dataMapToSend : []" + :fetch-data="props.getData" /> diff --git a/src/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue b/src/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue index 080f38c69..c9a657793 100644 --- a/src/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue +++ b/src/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue @@ -46,6 +46,7 @@ const filterKeyword = ref(""); /** props*/ const props = defineProps<{ rows: dataType[]; + fetchData: Function; }>(); /** คอลัมน์ */ @@ -324,5 +325,6 @@ watch( v-model:modal="modalCommand" :command-type-code="commandType" :persons="selected ? dataMapToSend : []" + :fetch-data="props.fetchData" /> diff --git a/src/modules/11_discipline/components/7_ListSuspend/ListsPage.vue b/src/modules/11_discipline/components/7_ListSuspend/ListsPage.vue index a4427b18c..bb391a6a0 100644 --- a/src/modules/11_discipline/components/7_ListSuspend/ListsPage.vue +++ b/src/modules/11_discipline/components/7_ListSuspend/ListsPage.vue @@ -494,6 +494,10 @@ onMounted(async () => { - + diff --git a/src/modules/11_discipline/components/PopupSendToNext.vue b/src/modules/11_discipline/components/PopupSendToNext.vue index f7c88df29..441d2b5b7 100644 --- a/src/modules/11_discipline/components/PopupSendToNext.vue +++ b/src/modules/11_discipline/components/PopupSendToNext.vue @@ -243,6 +243,7 @@ watch( v-model:modal="modalCommand" :command-type-code="'C-PM-32'" :persons="selected ? dataMapToSend : []" + :fetch-data="props.fetchData" /> diff --git a/src/modules/18_command/components/DialogCreateCommand.vue b/src/modules/18_command/components/DialogCreateCommand.vue index 822b82858..393a5e2b2 100644 --- a/src/modules/18_command/components/DialogCreateCommand.vue +++ b/src/modules/18_command/components/DialogCreateCommand.vue @@ -35,6 +35,10 @@ const props = defineProps({ type: Boolean, default: false, }, + fetchData: { + type: Function, + default: () => {}, + }, }); const commandOp = ref([]); // ประเภทคำสั่ง @@ -208,6 +212,7 @@ function createCommand(isRedirect: boolean) { router.push(`/command/edit/${id}`); } else { clearValue(); + await props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล } }) .catch((e) => { @@ -253,7 +258,7 @@ function addPersonalToCommand(isRedirect: boolean) { router.push(`/command/edit/${id}`); } else { modal.value = false; - clearValue(); + await props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล } }) .catch((e) => {