From 0f96b24df255a0d942556f9c8e3a955bbbc4946f Mon Sep 17 00:00:00 2001 From: waruneeta Date: Sat, 19 Aug 2023 21:56:00 +0700 Subject: [PATCH] =?UTF-8?q?-=20=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B9=84?= =?UTF-8?q?=E0=B8=9B=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA?= =?UTF-8?q?=E0=B8=B1=E0=B9=88=E0=B8=87=E0=B8=82=E0=B8=AD=E0=B8=87=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=A5?= =?UTF-8?q?=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=8A?= =?UTF-8?q?=E0=B8=B1=E0=B9=88=E0=B8=A7=E0=B8=84=E0=B8=A3=E0=B8=B2=E0=B8=A7?= =?UTF-8?q?=20-=20=E0=B9=81=E0=B8=81=E0=B9=89=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.treelist.ts | 2 + .../components/AppointMent/Main.vue | 30 +-- .../08_registryEmployee/views/Main.vue | 229 ++++++++---------- 3 files changed, 106 insertions(+), 155 deletions(-) diff --git a/src/api/02_organizational/api.treelist.ts b/src/api/02_organizational/api.treelist.ts index 215036604..063b8af04 100644 --- a/src/api/02_organizational/api.treelist.ts +++ b/src/api/02_organizational/api.treelist.ts @@ -89,4 +89,6 @@ export default { organizationEmployeePositionId: (profileId: string) => `${organizationEmployee}position/${profileId}`, + organizationEmployeeSendOrder: `${organizationEmployee}report`, + }; diff --git a/src/modules/05_placement/components/AppointMent/Main.vue b/src/modules/05_placement/components/AppointMent/Main.vue index 3104f9c59..3f0854ee7 100644 --- a/src/modules/05_placement/components/AppointMent/Main.vue +++ b/src/modules/05_placement/components/AppointMent/Main.vue @@ -131,32 +131,8 @@ const fecthTypeOption = async () => { }); }; -const rows = ref([ - // { - // personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1", - // citizenId: "1234444332222", - // fullname: "นางสาวอย พชช", - // organizationName: "นักจัดการงานทั่วไป", - // orgName: "กลุ่มงานช่วยนักบริหาร", - // organizationShortName: "สกจ.", - // positionNumber: "กก. 1", - // positionPath: "นักจัดการงานทั่วไป", - // birthday: dateText(new Date("1989-09-03")), - // }, -]); -const rows2 = ref([ - // { - // personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1", - // citizenId: "1234444332222", - // fullname: "นางสาวอย พชช", - // organizationName: "นักจัดการงานทั่วไป", - // orgName: "กลุ่มงานช่วยนักบริหาร", - // organizationShortName: "สกจ.", - // positionNumber: "กก. 1", - // positionPath: "นักจัดการงานทั่วไป", - // birthday: dateText(new Date("1989-09-03")), - // }, -]); +const rows = ref([]); +const rows2 = ref([]); const columns = ref([ { name: "no", @@ -714,7 +690,7 @@ const status = (val: string) => { - + @@ -1110,26 +1110,35 @@ const saveData = async () => { } }; const checkSaveOrder = () => { - dialogConfirm($q, async () => await SaveOrder()) + dialogConfirm($q, () => SaveOrder()) } const SaveOrder = async () => { - if (selectedToOrder.value.length == 0) { - dialogMessageNotify( - $q, - "ไม่สามารถบันทึกข้อมูลได้ กรุณาเลือกตำแหน่ง", - // "กรุณาเลือกตำแหน่ง", - // "warning", - // undefined, - // "orange", - // undefined, - // undefined, - // true - ); - return; - } else { - // ส่งไปออกคำสั่ง - await sendToOrder(); - } + // ส่งไปออกคำสั่ง + let pId: string[] = []; + selectedToOrder.value.forEach((e: any) => { + pId.push(e.id); + }); + let data = { + id: pId, + }; + console.log(data); + showLoader(); + await http + .post(config.API.organizationEmployeeSendOrder, data) + .then((res: any) => { + // console.log(res); + success($q, "บันทึกสำเร็จ"); + }) + .catch((e: any) => { + // console.log(e); + messageError($q, e); + }) + .finally(async () => { + hideLoader(); + modaladdOrder.value = false; + await showEmployeeTemp(); + selectedToOrder.value = []; + }); }; const savePosition = async () => { @@ -1151,26 +1160,6 @@ const savePosition = async () => { }); }; -const sendToOrder = async () => { - modaladdOrder.value = false; - // showLoader(); - // const data = { - // organizationEmployeeId: selectedPosition.value[0].id, - // }; - // await http - // .put(config.API.organizationEmployeePositionId(id.value), data) - // .then((res) => { - // success($q, "บันทึกข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // await nodeTree(); - // modalOpenClose(); - // }); -}; - const modalOpenClose = () => { modal.value = !modal.value; if (!modal.value) { @@ -1190,31 +1179,12 @@ const resetFilter = () => { filterRef.value!.focus(); }; -const getClass = (val: boolean) => { - return { - "full-width inputgreen cursor-pointer": val, - "full-width cursor-pointer": !val, - }; -}; - -const clickClose = async () => { - // if (editRow.value == true) { - // dialogMessage( - // $q, - // "ข้อมูลมีการแก้ไข", - // "ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?", - // "mdi-help-circle-outline", - // "ตกลง", - // "orange", - // () => (modal.value = false), - // undefined - // ); - // } else { - modal.value = false; - // next.value = false; - // previous.value = false; - // } -}; +// const getClass = (val: boolean) => { +// return { +// "full-width inputgreen cursor-pointer": val, +// "full-width cursor-pointer": !val, +// }; +// }; const clickAdd = () => { // modal.value = true; @@ -1271,11 +1241,13 @@ const nodeTree = async () => { .finally(async () => { hideLoader(); await showEmployeeTemp(); - await showEmployeeTempOrder(); + // await showEmployeeTempOrder(); }); }; const showEmployeeTemp = async () => { + showLoader(); + let cirteria = []; cirteria.push({ @@ -1288,8 +1260,7 @@ const showEmployeeTemp = async () => { criteriaValue: "false", }); - if (selected.value == null || selected.value == "") return; - showLoader(); + if (selected.value == null) return; await http .post(config.API.searchProfileTemp("all"), { criterias: cirteria, @@ -1329,6 +1300,8 @@ const showEmployeeTemp = async () => { draftPositionEmployee: e.draftPositionEmployee, draftOrganizationOrganization: e.draftOrganizationOrganization, }); + + rowsOrder.value = rows.value.filter((e: any) => e.draftPositionEmployee !== null); }); }) .catch((e) => { @@ -1339,70 +1312,70 @@ const showEmployeeTemp = async () => { }); }; -const showEmployeeTempOrder = async () => { - let cirteria = []; +// const showEmployeeTempOrder = async () => { +// let cirteria = []; - cirteria.push({ - criteriaType: "employee_class", - criteriaValue: "temp", - }); +// cirteria.push({ +// criteriaType: "employee_class", +// criteriaValue: "temp", +// }); - cirteria.push({ - criteriaType: "is_retire", - criteriaValue: "false", - }); +// cirteria.push({ +// criteriaType: "is_retire", +// criteriaValue: "false", +// }); - if (selected.value == null || selected.value == "") return; - showLoader(); - await http - .post(config.API.searchProfileTemp("all"), { - criterias: cirteria, - }) - .then((res) => { - let data = res.data.result; - rowsOrder.value = []; - data.map((e: ResponseEmployeeTemp) => { - rowsOrder.value.push({ - id: e.id, - fullname: e.fullname, - fullnameOld: e.fullnameOld, - position: e.position, - positionPathSide: e.positionPathSide, - positionLine: e.positionLine, - govAge: e.govAge, - positionEmployeePosition: e.positionEmployeePosition, - positionEmployeePositionSide: e.positionEmployeePositionSide, - positionEmployeeGroup: e.positionEmployeeGroup, - oc: e.oc, - age: e.age, - amount: e.amount == null ? "" : e.amount.toLocaleString(), - refSalary: e.refSalary, - dateAppoint: - e.dateAppoint == null ? null : date2Thai(new Date(e.dateAppoint)), - dateStart: - e.dateStart == null ? null : date2Thai(new Date(e.dateStart)), - createdAt: - e.createdAt == null ? null : date2Thai(new Date(e.createdAt)), - isLeave: e.isLeave == false ? "ครอง" : `${typeRetire(e.leaveReason)}`, - leaveDateOrder: - e.leaveDateOrder == null - ? null - : date2Thai(new Date(e.leaveDateOrder)), - newAgency: "", - currentAgency: "", - draftPositionEmployee: e.draftPositionEmployee, - draftOrganizationOrganization: e.draftOrganizationOrganization, - }); - }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - // console.log(rowsOrder); - }); -}; +// if (selected.value == null || selected.value == "") return; +// showLoader(); +// await http +// .post(config.API.searchProfileTemp("all"), { +// criterias: cirteria, +// }) +// .then((res) => { +// let data = res.data.result; +// rowsOrder.value = []; +// data.map((e: ResponseEmployeeTemp) => { +// rowsOrder.value.push({ +// id: e.id, +// fullname: e.fullname, +// fullnameOld: e.fullnameOld, +// position: e.position, +// positionPathSide: e.positionPathSide, +// positionLine: e.positionLine, +// govAge: e.govAge, +// positionEmployeePosition: e.positionEmployeePosition, +// positionEmployeePositionSide: e.positionEmployeePositionSide, +// positionEmployeeGroup: e.positionEmployeeGroup, +// oc: e.oc, +// age: e.age, +// amount: e.amount == null ? "" : e.amount.toLocaleString(), +// refSalary: e.refSalary, +// dateAppoint: +// e.dateAppoint == null ? null : date2Thai(new Date(e.dateAppoint)), +// dateStart: +// e.dateStart == null ? null : date2Thai(new Date(e.dateStart)), +// createdAt: +// e.createdAt == null ? null : date2Thai(new Date(e.createdAt)), +// isLeave: e.isLeave == false ? "ครอง" : `${typeRetire(e.leaveReason)}`, +// leaveDateOrder: +// e.leaveDateOrder == null +// ? null +// : date2Thai(new Date(e.leaveDateOrder)), +// newAgency: "", +// currentAgency: "", +// draftPositionEmployee: e.draftPositionEmployee, +// draftOrganizationOrganization: e.draftOrganizationOrganization, +// }); +// }); +// }) +// .catch((e) => { +// messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// // console.log(rowsOrder); +// }); +// }; const onSelected = async (id: string) => { // await fetchPositionNumber(id);