diff --git a/src/components/CardProfile.vue b/src/components/CardProfile.vue new file mode 100644 index 000000000..e73dbbab3 --- /dev/null +++ b/src/components/CardProfile.vue @@ -0,0 +1,140 @@ + + + + + diff --git a/src/components/Dialogs/PopupPersonalNew.vue b/src/components/Dialogs/PopupPersonalNew.vue index d9664e4cb..df0e8794a 100644 --- a/src/components/Dialogs/PopupPersonalNew.vue +++ b/src/components/Dialogs/PopupPersonalNew.vue @@ -142,7 +142,7 @@ async function fetchProfileGov(id: string) { goverment.positionType = data.posType !== "" ? data.posType : "-"; goverment.positionLevel = data.posLevel !== "" ? data.posLevel : "-"; goverment.positionExecutive = - data.posExecutive !== "" ? data.posExecutive : "-"; + data.posExecutive !== null ? data.posExecutive : "-"; goverment.positionExecutiveSide = data.positionExecutiveField !== "" ? data.positionExecutiveField : "-"; }) @@ -172,9 +172,12 @@ watch( async () => { modal.value = props.modal ? props.modal : false; if (modal.value) { - props.id && (fetchInformation(props.id), fetchProfileGov(props.id)); - (fileName.value = `profile-${props.id}`), + if (props.id) { + fetchInformation(props.id); + fetchProfileGov(props.id); + fileName.value = `profile-${props.id}`; fetchProfile(props.id as string); + } } } ); @@ -214,11 +217,6 @@ async function fetchProfile(id: string) { style="color: red; background-color: #ffdede" /> -
diff --git a/src/interface/main.ts b/src/interface/main.ts index cb2e79ee5..21a88d9d6 100644 --- a/src/interface/main.ts +++ b/src/interface/main.ts @@ -2,5 +2,13 @@ interface DataOption { id: string; label: string; } +interface FormProfile { + id: string; + avatar: string; + fullName: string; + position: string; + positionLevel: string; + organization: string; +} -export type { DataOption }; +export type { DataOption, FormProfile }; 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 () => {