diff --git a/src/modules/05_placement/components/PersonalList/CardPosition.vue b/src/modules/05_placement/components/PersonalList/CardPosition.vue index e977b283c..cb6074ed2 100644 --- a/src/modules/05_placement/components/PersonalList/CardPosition.vue +++ b/src/modules/05_placement/components/PersonalList/CardPosition.vue @@ -3,8 +3,13 @@ import { ref, onMounted, watch } from "vue"; /** importType*/ import type { QTableProps } from "quasar"; -import type { Positions } from "@/modules/05_placement/interface/response/SelectOrg"; +import type { + Positions, + FormPosType, + FormPosLevel, +} from "@/modules/05_placement/interface/response/SelectOrg"; import type { DataPositionNo } from "@/modules/05_placement/interface/index/SelectOrg"; +import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect"; /** importStore*/ import { useCounterMixin } from "@/stores/mixin"; @@ -12,6 +17,8 @@ import { useCounterMixin } from "@/stores/mixin"; /** use*/ const { date2Thai } = useCounterMixin(); +const store = useSelectOrgStore(); + /** props*/ const selected = defineModel("selectedPos", { required: true }); //ตำแหน่งที่เลือก const positionId = defineModel("positionId", { required: true }); //id ตำแหน่งที่เลือก @@ -20,9 +27,25 @@ const date = defineModel("datePos", { required: true }); //วันยท const positionData = defineModel("position", { required: true }); //ข้อมูลรายการตำแหน่งเลขที่ const isAll = defineModel("isAll", { required: true }); //แสดงตำแหน่งทั้งหมด const isBlank = defineModel("isBlank", { required: true }); //แสดงเฉพาะตำแหน่งว่าง +const isPosition = defineModel("isPosition", { required: true }); +const isPositionOld = defineModel("isPositionOld", { required: true }); //แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม +const posType = defineModel("posType", { required: true }); //ประเภทตำแหน่ง +const posLevel = defineModel("posLevel", { required: true }); //ระดับตำแหน่ง +const optionPosType = defineModel("optionPosType", { + required: true, +}); +const optionPosLevel = defineModel("optionPosLevel", { + required: true, +}); const positionRows = ref(positionData.value); -const isPosition = ref(true); + +const props = defineProps({ + fetchDataTable: Function, + onPosType: Function, + nodeId: String, + nodeLevel: Number, +}); //Table const filters = ref(""); //คำค้นหา @@ -196,26 +219,22 @@ async function onClickSelectPos(id: string) { } } -/** - * function ค้นหาตำแหน่งตามการเลือกแสดงเฉพาะตำแหน่งที่ตรงกับการสอบ - */ -async function fetchIsPosition() { - // ถ้าเลือกแสดงเฉพาะตำแหน่งที่ตรงกับการสอบ ระบบจะ filter เลือกเฉพาะข้อมูลที่ตรงกับการสอบ - if (isPosition.value) { - const lists = await positionData.value.filter( - (e: any) => e.isPosition === true - ); - positionRows.value = lists; - } - // ถ้าไม่ได้เลือกระบบจะแสดงตำแหน่งทั้งหมด - else { - positionRows.value = positionData.value; +function onPositionOld() { + props.fetchDataTable?.(props.nodeId, props.nodeLevel); + if (isPositionOld.value == false) { + posType.value.id = ""; + posType.value.posTypeName = ""; + posType.value.posTypeRank = null; + posType.value.posLevels = []; + posLevel.value = ""; } } // เช็คว่าถ้ามีการปรับ filter ระบบจะนำข้อมูลไปเช็ค filter แสดงเฉพาะตำแหน่งที่ตรงกับการสอบใหม่อีกครั้ง watch(positionData, (newVal, oldVal) => { - if (newVal != oldVal) fetchIsPosition(); + if (newVal != oldVal) { + positionRows.value = positionData.value; + } }); /** @@ -227,7 +246,7 @@ onMounted(async () => { await onClickSelectPos(positionId.value); }, 1000); } else { - fetchIsPosition(); + positionRows.value = positionData.value; } }); @@ -255,7 +274,9 @@ onMounted(async () => { v-model="isPosition" label="แสดงเฉพาะตำแหน่งที่ตรงกับการสอบ" color="primary" - @update:model-value="fetchIsPosition" + @update:model-value=" + props.fetchDataTable?.(props.nodeId, props.nodeLevel) + " > แสดงเฉพาะตำแหน่งที่ตรงกับการสอบ @@ -271,6 +292,54 @@ onMounted(async () => { > +
+
+
+ + แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม + +
+ +
+ + +
+
+ + +
+
+
diff --git a/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue b/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue index ca86fbd9b..66b4f79e8 100644 --- a/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue +++ b/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue @@ -1,5 +1,5 @@