From 008c47084e96e3f122349d181ac9b040d3ee65b5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 26 Dec 2024 17:15:07 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=97=E0=B8=94=E0=B8=A5=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DialogOrder/DialogSendToCommand.vue | 20 +++++++------ .../probation/FormAppoint/FormAppoint.vue | 28 ++++++++----------- .../05_placement/interface/request/Main.ts | 2 ++ .../components/DialogCreateCommand.vue | 1 - 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue index dc365122a..bba6aa29e 100644 --- a/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue +++ b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue @@ -17,14 +17,18 @@ const mixin = useCounterMixin(); const { dialogConfirm, onSearchDataTable } = mixin; const dataMapToSend = computed(() => { - return selected.value.map((i: any) => ({ - id: i.id, - profileId: null, - prefix: null, - firstName: null, - lastName: null, - citizenId: null, - })); + const firstSelected = selected.value[0]; + return firstSelected + ? firstSelected.directors.map((i: any) => ({ + id: firstSelected.id, + profileId: i.profileId, + prefix: i.prefix, + firstName: i.firstName, + lastName: i.lastName, + citizenId: i.citizenId, + rootId: i.rootId, + })) + : []; }); const filterKeyword = defineModel("filterKeyword", { required: true }); diff --git a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue index 2320af0d5..538682ffe 100644 --- a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue +++ b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue @@ -280,8 +280,10 @@ function onAddPerson() { actFullName: item.actFullName, posNo: item.posNo, role: member.value, + rootId: item.orgRootId, })); - rows.value = [...rows.value, ...data]; + + rows.value.push(...data); const roleOrder: Record<"chairman" | "committee" | "caregiver", number> = { chairman: 0, committee: 1, @@ -294,6 +296,7 @@ function onAddPerson() { roleOrder[b.role as keyof typeof roleOrder] ); }); + close(); } @@ -365,25 +368,24 @@ function changeFormData() { function onSubmit() { const body = { topic: topic.value, - persons: rows.value.map( - ({ prefix, firstName, lastName, citizenId, ...newData }) => newData - ), + persons: rows.value.map(({ ...newData }) => newData), }; - dialogConfirm($q, () => { + + dialogConfirm($q, async () => { showLoader(); - http + await http .put(config.API.appointMain + `/${id.value}`, body) - .then(async (res) => { + .then(async () => { await getData(); success($q, "บันทึกข้อมูลสำเร็จ"); isSave.value = false; - hideLoader(); }) .catch((e) => { messageError($q, e); - hideLoader(); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); }); } @@ -446,17 +448,11 @@ async function onAct() { selected.value = []; } -function resetFilter() { - pagination.value.page = 1; - filterKeyword.value = ""; - getPerson(); -} watch( () => modal.value, () => { if (modal.value) { filterKeyword.value = ""; - optionsTypeMain.value = optionsType.value; const optionData = optionsType.value; const caregiverCount = rows.value.filter( diff --git a/src/modules/05_placement/interface/request/Main.ts b/src/modules/05_placement/interface/request/Main.ts index e59bf4781..1d405f3e7 100644 --- a/src/modules/05_placement/interface/request/Main.ts +++ b/src/modules/05_placement/interface/request/Main.ts @@ -96,6 +96,7 @@ interface AppointMainRows { topic: string; commandNo: string; status: string; + directors: any[]; } interface FormAppointData { @@ -130,6 +131,7 @@ interface MemBerType { posNo: string; actFullName: string; isDirector?: boolean; + orgRootId?: string; } interface FormDataAppoint { diff --git a/src/modules/18_command/components/DialogCreateCommand.vue b/src/modules/18_command/components/DialogCreateCommand.vue index 1bfc31e58..8911e824e 100644 --- a/src/modules/18_command/components/DialogCreateCommand.vue +++ b/src/modules/18_command/components/DialogCreateCommand.vue @@ -275,7 +275,6 @@ async function fetchCommandType() { (v: ListCommand) => v.code == props.commandTypeCode ); commandType.value = commandOp.value[0].id; - console.log("🚀 ~ fetchCommandType ~ commandType.value:", commandType.value); } /**