From 3e9071982b418524fba84816f64d3c99c8051c71 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 20 Sep 2023 17:34:22 +0700 Subject: [PATCH] =?UTF-8?q?Refactor=20Code+component=20=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AA=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=81=E0=B8=A5=E0=B8=B1=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AppointMent/Dialogbody.vue | 2 - .../components/Repatriate/Dialogbody.vue | 251 ++++++++++ .../components/Repatriate/RepatriateMain.vue | 447 +++--------------- 3 files changed, 311 insertions(+), 389 deletions(-) create mode 100644 src/modules/05_placement/components/Repatriate/Dialogbody.vue diff --git a/src/modules/05_placement/components/AppointMent/Dialogbody.vue b/src/modules/05_placement/components/AppointMent/Dialogbody.vue index b441b031a..8be6c90e6 100644 --- a/src/modules/05_placement/components/AppointMent/Dialogbody.vue +++ b/src/modules/05_placement/components/AppointMent/Dialogbody.vue @@ -22,7 +22,6 @@ const checkSelected = computed(() => { const props = defineProps({ Modal: Boolean, clickClose: Function, - resetFilter: Function, fecthlistappointment: Function, nextPage: Function, optionsType: Array, @@ -153,7 +152,6 @@ watchEffect(() => {
- {{ type }} +import { ref, computed, watchEffect } from "vue"; +import { useQuasar } from "quasar"; +import { useCounterMixin } from "@/stores/mixin"; +import type { QTableProps } from "quasar"; +import type { officerType } from "@/modules/05_placement/interface/response/officer"; + +import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue"; +import http from "@/plugins/http"; +import config from "@/app.config"; + +const $q = useQuasar(); +const selected = ref([]); +const mixin = useCounterMixin(); +const { showLoader, success, messageError, dialogConfirm,hideLoader } = mixin; + +const visibleColumns2 = ref([ + "no", + "fullname", + "posNo", + "position", + "positionLevel", + "organizationPositionOld", + "organization", + "createdAt", + "statusText", +]); +const columns2 = ref([ + { + name: "no", + align: "left", + label: "ลำดับ", + sortable: false, + field: "no", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "fullname", + align: "left", + label: "ชื่อ-นามสกุล", + sortable: true, + field: "fullname", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "posNo", + align: "left", + label: "ตำแหน่งเลขที่", + sortable: true, + field: "posNo", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "position", + align: "left", + label: "ตำแหน่งในสายงาน", + sortable: true, + field: "position", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "positionLevel", + align: "left", + label: "ระดับ", + sortable: true, + field: "positionLevel", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "organizationPositionOld", + align: "left", + label: "สังกัด", + sortable: true, + field: "organizationPositionOld", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "organization", + align: "left", + label: "หน่วยงานที่ให้ช่วยราชการ", + sortable: true, + field: "organization", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "createdAt", + align: "left", + label: "วันที่ดำเนินการ", + sortable: true, + field: "createdAt", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + sortOrder: "da", + }, + { + name: "statusText", + align: "left", + label: "สถานะ", + sortable: true, + field: "statusText", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + +const props = defineProps({ + Modal: Boolean, + closeModal: Function, + getData: Function, + rows2: Array, + filterKeyword2:String, +}); + + +const checkSelected = computed(() => { + if (selected.value.length === 0) { + return true; + } +}); + +//popup ยืนยันส่งัว +const saveOrder = () => { + dialogConfirm($q,() => Ordersave(),"ยืนยันส่งไปออกคำสั่ง","ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" ) +} +//ส่งไปออกคำสั่ง +const Ordersave = async () => { + const id = selected.value.map((item) => item.id); + const body = { + id, + }; + + showLoader(); + await http + .post(config.API.repatriationMainReport(), body) + .then((res: any) => { + success($q, "ส่งไปออกคำสั่งส่งตัวกลับสำเร็จ"); + props.closeModal?.(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + props.getData?.(); + hideLoader(); + }); +}; + +const emit = defineEmits([ + "update:filterKeyword2", + "update:selected", + +]); +const updateInput = (value: any) => { + emit("update:filterKeyword2", value); +}; +//รีเซ็ตค่าในช่องค้นหา +const Reset = () => { + emit("update:filterKeyword2", ""); +}; +watchEffect(() => { + if (props.Modal === true) { + selected.value = []; + } +}); + + \ No newline at end of file diff --git a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue index 2e65fa1f7..f50787d2f 100644 --- a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue +++ b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue @@ -1,41 +1,37 @@