UI บรรจุแต่งตั้ง รายชื่อผู้สอบผ่าน popup เลือกหน่วยงาน และ filter คนหน้ารายชื่อตามสถานภาพ

This commit is contained in:
setthawutttty 2024-10-25 15:15:43 +07:00
parent de115abc22
commit 56c6c7ce05
5 changed files with 210 additions and 23 deletions

View file

@ -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<string>("positionId", { required: true }); //id
@ -20,9 +27,25 @@ const date = defineModel<Date>("datePos", { required: true }); //วันยท
const positionData = defineModel<any[]>("position", { required: true }); //
const isAll = defineModel<boolean>("isAll", { required: true }); //
const isBlank = defineModel<boolean>("isBlank", { required: true }); //
const isPosition = defineModel<boolean>("isPosition", { required: true });
const isPositionOld = defineModel<boolean>("isPositionOld", { required: true }); //
const posType = defineModel<FormPosType>("posType", { required: true }); //
const posLevel = defineModel<string>("posLevel", { required: true }); //
const optionPosType = defineModel<FormPosType[]>("optionPosType", {
required: true,
});
const optionPosLevel = defineModel<FormPosLevel[]>("optionPosLevel", {
required: true,
});
const positionRows = ref<DataPositionNo[]>(positionData.value);
const isPosition = ref<boolean>(true);
const props = defineProps({
fetchDataTable: Function,
onPosType: Function,
nodeId: String,
nodeLevel: Number,
});
//Table
const filters = ref<string>(""); //
@ -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;
}
});
</script>
@ -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)
"
>
<q-tooltip>แสดงเฉพาะตำแหนงทตรงกบการสอบ</q-tooltip>
</q-checkbox>
@ -271,6 +292,54 @@ onMounted(async () => {
>
</q-checkbox>
</div>
<div class="col-12">
<div class="row q-gutter-sm no-wrap">
<div>
<q-checkbox
keep-color
v-model="isPositionOld"
label="แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม"
color="primary"
@update:model-value="onPositionOld"
>
<q-tooltip>แสดงตำแหนงทตรงกบประเภทและระดบเด</q-tooltip>
</q-checkbox>
</div>
<div class="col-3">
<q-select
v-if="isPositionOld"
v-model="posType"
:options="optionPosType"
option-label="posTypeName"
label="ประเภทตำแหน่ง"
dense
outlined
@update:model-value="props.onPosType?.()"
>
</q-select>
</div>
<div class="col-3">
<q-select
v-if="isPositionOld"
:readonly="posType == null"
v-model="posLevel"
:options="optionPosLevel"
option-label="posLevelName"
option-value="posLevelName"
label="ระดับตำแหน่ง"
dense
outlined
emit-value
map-options
@update:model-value="
props.fetchDataTable?.(props.nodeId, props.nodeLevel)
"
>
</q-select>
</div>
</div>
</div>
<div class="col-12 q-pa-md">
<q-toolbar style="padding: 0px">
<q-space />