From fde7bd6f113d97629949be88f4ec39cb37e1ac87 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 5 Jun 2024 11:21:58 +0700 Subject: [PATCH] fixing bug placement, registry remove employee temp & remove api get tree form json file --- src/modules/04_registryNew/store.ts | 2 +- .../components/AppointEmployee/Modal.vue | 72 +++++++++--------- .../AppointMent/AppointmentModal.vue | 73 +++++++++---------- .../components/PersonalList/OrgTree.vue | 72 +++++++++--------- .../components/PersonalList/Table.vue | 54 +++++++------- .../components/Receive/receiveModal.vue | 72 +++++++++--------- .../components/Relocation/RelocationModal.vue | 32 ++++---- 7 files changed, 186 insertions(+), 191 deletions(-) diff --git a/src/modules/04_registryNew/store.ts b/src/modules/04_registryNew/store.ts index 5f15cf775..99bff104d 100644 --- a/src/modules/04_registryNew/store.ts +++ b/src/modules/04_registryNew/store.ts @@ -17,7 +17,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => { const employeeClassOps = ref([ { id: "officer", name: "ข้าราชการ กทม.สามัญ" }, { id: "perm", name: "ลูกจ้างประจำ" }, - { id: "temp", name: "ลูกจ้างชั่วคราว" }, + // { id: "temp", name: "ลูกจ้างชั่วคราว" }, ]); const posTypeOps = ref([]); const posTypeMain = ref([]); diff --git a/src/modules/05_placement/components/AppointEmployee/Modal.vue b/src/modules/05_placement/components/AppointEmployee/Modal.vue index 1783d9096..7b9da3a42 100644 --- a/src/modules/05_placement/components/AppointEmployee/Modal.vue +++ b/src/modules/05_placement/components/AppointEmployee/Modal.vue @@ -48,43 +48,43 @@ let dataForm = reactive({ }); onMounted(async () => { - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); await fetchplacementPosition(); }); -const fetchPublishFile = async () => { - await http - .get(config.API.getPublishFileHistory) - .then((res) => { - let data = res.data.result; - selectedFile.value = data[0].fileName; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; +// const fetchPublishFile = async () => { +// await http +// .get(config.API.getPublishFileHistory) +// .then((res) => { +// let data = res.data.result; +// selectedFile.value = data[0].fileName; +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// }; // โหลดข้อมูลโครงสร้างจาก json -const loadTreeData = async () => { - expanded.value = []; - await http - .get(`${config.s3ClusterUrl}${selectedFile.value}`) - .then((res: any) => { - treeData.value = res.data; - dataRespone.value = res.data; - // Filter objects with "name" null - const filteredData = res.data.filter(filterByPersonIdNull); - treeData.value = filteredData; - }) - .catch((e: any) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; +// const loadTreeData = async () => { +// expanded.value = []; +// await http +// .get(`${config.s3ClusterUrl}${selectedFile.value}`) +// .then((res: any) => { +// treeData.value = res.data; +// dataRespone.value = res.data; +// // Filter objects with "name" null +// const filteredData = res.data.filter(filterByPersonIdNull); +// treeData.value = filteredData; +// }) +// .catch((e: any) => { +// messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }; function filterByPersonIdNull(obj: any) { if (obj.name === null && obj.isCondition != true) { return true; @@ -171,8 +171,8 @@ const saveAppoint = async () => { }) .finally(async () => { await closeAndClear(); - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); await fetchplacementPosition(); hideLoader(); }); diff --git a/src/modules/05_placement/components/AppointMent/AppointmentModal.vue b/src/modules/05_placement/components/AppointMent/AppointmentModal.vue index 034bbe28d..560525358 100644 --- a/src/modules/05_placement/components/AppointMent/AppointmentModal.vue +++ b/src/modules/05_placement/components/AppointMent/AppointmentModal.vue @@ -47,42 +47,41 @@ let dataForm = reactive({ positionTypeId: "", }); -const fetchPublishFile = async () => { - await http - .get(config.API.getPublishFileHistory) - .then((res) => { - let data = res.data.result; - selectedFile.value = data[0].fileName; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; +// const fetchPublishFile = async () => { +// await http +// .get(config.API.getPublishFileHistory) +// .then((res) => { +// let data = res.data.result; +// selectedFile.value = data[0].fileName; +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// }; // โหลดข้อมูลโครงสร้างจาก json +// const loadTreeData = async () => { +// expanded.value = []; +// await http +// .get(`${config.s3ClusterUrl}${selectedFile.value}`) +// .then((res: any) => { +// treeData.value = res.data; +// dataRespone.value = res.data; -const loadTreeData = async () => { - expanded.value = []; - await http - .get(`${config.s3ClusterUrl}${selectedFile.value}`) - .then((res: any) => { - treeData.value = res.data; - dataRespone.value = res.data; - - // Filter objects with "name" null - const filteredData = res.data.filter(filterByPersonIdNull); - treeData.value = filteredData; - }) - .catch((e: any) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; +// // Filter objects with "name" null +// const filteredData = res.data.filter(filterByPersonIdNull); +// treeData.value = filteredData; +// }) +// .catch((e: any) => { +// messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }; function filterByPersonIdNull(obj: any) { if (obj.name === null && obj.isCondition != true) { @@ -177,8 +176,8 @@ const saveAppoint = async () => { }) .finally(async () => { await closeAndClear(); - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); await fetchplacementPosition(); hideLoader(); }); @@ -393,8 +392,8 @@ function findByPerson(element: any): any { } onMounted(async () => { - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); // await fetchplacementPosition(); }); diff --git a/src/modules/05_placement/components/PersonalList/OrgTree.vue b/src/modules/05_placement/components/PersonalList/OrgTree.vue index c8caa6423..753a82eb0 100644 --- a/src/modules/05_placement/components/PersonalList/OrgTree.vue +++ b/src/modules/05_placement/components/PersonalList/OrgTree.vue @@ -61,41 +61,41 @@ let dataForm = reactive({ }); /** ฟังชั่น get file*/ -async function fetchPublishFile() { - await http - .get(config.API.getPublishFileHistory) - .then((res) => { - let data = res.data.result; - selectedFile.value = data[0].fileName; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -} +// async function fetchPublishFile() { +// await http +// .get(config.API.getPublishFileHistory) +// .then((res) => { +// let data = res.data.result; +// selectedFile.value = data[0].fileName; +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// } /** โหลดข้อมูลโครงสร้างจาก json */ -const loadTreeData = async () => { - expanded.value = []; - await http - .get(`${config.s3ClusterUrl}${selectedFile.value}`) - .then((res: any) => { - treeData.value = res.data; - dataRespone.value = res.data; +// const loadTreeData = async () => { +// expanded.value = []; +// await http +// .get(`${config.s3ClusterUrl}${selectedFile.value}`) +// .then((res: any) => { +// treeData.value = res.data; +// dataRespone.value = res.data; - // Filter objects with "name" null - const filteredData = res.data.filter(filterByPersonIdNull); - treeData.value = filteredData; - }) - .catch((e: any) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; +// // Filter objects with "name" null +// const filteredData = res.data.filter(filterByPersonIdNull); +// treeData.value = filteredData; +// }) +// .catch((e: any) => { +// messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }; /** * ฟังก์ชันกรองข้อมูลที่ personId เป็น null @@ -202,8 +202,8 @@ async function saveAppoint() { }) .finally(async () => { await closeAndClear(); - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); await fetchplacementPosition(); hideLoader(); }); @@ -419,8 +419,8 @@ watch(props, () => { }); onMounted(async () => { - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); await fetchplacementPosition(); }); diff --git a/src/modules/05_placement/components/PersonalList/Table.vue b/src/modules/05_placement/components/PersonalList/Table.vue index 3db8453dd..39bc5c0a3 100644 --- a/src/modules/05_placement/components/PersonalList/Table.vue +++ b/src/modules/05_placement/components/PersonalList/Table.vue @@ -239,9 +239,9 @@ function convertContainStatus(val: string, type: string = "") { case "UN-CONTAIN": return "ยังไม่บรรจุ"; case "PREPARE-CONTAIN": - return "เตรียม" + (type != "" ? type : "บรรจุ"); + return "เตรียม" + (!type ? type : "บรรจุ"); case "CONTAIN": - return (type != "" ? type : "บรรจุ") + "แล้ว"; + return (!type ? type : "บรรจุ") + "แล้ว"; case "DISCLAIM": return "สละสิทธิ์"; default: @@ -358,16 +358,15 @@ async function getTable() { }); // รายชื่อทั้งหมด - rows.value = roleAdmin.value + rows.value = await (roleAdmin.value ? rowsAll.value - : rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN"); + : rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN")); // รายชื่อไปยังหน่วยงาน - rowsFilter.value = rows.value.filter( - (e: any) => e.draft == "รอส่งตัว" && e.statusNameCheck == "เตรียมบรรจุ" + rowsFilter.value = await rows.value.filter( + (e: any) => e.draft == "รอส่งตัว" ); - console.log(rows.value); - insertAvatar(rowsAll.value); + insertAvatar(rows.value); }) .catch((e) => { messageError($q, e); @@ -389,13 +388,13 @@ function insertAvatar(items: any) { ) ) .then((img) => { - rowsAll.value[index] = { + rows.value[index] = { ...x, avatar: img.data.downloadUrl, }; }) .catch(() => { - rowsAll.value[index] = { + rows.value[index] = { ...x, avatar: avatar, }; @@ -829,7 +828,7 @@ onMounted(async () => { { { { { { - await http - .get(config.API.getPublishFileHistory) - .then((res) => { - let data = res.data.result; - selectedFile.value = data[0].fileName; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; +// const fetchPublishFile = async () => { +// await http +// .get(config.API.getPublishFileHistory) +// .then((res) => { +// let data = res.data.result; +// selectedFile.value = data[0].fileName; +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// }; // โหลดข้อมูลโครงสร้างจาก json -const loadTreeData = async () => { - expanded.value = []; - await http - .get(`${config.s3ClusterUrl}${selectedFile.value}`) - .then((res: any) => { - treeData.value = res.data; - dataRespone.value = res.data; - // Filter objects with "name" null - const filteredData = res.data.filter(filterByPersonIdNull); - treeData.value = filteredData; - }) - .catch((e: any) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; +// const loadTreeData = async () => { +// expanded.value = []; +// await http +// .get(`${config.s3ClusterUrl}${selectedFile.value}`) +// .then((res: any) => { +// treeData.value = res.data; +// dataRespone.value = res.data; +// // Filter objects with "name" null +// const filteredData = res.data.filter(filterByPersonIdNull); +// treeData.value = filteredData; +// }) +// .catch((e: any) => { +// messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }; function filterByPersonIdNull(obj: any) { if (obj.name === null && obj.isCondition != true) { @@ -234,8 +234,8 @@ const saveAppoint = async () => { }) .finally(async () => { await closeAndClear(); - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); // await fetchplacementPosition(); hideLoader(); }); @@ -634,8 +634,8 @@ watch( ); onMounted(async () => { - await fetchPublishFile(); - await loadTreeData(); + // await fetchPublishFile(); + // await loadTreeData(); // await fetchplacementPosition(); }); diff --git a/src/modules/05_placement/components/Relocation/RelocationModal.vue b/src/modules/05_placement/components/Relocation/RelocationModal.vue index cd5b2659a..2a71be760 100644 --- a/src/modules/05_placement/components/Relocation/RelocationModal.vue +++ b/src/modules/05_placement/components/Relocation/RelocationModal.vue @@ -43,24 +43,24 @@ let dataForm = reactive({ }); onMounted(async () => { - await fetchPublishFile(); + // await fetchPublishFile(); await loadTreeData(); await fetchplacementPosition(); }); -const fetchPublishFile = async () => { - await http - .get(config.API.getPublishFileHistory) - .then((res) => { - let data = res.data.result; - selectedFile.value = data[0].fileName; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; +// const fetchPublishFile = async () => { +// await http +// .get(config.API.getPublishFileHistory) +// .then((res) => { +// let data = res.data.result; +// selectedFile.value = data[0].fileName; +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// }; // โหลดข้อมูลโครงสร้างจาก json const treeData = ref>([]); @@ -192,7 +192,7 @@ const saveAppoint = async () => { .finally(async () => { await closeAndClear(); // await resetFilter(); - await fetchPublishFile(); + // await fetchPublishFile(); await loadTreeData(); await fetchplacementPosition(); hideLoader();