diff --git a/src/api/18_command/api.command.ts b/src/api/18_command/api.command.ts index 9d524ca2b..32b17f1ba 100644 --- a/src/api/18_command/api.command.ts +++ b/src/api/18_command/api.command.ts @@ -10,5 +10,7 @@ export default { commandAction: (commandId: string, type: string) => `${command}/${type}/${commandId}`, - commandSalaryList:(command:string)=>`${commandSalary}/list?commandSysId=${command}` + commandSalaryList:(command:string)=>`${commandSalary}/list?commandSysId=${command}`, + commandSwap:(tab:string,direction:string,commandReciveId:string)=>`${command}/${tab}/swap/${direction}/${commandReciveId}`, + commandEditRecive:(tab:string,commandReciveId:string)=>`${command}/${tab}/recive/${commandReciveId}` }; diff --git a/src/modules/05_placement/components/PersonalList/DialogOrders.vue b/src/modules/05_placement/components/PersonalList/DialogOrders.vue index 941f7b193..e134d343a 100644 --- a/src/modules/05_placement/components/PersonalList/DialogOrders.vue +++ b/src/modules/05_placement/components/PersonalList/DialogOrders.vue @@ -3,9 +3,11 @@ import { ref, watch } from "vue"; import { useQuasar } from "quasar"; import avatar from "@/assets/avatar_user.jpg"; + +import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useCommandMainStore } from "@/modules/18_command/store/Main"; - +import { usePlacementDataStore } from "@/modules/05_placement/store"; // import http from "@/plugins/http"; // import config from "@/app.config"; @@ -19,6 +21,8 @@ import { options } from "@fullcalendar/core/preact"; const $q = useQuasar(); const mixin = useCounterMixin(); +const route = useRoute(); +const DataStore = usePlacementDataStore(); const storeCommand = useCommandMainStore(); const { showLoader, @@ -40,10 +44,13 @@ const props = defineProps({ rows: Array, }); +const examId = route.params.examId; const rows = ref([]); const commandType = ref(""); const commandOp = ref([]); +const listCommand = ref([]); // เก็บคำสั่งทั้งหมด const modalCommand = ref(false); //เปิด-ปิด modal สร้างคำสั่ง + //Table const selected = ref([]); //รายชื่อที่เลือก const filter = ref(""); //คำค้นหา @@ -150,6 +157,20 @@ const columns = ref([ }, ]); +/** + * ฟิลเตอร์ คำสั่ง + * @param val ค่าจาก Input + * @param update Funtion quasar + */ +function filterSelector(val: string, update: Function) { + update(() => { + commandType.value = val ? "" : commandType.value; + commandOp.value = listCommand.value.filter( + (v: any) => v.name.indexOf(val) > -1 + ); + }); +} + /** * ฟังก์ชันยืนยันการออกคำสั่ง */ @@ -167,8 +188,27 @@ function saveOrder() { function filterSelectOrder() { const data = props.rows ? props.rows : []; - rows.value = data.filter((v: any) => v.code == commandType.value); + rows.value = data.filter((v: any) => { + switch (commandType.value) { + case "C-PM-01": + case "C-PM-02": + return v.typeCommand === "APPOINTED" && v.bmaOfficer === null; + + case "C-PM-03": + return v.typeCommand === "APPOINT" && v.bmaOfficer !== null; + + case "C-PM-04": + return v.typeCommand === "MOVE" && v.bmaOfficer !== null; + + case "C-PM-06": + return v.typeCommand === "SLIP" && v.bmaOfficer !== null; + + default: + return []; + } + }); } + /** * เมื่อ props.modal เป็น true * @@ -180,10 +220,25 @@ watch( if (modal.value === true) { rows.value = props.rows ? props.rows : []; selected.value = []; - const data = await storeCommand.getCommandTypes(); - commandOp.value = data.filter( - (v: any) => v.code == "C-PM-01" || v.code == "C-PM-02" - ); + const status = DataStore.DataMainOrig.find((x: any) => x.id == examId); + if (status?.examTypeName !== "") { + const data = await storeCommand.getCommandTypes(); + + listCommand.value = data.filter( + (v: any) => + (status?.examTypeName === "สอบแข่งขัน" && + (v.code === "C-PM-01" || + v.code === "C-PM-03" || + v.code === "C-PM-04" || + v.code === "C-PM-06")) || + ((status?.examTypeName === "สอบคัดเลือก" || + status?.examTypeName === "คัดเลือกคนพิการ") && + (v.code === "C-PM-02" || + v.code === "C-PM-03" || + v.code === "C-PM-04" || + v.code === "C-PM-06")) + ); + } } } ); @@ -205,9 +260,19 @@ watch( option-value="code" emit-value map-options - style="width: 200px; max-width: auto" + use-input + style="width: 350px; max-width: auto" @update:model-value="filterSelectOrder" - > + @filter="(inputValue:any, + doneFn:Function) => filterSelector(inputValue, doneFn + ) " + > + { title.value = examData.value == null ? null : examData.value.examRound; round.value = examData.value == null ? null : examData.value.examOrder; year.value = examData.value == null ? null : examData.value.fiscalYear; + }); diff --git a/src/modules/18_command/components/Step/Dialog2_Salary.vue b/src/modules/18_command/components/Step/Dialog2_Salary.vue index 15b8c44c1..5088aeb7e 100644 --- a/src/modules/18_command/components/Step/Dialog2_Salary.vue +++ b/src/modules/18_command/components/Step/Dialog2_Salary.vue @@ -1,17 +1,26 @@