From 5a220774eb062d016ae72b815e6e13fb0e1f8107 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 2 May 2024 11:38:55 +0700 Subject: [PATCH 1/5] =?UTF-8?q?=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=20=3D>=20=E0=B8=8A?= =?UTF-8?q?=E0=B9=88=E0=B8=A7=E0=B8=A2=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3,=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B8=95?= =?UTF-8?q?=E0=B8=B1=E0=B8=A7=E0=B8=81=E0=B8=A5=E0=B8=B1=E0=B8=9A=20?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Repatriate/Dialogbody.vue | 209 ++++++++++------ .../components/Repatriate/RepatriateMain.vue | 166 +++++-------- .../components/Repatriate/RepatriatebyId.vue | 1 + .../components/helpgovernment/Dialogbody.vue | 229 +++++++++++------- .../components/helpgovernment/mainHelp.vue | 214 ++++++---------- 5 files changed, 399 insertions(+), 420 deletions(-) diff --git a/src/modules/05_placement/components/Repatriate/Dialogbody.vue b/src/modules/05_placement/components/Repatriate/Dialogbody.vue index 4d00e0f81..79d59db47 100644 --- a/src/modules/05_placement/components/Repatriate/Dialogbody.vue +++ b/src/modules/05_placement/components/Repatriate/Dialogbody.vue @@ -2,6 +2,8 @@ import { ref, computed, watchEffect } from "vue"; import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; +import { useTransferDataStore } from "@/modules/05_placement/store"; + import type { QTableProps } from "quasar"; import type { officerType } from "@/modules/05_placement/interface/response/officer"; @@ -11,20 +13,21 @@ import config from "@/app.config"; const $q = useQuasar(); const selected = ref([]); -const mixin = useCounterMixin(); -const { showLoader, success, messageError, dialogConfirm,hideLoader } = mixin; +const transferStore = useTransferDataStore(); + +const { statusText } = transferStore; +const mixin = useCounterMixin(); +const { + showLoader, + success, + messageError, + dialogConfirm, + hideLoader, + findOrgName, + findPosMasterNo, + date2Thai, +} = mixin; -const visibleColumns2 = ref([ - "no", - "fullname", - "posNo", - "position", - "positionLevel", - "organizationPositionOld", - "organization", - "createdAt", - "statusText", -]); const columns2 = ref([ { name: "no", @@ -36,22 +39,28 @@ const columns2 = ref([ style: "font-size: 14px", }, { - name: "fullname", + name: "name", align: "left", label: "ชื่อ-นามสกุล", sortable: true, - field: "fullname", + field: "naem", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.prefix}${row.firstName} ${row.lastName}`; + }, }, { name: "posNo", align: "left", - label: "ตำแหน่งเลขที่", + label: "เลขที่ตำแหน่ง", sortable: true, field: "posNo", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findPosMasterNo(row); + }, }, { name: "position", @@ -65,11 +74,14 @@ const columns2 = ref([ { name: "positionLevel", align: "left", - label: "ระดับ", + label: "ประเภทตำแหน่ง", sortable: true, field: "positionLevel", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.posTypeName} (${row.posLevelName})`; + }, }, { name: "organizationPositionOld", @@ -79,6 +91,9 @@ const columns2 = ref([ field: "organizationPositionOld", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findOrgName(row); + }, }, { name: "organization", @@ -97,30 +112,39 @@ const columns2 = ref([ 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", + format: (val) => date2Thai(val), }, { - name: "statusText", + name: "status", align: "left", label: "สถานะ", sortable: true, - field: "statusText", + field: "status", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (val) => statusText(val), }, ]); +const visibleColumns2 = ref([ + "no", + "name", + "posNo", + "position", + "positionLevel", + "organizationPositionOld", + "organization", + "createdAt", + "status", +]); const props = defineProps({ Modal: Boolean, closeModal: Function, getData: Function, rows2: Array, - filterKeyword2:String, + filterKeyword2: String, }); - const checkSelected = computed(() => { if (selected.value.length === 0) { return true; @@ -129,8 +153,13 @@ const checkSelected = computed(() => { //popup ยืนยันส่งัว const saveOrder = () => { - dialogConfirm($q,() => Ordersave(),"ยืนยันส่งไปออกคำสั่ง","ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" ) -} + dialogConfirm( + $q, + () => Ordersave(), + "ยืนยันส่งไปออกคำสั่ง", + "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" + ); +}; //ส่งไปออกคำสั่ง const Ordersave = async () => { const id = selected.value.map((item) => item.id); @@ -149,22 +178,18 @@ const Ordersave = async () => { messageError($q, e); }) .finally(async () => { - props.getData?.(); + props.getData?.(); hideLoader(); }); }; -const emit = defineEmits([ - "update:filterKeyword2", - "update:selected", - -]); +const emit = defineEmits(["update:filterKeyword2", "update:selected"]); const updateInput = (value: any) => { emit("update:filterKeyword2", value); }; //รีเซ็ตค่าในช่องค้นหา const Reset = () => { - emit("update:filterKeyword2", ""); + emit("update:filterKeyword2", ""); }; watchEffect(() => { if (props.Modal === true) { @@ -173,79 +198,111 @@ watchEffect(() => { }); \ 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 b08374d15..5a85adc91 100644 --- a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue +++ b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue @@ -34,24 +34,6 @@ const { findPosMasterNo, } = mixin; -const visibleColumns = ref([ - "no", - "fullname", - "posNo", - "position", - "positionLevel", - "organizationPositionOld", - "organization", - "createdAt", - "statusText", -]); -// รีเซ้ตค่าในช่อง ฟิลเตอร์ -const resetFilter = () => { - filterKeyword.value = ""; - filterKeyword2.value = ""; - filterRef.value.focus(); -}; - // หัวตาราง const columns = ref([ { @@ -64,13 +46,16 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "fullname", + name: "name", align: "left", label: "ชื่อ-นามสกุล", sortable: true, - field: "fullname", + field: "naem", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.prefix}${row.firstName} ${row.lastName}`; + }, }, { name: "posNo", @@ -80,6 +65,9 @@ const columns = ref([ field: "posNo", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findPosMasterNo(row); + }, }, { name: "position", @@ -98,6 +86,9 @@ const columns = ref([ field: "positionLevel", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.posTypeName} (${row.posLevelName})`; + }, }, { name: "organizationPositionOld", @@ -107,6 +98,9 @@ const columns = ref([ field: "organizationPositionOld", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findOrgName(row); + }, }, { name: "organization", @@ -125,20 +119,37 @@ const columns = ref([ 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", + format: (val) => date2Thai(val), }, { - name: "statusText", + name: "status", align: "left", label: "สถานะ", sortable: true, - field: "statusText", + field: "status", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (val) => statusText(val), }, ]); +const visibleColumns = ref([ + "no", + "name", + "posNo", + "position", + "positionLevel", + "organizationPositionOld", + "organization", + "createdAt", + "status", +]); + +// รีเซ้ตค่าในช่อง ฟิลเตอร์ +const resetFilter = () => { + filterKeyword.value = ""; + filterKeyword2.value = ""; + filterRef.value.focus(); +}; //เปิดรายละเอียด const openDetail = (id: string) => { @@ -169,6 +180,7 @@ const openModalOrder = () => { item.date && item.dateRepatriation ); + rows2.value = row; }; @@ -179,33 +191,11 @@ const getData = async () => { .get(config.API.repatriationMain()) .then((res: any) => { const data = res.data.result; - rows.value = data.map((item: officerType) => ({ - id: item.id, - fullname: `${item.prefix}${item.firstName} ${item.lastName}`, - position: item.position, - posNo: findPosMasterNo(item), - positionLevel: - item.posTypeName == null && item.posLevelName == null - ? "-" - : (item.posTypeName != null ? item.posTypeName : "") + - " " + - (item.posLevelName != null ? ` (${item.posLevelName})` : ""), - createdAt: date2Thai(item.createdAt), - organization: item.organization, - reason: item.reason, - status: item.status, - statusText: statusText(item.status), - date: item.date, - salary: item.salary, - positionTypeOld: item.positionTypeOld, - positionLevelOld: item.positionLevelOld, - positionNumberOld: item.positionNumberOld, - organizationPositionOld: item.organizationPositionOld, - isActive: item.isActive, - dateRepatriation: item.dateRepatriation, - })); + rows.value = data; + }) + .catch((e) => { + messageError($q, e); }) - .catch((e) => {}) .finally(() => { hideLoader(); }); @@ -308,69 +298,27 @@ onMounted(async () => { diff --git a/src/modules/05_placement/components/helpgovernment/mainHelp.vue b/src/modules/05_placement/components/helpgovernment/mainHelp.vue index b5a6c995d..0b3b026e0 100644 --- a/src/modules/05_placement/components/helpgovernment/mainHelp.vue +++ b/src/modules/05_placement/components/helpgovernment/mainHelp.vue @@ -35,21 +35,6 @@ const { findPosMasterNo, } = mixin; -//ค้นหา คอลัมน์ คอลัมน์ที่แสดง -const visibleColumns = ref([ - "no", - "fullname", - "posNo", - "position", - "positionLevel", - "organizationPositionOld", - "organization", - "dateStart", - "dateEnd", - "createdAt", - "statusText", -]); - //หัวตาราง const columns = ref([ { @@ -62,13 +47,16 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "fullname", + name: "name", align: "left", label: "ชื่อ-นามสกุล", sortable: true, - field: "fullname", + field: "name", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.prefix}${row.firstName} ${row.lastName}`; + }, }, { name: "posNo", @@ -78,6 +66,9 @@ const columns = ref([ field: "posNo", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findPosMasterNo(row); + }, }, { name: "position", @@ -96,6 +87,9 @@ const columns = ref([ field: "positionLevel", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return `${row.posTypeName} (${row.posLevelName})`; + }, }, { name: "organizationPositionOld", @@ -105,6 +99,9 @@ const columns = ref([ field: "organizationPositionOld", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return findOrgName(row); + }, }, { name: "organization", @@ -123,8 +120,7 @@ const columns = ref([ field: "dateStart", headerStyle: "font-size: 14px", style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + format: (val) => date2Thai(val), }, { name: "dateEnd", @@ -134,8 +130,7 @@ const columns = ref([ field: "dateEnd", headerStyle: "font-size: 14px", style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + format: (val) => date2Thai(val), }, { name: "createdAt", @@ -145,20 +140,32 @@ const columns = ref([ 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", + format: (val) => date2Thai(val), }, { - name: "statusText", + name: "status", align: "left", label: "สถานะ", sortable: true, - field: "statusText", + field: "status", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (val) => statusText(val), }, ]); +const visibleColumns = ref([ + "no", + "name", + "posNo", + "position", + "positionLevel", + "organizationPositionOld", + "organization", + "dateStart", + "dateEnd", + "createdAt", + "status", +]); //รีเซ็ตข้อมูลในช่องฟิลเตอร์ const resetFilter = () => { @@ -195,57 +202,32 @@ const getData = async () => { .get(config.API.officerMain()) .then((res: any) => { const data = res.data.result; - rows.value = data.map((item: officerType) => ({ - id: item.id, - fullname: `${item.prefix}${item.firstName} ${item.lastName}`, - position: item.position != null ? item.position : "-", - posNo: findPosMasterNo(item), - positionLevel: - item.posTypeName == null && item.posLevelName == null - ? "-" - : (item.posTypeName != null ? item.posTypeName : "") + - " " + - (item.posLevelName != null ? ` (${item.posLevelName})` : ""), - createdAt: date2Thai(item.createdAt), - organization: item.organization, - reason: item.reason, - status: item.status, - statusText: statusText(item.status), - date: item.date, - salary: item.salary, - positionTypeOld: item.positionTypeOld, - positionLevelOld: item.positionLevelOld, - positionNumberOld: item.positionNumberOld, - organizationPositionOld: findOrgName(item), - isActive: item.isActive, - dateEnd: item.dateEnd == null ? "" : date2Thai(new Date(item.dateEnd)), - dateStart: - item.dateStart == null ? "" : date2Thai(new Date(item.dateStart)), - })); + rows.value = data; + }) + .catch((e) => { + messageError($q, e); }) - - .catch((e) => {}) .finally(() => { hideLoader(); }); }; -const deleteData = async (id: string) => { - await http - .delete(config.API.officerMainDelete(id)) - .then((res) => { - success($q, "ลบข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await getData(); - }); -}; - -const clickDelete = async (name: string, id: string) => { - dialogRemove($q, async () => await deleteData(id)); +const clickDelete = async (id: string) => { + dialogRemove($q, () => { + showLoader(); + http + .delete(config.API.officerMainDelete(id)) + .then(() => { + getData(); + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }); }; onMounted(async () => { await getData(); @@ -326,83 +308,27 @@ onMounted(async () => {