diff --git a/src/modules/05_placement/components/AppointMent/Detail.vue b/src/modules/05_placement/components/AppointMent/Detail.vue index 30048c25e..d65ee73e5 100644 --- a/src/modules/05_placement/components/AppointMent/Detail.vue +++ b/src/modules/05_placement/components/AppointMent/Detail.vue @@ -3,13 +3,8 @@ import { onMounted, ref, reactive } from "vue"; import { useQuasar } from "quasar"; import { useRoute, useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; -import CurrencyInput from "@/components/CurruncyInput.vue"; import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive"; -import type { - appointmentData, - ResponseData, - DataProfile, -} from "@/modules/05_placement/interface/response/AppointMent"; +import type { DataProfile } from "@/modules/05_placement/interface/response/AppointMent"; import type { QForm } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -102,7 +97,7 @@ function putAppointment() { positionTypeOld: positionTypeOld.value, positionLevelOld: positionLevelOld.value, positionNumberOld: posNo.value, - amountOld: Number(salary.value), + amountOld: salary.value.toString().replace(/,/g, ""), reason: reason.value, positionDate: date.value, }; diff --git a/src/modules/05_placement/components/AppointMent/Dialogbody.vue b/src/modules/05_placement/components/AppointMent/Dialogbody.vue index 73f428c0b..d8de10d71 100644 --- a/src/modules/05_placement/components/AppointMent/Dialogbody.vue +++ b/src/modules/05_placement/components/AppointMent/Dialogbody.vue @@ -3,7 +3,7 @@ import { ref, computed, watchEffect } from "vue"; import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import type { QTableProps } from "quasar"; -import type { UserData } from "@/modules/05_placement/interface/response/AppointMent"; +import type { UserDataNew } from "@/modules/05_placement/interface/response/AppointMent"; import DialogHeader from "@/modules/05_placement/components/AppointMent/DialogHeader.vue"; import { useTransferDataStore } from "@/modules/05_placement/store"; @@ -27,7 +27,7 @@ const { const $q = useQuasar(); const selected = ref<[]>([]); const checkSelected = computed(() => { - if (selected.value.length === 0 || props.type === "") { + if (selected.value.length === 0) { return true; } }); @@ -48,6 +48,7 @@ const visibleColumns2 = ref([ "fullname", "organizationName", "birthday", + "typeCommand", ]); const columns2 = ref([ { @@ -88,6 +89,24 @@ const columns2 = ref([ sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, + { + name: "typeCommand", + align: "left", + label: "ประเภทคำสั่ง", + sortable: true, + field: "typeCommand", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + format: (val: string) => { + return val === "APPOINT" + ? "แต่งตั้ง" + : val === "SLIP" + ? "เลื่อน" + : val === "MOVE" + ? "ย้าย" + : "-"; + }, + }, { name: "birthday", align: "left", @@ -110,43 +129,41 @@ const updateInput = (value: any) => { emit("update:filterKeyword2", value); }; -const updateInputType = (value: string) => { - emit("update:type", value); -}; +// const updateInputType = (value: string) => { +// emit("update:type", value); +// }; //รีเซ็ตค่าในช่องค้นหา const Reset = () => { emit("update:filterKeyword2", ""); }; -//เปิด modal ยืนยัน -const clickAddlist = () => { - dialogConfirm($q, () => createdAppoint()); -}; -//อัพเดต ส่งไปออกคำสั่ง -const createdAppoint = async () => { - let pId: string[] = []; - let Type = props.type as string; - selected.value.forEach((e: UserData) => { - pId.push(e.personalId); - }); - let data = { - id: pId, - }; - showLoader(); - await http - .put(config.API.apppointmentReport(Type), data) - .then((res) => { - success($q, "บันทึกสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - props.fecthlistappointment?.(); - selected.value = []; - props.clickClose?.(); +//ส่งไปออกคำสั่ง +const sendToCommand = () => { + dialogConfirm($q, async () => { + let pId: string[] = []; + let Type = props.type as string; + selected.value.forEach((e: UserDataNew) => { + pId.push(e.id); }); + let data = { + id: pId, + }; + showLoader(); + await http + .put(config.API.apppointmentReport(Type), data) + .then((res) => { + success($q, "บันทึกสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + props.fecthlistappointment?.(); + selected.value = []; + props.clickClose?.(); + }); + }); }; watchEffect(() => { @@ -163,7 +180,7 @@ watchEffect(() => {
- +
@@ -316,7 +333,7 @@ watchEffect(() => { diff --git a/src/modules/05_placement/components/AppointMent/Main.vue b/src/modules/05_placement/components/AppointMent/Main.vue index 0673a59ca..600123c03 100644 --- a/src/modules/05_placement/components/AppointMent/Main.vue +++ b/src/modules/05_placement/components/AppointMent/Main.vue @@ -57,6 +57,7 @@ const visibleColumns = ref([ "citizenId", "fullname", "organizationName", + "typeCommand", "dateOfBirth", "createdAt", "status", @@ -113,6 +114,24 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, + { + name: "typeCommand", + align: "left", + label: "ประเภทคำสั่ง", + sortable: true, + field: "typeCommand", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + format: (val: string) => { + return val === "APPOINT" + ? "แต่งตั้ง" + : val === "SLIP" + ? "เลื่อน" + : val === "MOVE" + ? "ย้าย" + : "-"; + }, + }, { name: "createdAt", align: "left", @@ -146,10 +165,10 @@ const clickClose = () => { }; //เปิด modal -const popup = () => { +const sendToCommand = () => { modal.value = true; filterKeyword2.value = ""; - fecthTypeOption(); + // fecthTypeOption(); }; //ดึงข้อมูล API @@ -213,22 +232,22 @@ const fecthlistappointment = async () => { }; //ดึงข้อมูลประเภทคำสั่งเเต่งตั้ง -const fecthTypeOption = async () => { - type.value = ""; - await http - .get(config.API.typeOrder()) - .then((res) => { - optionsType.value = res.data.result.filter( - (e: OpType) => - e.commandCode === "C-PM-05" || - e.commandCode === "C-PM-06" || - e.commandCode === "C-PM-07" - ); - }) - .catch((e) => { - messageError($q, e); - }); -}; +// const fecthTypeOption = async () => { +// type.value = ""; +// await http +// .get(config.API.typeOrder()) +// .then((res) => { +// optionsType.value = res.data.result.filter( +// (e: OpType) => +// e.commandCode === "C-PM-05" || +// e.commandCode === "C-PM-06" || +// e.commandCode === "C-PM-07" +// ); +// }) +// .catch((e) => { +// messageError($q, e); +// }); +// }; // เปิดโครงสร้าง const openModalTree = (data: any, type: string) => { @@ -262,12 +281,6 @@ const deleteAppoint = async (id: string) => { }); }; -// ปิด modal โครงส้ราง -const closeModalTree = async () => { - await fecthlistappointment(); - modalTree.value = false; -}; - // ไปหน้ารายละเอียด const nextPage = (id: string) => { router.push({ @@ -314,6 +327,7 @@ onMounted(() => { fecthlistappointment(); }); +