diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 4695b7b57..d32b37b29 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -92,4 +92,6 @@ export default { // orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId/${id}`, + + changePosition: `${organization}/placement/change-position`, }; diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index fe5009c44..1ab6d155c 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -175,4 +175,7 @@ export default { appointEmployeeOrder: (typeId: string) => `${placement}/appointment/temp/report/${typeId}`, apppointmentPositionUse: () => `${placement}/appointment/temp/use`, + + + }; diff --git a/src/modules/05_placement/components/ChangePosition/DialogRound.vue b/src/modules/05_placement/components/ChangePosition/DialogRound.vue index 91089030e..0e1d9ad40 100644 --- a/src/modules/05_placement/components/ChangePosition/DialogRound.vue +++ b/src/modules/05_placement/components/ChangePosition/DialogRound.vue @@ -26,20 +26,19 @@ function close() { } function onSubmit() { -// dialogConfirm($q, () => { -// const url = editCheck.value -// ? config.API. -// : config.API.; + dialogConfirm($q, () => { + const url = editCheck.value + ? config.API.changePosition+`/${idRound.value}` + : config.API.changePosition; -// http[editCheck.value ? "put" : "post"](url, { -// id: editCheck.value ? idRound : undefined, -// round: round.value, -// }).then((res) => { -// close(); -// success($q, "บันทึกข้อมูลสำเร็จ"); -// props.getData?.(); -// }); -// }); + http[editCheck.value ? "put" : "post"](url, { + name: round.value, + }).then((res) => { + close(); + success($q, "บันทึกข้อมูลสำเร็จ"); + props.getData?.(); + }); + }); } @@ -54,13 +53,14 @@ function onSubmit() { :close="close" /> - +
{ //ดึงข้อมูล API const fecthLists = async () => { - // showLoader(); - // rows.value = []; - // await http - // .get(config.API.appointmentMain()) - // .then((res) => { - // let response = res.data.result; - // listRecevice.value = response; - // rows.value = response; - // rows2.value = rows.value.filter( - // (e: any) => e.status !== "REPORT" && e.status !== "DONE" - // ); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); - - rows.value = [ - { - id: "08dc86c2-98a5-45f0-8e37-3502a4eb78c0", - name: "ย้ายสับเปลี่ยนตำแหน่งทุกเขต", - status: "WAITTING", - createdAt: "2024-06-07T14:22:31.985829", - }, - ]; - - rows2.value = rows.value.filter( - (e: any) => e.status !== "REPORT" && e.status !== "DONE" - ); + showLoader(); + rows.value = []; + await http + .get(config.API.changePosition) + .then((res) => { + rows.value = res.data.result; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; // dialog สำหรับแก้ไข @@ -160,19 +142,19 @@ function addRound() { //ลบข้อมูล const clickDelete = (id: string) => { dialogRemove($q, () => { - // showLoader(); - // http - // .delete(config.API.appointmentDelete(id)) - // .then(() => { - // success($q, "ลบข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // fecthLists(); - // hideLoader(); - // }); + showLoader(); + http + .delete(config.API.changePosition+`/${id}`) + .then(() => { + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + fecthLists(); + hideLoader(); + }); }); }; @@ -183,23 +165,6 @@ const personalListPage = (id: string) => { }); }; -function onSave(data: any) { - // showLoader(); - // http - // .put(config.API.appointmentPosition(personalId.value), dataAppoint) - // .then((res) => { - // modalTree.value = false; - // success($q, "บันทึกสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // fecthLists(); - // hideLoader(); - // }); -} - onMounted(() => { fecthLists(); }); diff --git a/src/modules/05_placement/components/ChangePosition/PersonalList.vue b/src/modules/05_placement/components/ChangePosition/PersonalList.vue index e52b84929..65feac8ed 100644 --- a/src/modules/05_placement/components/ChangePosition/PersonalList.vue +++ b/src/modules/05_placement/components/ChangePosition/PersonalList.vue @@ -2,7 +2,7 @@ import { ref, onMounted } from "vue"; import type { QTableProps } from "quasar"; import { useQuasar } from "quasar"; -import { useRouter } from "vue-router"; +import { useRoute, useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store"; @@ -13,6 +13,12 @@ import config from "@/app.config"; import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue"; import DialogEvalute from '@/modules/05_placement/components/ChangePosition/DialogChange.vue' +const router = useRouter(); +const route = useRoute(); +const id = ref( + route.params.id ? route.params.id.toString() : "" +); + const modalDialog = ref(false) const posType = ref(""); const posLevel = ref(""); @@ -34,7 +40,7 @@ const { dialogRemove, } = mixin; -const router = useRouter(); + const rows = ref([]); const modalTree = ref(false); const personalId = ref(""); @@ -144,20 +150,20 @@ const addPerson = () => { //ดึงข้อมูล API const fecthLists = async () => { - // showLoader(); - // rows.value = []; - // await http - // .get(config.API.appointmentMain()) - // .then((res) => { - // let response = res.data.result; - // rows.value = response; - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + showLoader(); + rows.value = []; + await http + .get(config.API.changePosition+`/${id.value}`) + .then((res) => { + let response = res.data.result; + rows.value = response; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); rows.value = [ { @@ -598,8 +604,7 @@ onMounted(() => { :onSubmit="onSave" /> - +