From c272838c5fb5d183512d52757fb65d56d3078d50 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 28 Aug 2023 11:07:26 +0700 Subject: [PATCH 01/14] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84?= =?UTF-8?q?=E0=B8=82=20=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B8=AA=E0=B8=A3?= =?UTF-8?q?=E0=B8=A3=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/4_Allocate/DialogEdit.vue | 117 +++++ .../components/4_Allocate/Main.vue | 487 +++++++++++++++--- .../components/4_Allocate/OrgList.vue | 270 ++++++++-- 3 files changed, 751 insertions(+), 123 deletions(-) create mode 100644 src/modules/07_insignia/components/4_Allocate/DialogEdit.vue diff --git a/src/modules/07_insignia/components/4_Allocate/DialogEdit.vue b/src/modules/07_insignia/components/4_Allocate/DialogEdit.vue new file mode 100644 index 000000000..ab6721bbe --- /dev/null +++ b/src/modules/07_insignia/components/4_Allocate/DialogEdit.vue @@ -0,0 +1,117 @@ + + + + diff --git a/src/modules/07_insignia/components/4_Allocate/Main.vue b/src/modules/07_insignia/components/4_Allocate/Main.vue index 027a0f341..b6f8d2840 100644 --- a/src/modules/07_insignia/components/4_Allocate/Main.vue +++ b/src/modules/07_insignia/components/4_Allocate/Main.vue @@ -8,6 +8,7 @@ import { useResultDataStore } from "@/modules/07_insignia/storeAllocate"; import type { FormProprsalsRound } from "@/modules/07_insignia/interface/request/Main"; import router from "@/router"; import DialogForm from "@/modules/07_insignia/components/4_Allocate/DialogForm.vue"; +import DialogEdit from "@/modules/07_insignia/components/4_Allocate/DialogEdit.vue"; import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main"; import type { QTableProps, QInput } from "quasar"; @@ -15,15 +16,10 @@ import { useQuasar } from "quasar"; const DataStore = useResultDataStore(); const mixin = useCounterMixin(); -const { - showLoader, - hideLoader, - messageError, - -} = mixin; +const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin; const redirectToPage = (id: string, name: string) => { - DataStore.insigniaName = name + DataStore.insigniaName = name; router.push(`/insignia/allocate/org/${id}`); }; const paging = ref(true); @@ -63,7 +59,7 @@ const fecthRound = async () => { selectRoundOption.value = data.map((e: any) => ({ id: e.id, name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), - year: e.year + year: e.year, })); selectRound.value = data[0].id; roundYear.value = data[0].year; @@ -82,10 +78,13 @@ const fecthInsignia = async () => { DataStore.fetchDatainsignia(data); }) .catch((err) => { - messageError($q, err) - }).finally(async () => { - insigniaOp.value = await DataStore.insigniaOp.filter((x: any) => x.type == tab.value) + messageError($q, err); }) + .finally(async () => { + insigniaOp.value = await DataStore.insigniaOp.filter( + (x: any) => x.type == tab.value + ); + }); }; const fecthInsigniaType = async () => { @@ -96,7 +95,7 @@ const fecthInsigniaType = async () => { DataStore.fetchDatainsigniaType(data); tab.value = DataStore.insigniaType[0].name; - fecthlistInsignia() + fecthlistInsignia(); fecthInsignia(); }) .catch((err) => { @@ -162,7 +161,9 @@ const columns = ref([ const rows = ref([]); watch(tab, () => { - insigniaOp.value = DataStore.insigniaOp.filter((x: any) => x.type == tab.value) + insigniaOp.value = DataStore.insigniaOp.filter( + (x: any) => x.type == tab.value + ); fecthlistInsignia(); }); @@ -171,7 +172,7 @@ const selectorInsignia = () => { }; const selectorRound = (round: string) => { selectRound.value = round; - const yearFilter = selectRoundOption.value.find((x: any) => x.id == round) + const yearFilter = selectRoundOption.value.find((x: any) => x.id == round); roundYear.value = yearFilter?.year; }; @@ -190,6 +191,7 @@ const fecthlistInsignia = async () => { total: e.total, allocate: e.allocate, remain: e.remain, + year: e.year, // status: DataStore.status(e.status), })); }) @@ -202,12 +204,12 @@ const fecthlistInsignia = async () => { }); }; - const filterRef = ref(); const filter = ref(""); const close = () => { modal.value = false; + modalEdit.value = false; }; const addData = () => { @@ -222,24 +224,74 @@ const editData = (data: any) => { modal.value = true; }; +const modalEdit = ref(false); +const rowData = ref([]); +const actionType = ref(""); +const clickEditrow = (data: any) => { + rowData.value = data; + modalEdit.value = true; + actionType.value = "insignia"; + console.log(data); +}; + const save = async (insigniaId: string, total: string) => { - showLoader() + showLoader(); await http .post(config.API.insigniaManageAdd(), { insignia: insigniaId, year: `${roundYear.value}`, total: total, }) - .then((res) => { - fecthlistInsignia(); + .then(async () => { + success($q, "บันทึกข้อมูลสำเร็จ"); + await fecthlistInsignia(); }) .catch((err) => { - messageError($q, err) - }).finally(() => { + messageError($q, err); + }) + .finally(() => { hideLoader(); close(); }); }; +const saveEdit = async (insigniaId: string, total: Number, year: Number) => { + showLoader(); + let body = { + insignia: insigniaId, + year: year, + total: Number(total), + }; + await http + .put(config.API.insigniaManageById(insigniaId), body) + .then(async () => { + success($q, "แก้ไขข้อมูลสำเร็จ"); + await fecthlistInsignia(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + close(); + }); +}; +const clickDelete = async (insigniaId: string) => { + dialogRemove($q, async () => { + showLoader(); + await http + .delete(config.API.insigniaManageById(insigniaId)) + .then(async () => { + success($q, "ลบข้อมูลสำเร็จ"); + await fecthlistInsignia(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }); +}; const resetFilter = () => { // reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา @@ -255,13 +307,34 @@ const resetFilter = () => {
รอบ
- +
- +
@@ -274,14 +347,34 @@ const resetFilter = () => {
- +
- + เพิ่ม
@@ -290,31 +383,74 @@ const resetFilter = () => {
- + - +
- +
- +
- + เพิ่ม
@@ -358,11 +575,17 @@ const resetFilter = () => { - - บันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์ + + บันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์ - + บันทึกผลการจ่ายใบกำกับ @@ -374,21 +597,52 @@ const resetFilter = () => {
- + - +
- +