diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 19a34b306..91bc7790d 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -35,6 +35,8 @@ export default { orgPosPositionExecutive: () => `${orgPos}/position/executive`, orgPosExecutive: `${orgPos}/executive`, orgPosType: `${orgPos}/type`, + orgPosTypeSearch: `${orgPos}/position/search`, + orgPosTypeId: (id: string) => `${orgPos}/type/${id}`, orgPosLevel: `${orgPos}/level`, orgPosMaster: `${orgPos}/master`, @@ -66,7 +68,8 @@ export default { // ค้นหาคนตามเงื่อนไข orgSearchPersonal: () => `${organization}/profile/search-personal`, - orgSearchPersonalByType: (type:string) => `${organization}/profile${type}/search-personal`, + orgSearchPersonalByType: (type: string) => + `${organization}/profile${type}/search-personal`, /** บรรจุแต่งตั้ง*/ orgPosPlacement: `${orgPos}/placement/search`, @@ -158,5 +161,5 @@ export default { keycloakLogSSO: `${organization}/keycloak/log/sso`, - reportOrgByType:(type:string)=>`${reportOrg}/registry-${type}` + reportOrgByType: (type: string) => `${reportOrg}/registry-${type}`, }; diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index e72bd36d6..5cfa64f12 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -76,6 +76,9 @@ export default { // ประวัติการศึกษา profileNewEducation: (type: string) => `${registryNew}${type}/educations`, + profileNewEducationSort: (type: string) => + `${registryNew}${type}/educations/sort`, + profileNewEducationByProfileId: (profileId: string, type: string) => `${registryNew}${type}/educations/${profileId}`, profileNewEducationByEducationId: (educationId: string, type: string) => @@ -202,5 +205,6 @@ export default { developMentPlan: `${registryNew}/development`, - requestInformationbyType:(type:string,id:string)=>`${registryNew}/request-edit/${type}/${id}` + requestInformationbyType: (type: string, id: string) => + `${registryNew}/request-edit/${type}/${id}`, }; diff --git a/src/modules/03_recruiting/interface/response/Main.ts b/src/modules/03_recruiting/interface/response/Main.ts index 6771a73d2..0e817fbe8 100644 --- a/src/modules/03_recruiting/interface/response/Main.ts +++ b/src/modules/03_recruiting/interface/response/Main.ts @@ -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, +}; diff --git a/src/modules/03_recruiting/views/01_compete/DetailEx.vue b/src/modules/03_recruiting/views/01_compete/DetailEx.vue index cd6e2a815..de026a691 100644 --- a/src/modules/03_recruiting/views/01_compete/DetailEx.vue +++ b/src/modules/03_recruiting/views/01_compete/DetailEx.vue @@ -36,14 +36,16 @@ const number = ref(""); const score_expired = ref(""); const mixin = useCounterMixin(); const { messageError, showLoader, hideLoader } = mixin; -const examID = ref("62150001"); -const prefix = ref("นาย"); -const fullname = ref("เกียรติศักดิ์ บัณฑิต"); +const examID = ref(""); +const prefix = ref(""); +const fullname = ref(""); const importId = ref(route.params.id as string); // Period Import Id const examId = ref(route.params.examId as string); // เลขประจำตัวสอบ +const isData = ref(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 }} -
+
+ + ไม่พบรายละเอียดการสอบ + +
+ +
diff --git a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue index 79707be3d..75db8aa35 100644 --- a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue +++ b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue @@ -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(null); //วันประกาศผล const dateExam = ref(null); //วันที่สอบ const myFormPayment = ref(); const myFormPosition = ref(); -const positionPathOptions = ref([]); -const positionPathFilters = ref([]); -const positionLevelOptions = ref([]); -const positionLevelFilters = ref([]); const organizationShortName = ref(); const organizationName = ref(); const examTypeOptions = [ @@ -142,12 +143,13 @@ const columnsPosition = ref([ 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([ 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([]); //ข้อมูลรายการประเภทตำแหน่ง +const optionPosLevel1 = ref([]); // ตัวเลือกระดับประเภททั่วไป +const filterOptionPosLevel1 = ref([]); //ข้อมูลตัวเลือกระดับประเภททั่วไป +const optionPosLevel2 = ref([]); //ตัวเลือกระดับประเภทวิชาการ +const filterOptionPosLevel2 = ref([]); //ข้อมูลตัวเลือกระดับประเภทวิชาการ +const optionPosType1 = ref([]); //ตัวเลือกตำแหน่งของระดับปฏิบัติงาน +const filterOptionPosType1 = ref([]); //ข้อมูลตัวเลือกตำแหน่งของระดับปฏิบัติงาน +const optionPosType2 = ref([]); //ตัวเลือกตำแหน่งของระดับปฏิบัติการ +const filterOptionPosType2 = ref([]); //ข้อมูลตัวเลือกตำแหน่งของระดับปฏิบัติการ + +/** ฟังก์ชันเรียกข้อมูล ประเภทตำแหน่ง*/ +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(); }); @@ -1093,82 +1141,7 @@ onMounted(async () => { mask="###" /> - - - - - - - - - - - - + { color="teal" :disable="checkRoutePermisson" val="0" + @update:model-value=" + onUpdateHighDegree( + props.row.highDegree, + props.rowIndex + ) + " /> { color="teal" :disable="checkRoutePermisson" val="1" + @update:model-value=" + onUpdateHighDegree( + props.row.highDegree, + props.rowIndex + ) + " /> + + + + + + + + + + + + { > เพิ่มข้อมูล + ("modal", { required: true }); const props = defineProps({ dataSort: Array as PropType, }); +const profileId = ref(route.params.id.toString()); //id profile /** ข้อมูล Table*/ const rows = ref([]); +const selected = ref([]); const columns = ref([ - { - name: "no", - align: "left", - label: "ลำดับ", - sortable: true, - field: "no", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, { name: "educationLevel", align: "left", @@ -234,16 +227,42 @@ const columns = ref([ */ function onDrop(from: number, to: number) { rows.value.splice(to, 0, rows.value.splice(from, 1)[0]); + selected.value.push(rows.value[0]); } /** function บันทึกการจัดลำดับ*/ function onSubmit() { - dialogConfirm($q, () => {}); + dialogConfirm($q, async () => { + showLoader(); + const body = rows.value.map((e: any) => ({ + id: e.id, + isUse: selected.value.some((i: any) => i.id === e.id), + })); + + await http + .put(config.API.profileNewEducationSort("") + `/${profileId.value}`, { + data: body, + }) + .then(async () => { + await success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }); } watch(modal, async () => { if (modal.value && props.dataSort) { rows.value = props.dataSort; + selected.value.push(rows.value[0]); + } else { + selected.value = []; + rows.value = []; } }); @@ -252,7 +271,7 @@ watch(modal, async () => { @@ -277,26 +296,34 @@ watch(modal, async () => { hide-bottom hide-pagination hide-header + selection="multiple" + v-model:selected="selected" > +