Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-01-08 14:59:18 +07:00
commit e3fed86699
18 changed files with 806 additions and 407 deletions

View file

@ -14,4 +14,46 @@ interface ResponseObject {
government: String;
}
export type { ResponseObject };
interface ResponesePosType {
createdAt: string;
id: string;
lastUpdateFullName: string;
lastUpdatedAt: string;
posTypeName: string;
posTypeRank: number;
posLevels: DataPosLevel[];
}
interface DataPosLevel {
createdAt: string;
id: string;
lastUpdateFullName: string;
lastUpdatedAt: string;
posLevelAuthority: string;
posLevelName: string;
posLevelRank: number;
}
interface ResponesePosition {
createdAt: string;
id: string;
isSpecial: boolean;
lastUpdateFullName: string;
lastUpdatedAt: string;
posLevelId: string;
posLevelName: string;
posTypeId: string;
posTypeName: string;
positionArea: string;
positionExecutiveField: null;
positionField: string;
positionIsSelected: boolean;
positionName: string;
}
export type {
ResponseObject,
ResponesePosType,
DataPosLevel,
ResponesePosition,
};

View file

@ -36,14 +36,16 @@ const number = ref<string>("");
const score_expired = ref<string>("");
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const examID = ref<string>("62150001");
const prefix = ref<string>("นาย");
const fullname = ref<string>("เกียรติศักดิ์ บัณฑิต");
const examID = ref<string>("");
const prefix = ref<string>("");
const fullname = ref<string>("");
const importId = ref<string>(route.params.id as string); // Period Import Id
const examId = ref<string>(route.params.examId as string); //
const isData = ref<boolean>(false);
/** ดึงข้อมูล */
async function fetchData() {
isData.value = false;
showLoader();
await http
.get(config.API.getExamDetail(importId.value, examId.value))
@ -76,6 +78,7 @@ async function fetchData() {
scoreSum.value = data.scoreResult.scoreSum;
examResultinscore.value = data.scoreResult.examResult;
}
isData.value = true;
}
})
.catch((e) => {
@ -147,7 +150,13 @@ onMounted(async () => {
รายละเอยดของผสมครสอบ {{ examID }} : {{ prefix }}{{ fullname }}
</div>
<q-card flat bordered class="col-12 row q-mt-sm q-pa-md">
<div class="row q-col-gutter-md col-12">
<div class="col-12" v-if="!isData">
<q-banner inline-actions rounded class="bg-warning text-center">
ไมพบรายละเอยดการสอบ
</q-banner>
</div>
<div class="row q-col-gutter-md col-12" v-else>
<div class="col-xs-12 col-sm-12 col-md-6">
<q-card bordered flat class="col-12 q-pa-md">
<div class="col-12 q-col-gutter-sm row items-center">

View file

@ -21,6 +21,11 @@ import type {
DataOption2,
UploadType,
} from "@/modules/02_organization/interface/index/Main";
import type {
ResponesePosType,
DataPosLevel,
ResponesePosition,
} from "@/modules/03_recruiting/interface/response/Main";
import ProfileTable from "@/modules/03_recruiting/components/Table1.vue";
@ -60,10 +65,6 @@ const dateAnnounce = ref<Date | null>(null); //วันประกาศผล
const dateExam = ref<Date | null>(null); //
const myFormPayment = ref<any>();
const myFormPosition = ref<any>();
const positionPathOptions = ref<DataOption2[]>([]);
const positionPathFilters = ref<DataOption2[]>([]);
const positionLevelOptions = ref<DataOption2[]>([]);
const positionLevelFilters = ref<DataOption2[]>([]);
const organizationShortName = ref<DataOption2>();
const organizationName = ref<DataOption2>();
const examTypeOptions = [
@ -142,12 +143,13 @@ const columnsPosition = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "position",
name: "highDegree",
align: "left",
label: "ตำแหน่ง",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "position",
field: "highDegree",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -165,16 +167,17 @@ const columnsPosition = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "highDegree",
name: "position",
align: "left",
label: "ประเภทตำแหน่ง",
label: "ตำแหน่ง",
sortable: true,
field: "highDegree",
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "type",
align: "left",
@ -293,83 +296,38 @@ async function fetchData() {
});
}
/**
* get รายการ ตำแหนงในสายงาน
*/
async function fetchPositionPath() {
showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
const data = res.data.result;
let option: DataOption2[] = [];
data.map((r: DataOption2) => {
option.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionPathOptions.value = option;
positionPathFilters.value = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* get รายการ ตำแหนงระด
*/
async function fetchPositionLevel() {
showLoader();
await http
.get(config.API.positionLevel)
.then((res) => {
const data = res.data.result;
let option: DataOption2[] = [];
data.map((r: DataOption2) => {
option.push({
id: r.id.toString(),
name: r.name.toString(),
level: r.level,
});
});
positionLevelOptions.value = option.filter(
(v: DataOption2) => v.level === 0
);
positionLevelFilters.value = option.filter(
(v: DataOption2) => v.level === 0
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* งช filter
* @param val input
* @param update Function #quasar
* @param refData เเยก case
*/
function filterSelector(val: any, update: Function, refData: string) {
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "positionLevel":
case "positionLevel1":
update(() => {
positionLevelOptions.value = positionLevelFilters.value.filter(
optionPosLevel1.value = filterOptionPosLevel1.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
break;
case "position":
case "positionLevel2":
update(() => {
positionPathOptions.value = positionPathFilters.value.filter(
optionPosLevel2.value = filterOptionPosLevel2.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
break;
case "position1":
update(() => {
optionPosType1.value = filterOptionPosType1.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
break;
case "position2":
update(() => {
optionPosType2.value = filterOptionPosType2.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
@ -495,16 +453,16 @@ async function editData(id: string) {
showLoader();
await http
.put(config.API.periodExamId(id), sendData())
.then(async (res) => {
success($q, "แก้ไขรอบคัดเลือกสำเร็จ");
.then(async () => {
await uploadImgData();
await uploadDocData();
success($q, "แก้ไขรอบคัดเลือกสำเร็จ");
await clickBack();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
.finally(() => {
hideLoader();
});
}
@ -656,7 +614,7 @@ function clickAddPosition() {
position: null,
type: { id: "normol", name: "ทั่วไป" },
code: null,
highDegree: "0",
highDegree: "",
});
}
});
@ -704,6 +662,97 @@ function clearDateAnnounce() {
dateAnnounce.value = null;
}
const mainDataPosLevel = ref<ResponesePosType[]>([]); //
const optionPosLevel1 = ref<DataOption2[]>([]); //
const filterOptionPosLevel1 = ref<DataOption2[]>([]); //
const optionPosLevel2 = ref<DataOption2[]>([]); //
const filterOptionPosLevel2 = ref<DataOption2[]>([]); //
const optionPosType1 = ref<DataOption2[]>([]); //
const filterOptionPosType1 = ref<DataOption2[]>([]); //
const optionPosType2 = ref<DataOption2[]>([]); //
const filterOptionPosType2 = ref<DataOption2[]>([]); //
/** ฟังก์ชันเรียกข้อมูล ประเภทตำแหน่ง*/
async function fetchPositionType() {
http
.get(config.API.orgPosType)
.then((res) => {
mainDataPosLevel.value = res.data.result.filter(
(e: ResponesePosType) => e.posTypeRank <= 2
);
const getDataByRank = (rank: number) => {
const data =
res.data.result.find((e: ResponesePosType) => e.posTypeRank === rank)
?.posLevels || [];
return data
.filter((e: DataPosLevel) => e.posLevelRank === 1)
.map((e: DataPosLevel) => ({
id: e.id.toString(),
name: e.posLevelName.toString(),
level: e.posLevelRank,
}));
};
optionPosLevel1.value = getDataByRank(1);
filterOptionPosLevel1.value = getDataByRank(1);
optionPosLevel2.value = getDataByRank(2);
filterOptionPosLevel2.value = getDataByRank(2);
fetchPosition(1);
fetchPosition(2);
})
.catch((err) => {
messageError($q, err);
});
}
/**
* งกนเรยกขอมลตำแหน
* @param level ระดบของประเภทตำแหน
*/
function fetchPosition(level: number) {
http
.post(config.API.orgPosTypeSearch, {
posType:
mainDataPosLevel.value?.find(
(e: ResponesePosType) => e.posTypeRank === level
)?.id ?? null,
posLevel:
level === 1 ? optionPosLevel1.value[0].id : optionPosLevel2.value[0].id,
})
.then((res) => {
const option: DataOption2[] = res.data.result.map(
(r: ResponesePosition) => ({
id: r.id.toString(),
name: r.positionName.toString(),
})
);
if (level === 1) {
optionPosType1.value = option;
filterOptionPosType1.value = option;
} else if (level === 2) {
optionPosType2.value = option;
filterOptionPosType2.value = option;
}
})
.catch((err) => {
messageError($q, err);
});
}
/**
* งกนเปลยนประเภทตำแหน
* @param val าประเภทตำแหน 0 = ประเภททวไป ,1 = ประเภทวชาการ
* @param index ตำแหนงของขอม
*/
function onUpdateHighDegree(val: string, index: string) {
rowsPosition.value[index].position = null;
rowsPosition.value[index].level =
val === "0" ? optionPosLevel1.value[0] : optionPosLevel2.value[0];
}
watch(fee, () => {
if (fee.value <= 0) {
pay.value = "";
@ -720,8 +769,7 @@ onMounted(async () => {
pay.value = "";
edit.value = false;
}
await fetchPositionPath();
await fetchPositionLevel();
await fetchPositionType();
});
</script>
@ -1093,82 +1141,7 @@ onMounted(async () => {
mask="###"
/>
</q-td>
<q-td key="position" :props="props">
<selector
class=""
outlined
:readonly="checkRoutePermisson"
use-input
v-model="props.row.position"
:options="positionPathOptions"
option-value="id"
option-label="name"
input-debounce="0"
dense
hide-bottom-space
lazy-rules
:rules="[(val:any) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'position'
) "
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section>
<q-item-label>{{ scope.opt.name }}</q-item-label>
</q-item-section>
</q-item>
</template>
<template v-slot:selected-item="scope">
ตำแหน:
<q-chip
dense
square
class="q-my-none q-ml-xs q-mr-none"
>
{{ scope.opt.name }}
</q-chip>
</template>
</selector>
</q-td>
<q-td key="level" :props="props">
<selector
class=""
outlined
use-input
v-model="props.row.level"
:readonly="checkRoutePermisson"
:options="positionLevelOptions"
option-value="id"
option-label="name"
input-debounce="0"
dense
hide-bottom-space
lazy-rules
:rules="[(val:any) => !!val || `${'กรุณาเลือกระดับ'}`]"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'positionLevel'
) "
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section>
<q-item-label>{{ scope.opt.name }}</q-item-label>
</q-item-section>
</q-item>
</template>
<template v-slot:selected-item="scope">
ระด:
<q-chip
dense
square
class="q-my-none q-ml-xs q-mr-none"
>
{{ scope.opt.name }}
</q-chip>
</template>
</selector>
</q-td>
<q-td key="highDegree" :props="props">
<q-radio
v-model="props.row.highDegree"
@ -1176,6 +1149,12 @@ onMounted(async () => {
color="teal"
:disable="checkRoutePermisson"
val="0"
@update:model-value="
onUpdateHighDegree(
props.row.highDegree,
props.rowIndex
)
"
/>
<q-radio
v-model="props.row.highDegree"
@ -1183,8 +1162,82 @@ onMounted(async () => {
color="teal"
:disable="checkRoutePermisson"
val="1"
@update:model-value="
onUpdateHighDegree(
props.row.highDegree,
props.rowIndex
)
"
/>
</q-td>
<q-td key="level" :props="props">
<selector
:disable="props.row.highDegree === ''"
class=""
outlined
use-input
v-model="props.row.level"
:readonly="checkRoutePermisson"
:options="
props.row.highDegree === '0'
? optionPosLevel1
: optionPosLevel2
"
option-value="id"
option-label="name"
input-debounce="0"
dense
hide-bottom-space
lazy-rules
:rules="[(val:any) => !!val || `${'กรุณาเลือกระดับ'}`]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn, props.row.highDegree === '0' ? 'positionLevel1':'positionLevel2'
) "
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section>
<q-item-label>{{ scope.opt.name }}</q-item-label>
</q-item-section>
</q-item>
</template>
</selector>
</q-td>
<q-td key="position" :props="props">
<selector
:disable="props.row.highDegree === ''"
class=""
outlined
:readonly="checkRoutePermisson"
use-input
v-model="props.row.position"
:options="
props.row.highDegree === '0'
? optionPosType1
: optionPosType2
"
option-value="id"
option-label="name"
input-debounce="0"
dense
hide-bottom-space
lazy-rules
:rules="[(val:any) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn, props.row.highDegree === '0' ? 'position1' :'position2'
) "
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section>
<q-item-label>{{ scope.opt.name }}</q-item-label>
</q-item-section>
</q-item>
</template>
</selector>
</q-td>
<q-td key="type" :props="props">
<selector
class=""