diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue index 7bbc69e65..08f6f263b 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -26,7 +26,6 @@ import DialogHistory from "@/modules/04_registryPerson/components/detail/Governm import { useCounterMixin } from "@/stores/mixin"; import { useSalaryDataStore } from "@/modules/04_registryPerson/stores/salary"; import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue"; -const { findOrgName } = useCounterMixin(); const $q = useQuasar(); const route = useRoute(); @@ -50,6 +49,7 @@ const { pathRegistryEmp, onSearchDataTable, formatDatePosition, + findOrgName, } = useCounterMixin(); const empType = ref(pathRegistryEmp(route.name?.toString() ?? "")); @@ -561,13 +561,13 @@ function onSubmit() { !isStatusEdit.value && empType.value === "" ? profileId.value : undefined, - date: formDataSalary.date, // วันที่ + // date: formDataSalary.date, // วันที่ posNo: formDataSalary.posNo, //ตำแหน่งเลขที่ - position: formDataSalary.position, //ตำแหน่ง - positionLine: - empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน - positionPathSide: - empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา + // position: formDataSalary.position, //ตำแหน่ง + // positionLine: + // empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน + // positionPathSide: + // empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา positionExecutive: empType.value === "" ? formDataSalary.positionExecutive : undefined, //ตำแหน่งทางการบริหาร positionType: formDataSalary.positionType, // ประเภทตำแหน่ง @@ -588,8 +588,12 @@ function onSubmit() { typeof formDataSalary.amountSpecial === "number" ? formDataSalary.amountSpecial : Number(formDataSalary?.amountSpecial?.replace(/,/g, "")), //เงินค่าตอบแทนพิเศษ - refCommandNo: formDataSalary.refCommandNo, // เลขที่คำสั่ง - templateDoc: formDataSalary.doc, // เอกสารอ้างอิง + // refCommandNo: formDataSalary.refCommandNo, // เลขที่คำสั่ง + // templateDoc: formDataSalary.doc, // เอกสารอ้างอิง + posNoAbb: null, + positionName: "positionName", + remark: "remark", + commandCode: "1", }; try { @@ -785,18 +789,26 @@ async function fetchDataTenure() { })); // แปลงข้อมูลจาก data - const position = formatData(data.position); //ระยะเวลาดำรงตำแหน่งในสายงาน - const posLevel = formatData(data.posLevel); //ระยะเวลาดำรงตำแหน่งตามระดับ - const posExecutive = formatData(data.posExecutive); //ระยะเวลาดำรงตำแหน่งทางการบริหาร + const position = data.position ? formatData(data.position) : []; //ระยะเวลาดำรงตำแหน่งในสายงาน + const posLevel = data.posLevel ? formatData(data.posLevel) : []; //ระยะเวลาดำรงตำแหน่งตามระดับ + const posExecutive = data.posExecutive + ? formatData(data.posExecutive) + : []; //ระยะเวลาดำรงตำแหน่งทางการบริหาร // นำข้อมูลไปใส่ใน cardData cardData.value[0].data = position; cardData.value[1].data = posLevel; - cardData.value[2].data = posExecutive; + if (empType.value !== "-employee") { + cardData.value[2].data = posExecutive; + } //เช็คค่า ระยะเวลาดำรงตำแหน่งทางการบริหาร ถ้าไม่มีให้ลบออกจาก cardData - if (posExecutive.length === 0) { - cardData.value.splice(2, 2); + if ( + posExecutive.length === 0 && + empType.value !== "-employee" && + cardData.value.length > 2 + ) { + cardData.value.splice(2, 1); } } }) @@ -809,9 +821,13 @@ async function fetchDataTenure() { onMounted(async () => { try { showLoader(); + if (empType.value === "-employee") { + cardData.value.splice(2, 1); + } await Promise.all([ fetchListSalary(), - empType.value === "" ? fetchDataTenure() : Promise.resolve(), + fetchDataTenure(), + // empType.value === "" ? : Promise.resolve(), ]); } finally { hideLoader(); @@ -820,7 +836,7 @@ onMounted(async () => {