fix interface
This commit is contained in:
parent
ea173b3809
commit
4b74271f0e
2 changed files with 82 additions and 89 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
@ -295,65 +296,6 @@ 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
|
||||
|
|
@ -720,28 +662,32 @@ function clearDateAnnounce() {
|
|||
dateAnnounce.value = null;
|
||||
}
|
||||
|
||||
const mainDataPosLevel = ref<any[]>([]);
|
||||
const optionPosLevel1 = ref<any[]>([]);
|
||||
const filterOptionPosLevel1 = ref<any[]>([]);
|
||||
|
||||
const optionPosLevel2 = ref<any[]>([]);
|
||||
const filterOptionPosLevel2 = ref<any[]>([]);
|
||||
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: any) => e.posTypeRank <= 2
|
||||
(e: ResponesePosType) => e.posTypeRank <= 2
|
||||
);
|
||||
|
||||
const getDataByRank = (rank: number) => {
|
||||
const data =
|
||||
res.data.result.find((e: any) => e.posTypeRank === rank)?.posLevels ||
|
||||
[];
|
||||
res.data.result.find((e: ResponesePosType) => e.posTypeRank === rank)
|
||||
?.posLevels || [];
|
||||
return data
|
||||
.filter((e: any) => e.posLevelRank === 1)
|
||||
.map((e: any) => ({
|
||||
.filter((e: DataPosLevel) => e.posLevelRank === 1)
|
||||
.map((e: DataPosLevel) => ({
|
||||
id: e.id.toString(),
|
||||
name: e.posLevelName.toString(),
|
||||
level: e.posLevelRank,
|
||||
|
|
@ -761,25 +707,27 @@ async function fetchPositionType() {
|
|||
});
|
||||
}
|
||||
|
||||
const optionPosType1 = ref<any[]>([]);
|
||||
const filterOptionPosType1 = ref<any[]>([]);
|
||||
|
||||
const optionPosType2 = ref<any[]>([]);
|
||||
const filterOptionPosType2 = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* ฟังก์ชันเรียกข้อมูลตำแหน่ง
|
||||
* @param level ระดับข้องประเภทตำแหน่ง
|
||||
*/
|
||||
function fetchPosition(level: number) {
|
||||
http
|
||||
.post(config.API.orgPosTypeSearch, {
|
||||
posType: mainDataPosLevel.value.find((e: any) => e.posTypeRank === level)
|
||||
.id,
|
||||
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: any) => ({
|
||||
id: r.id.toString(),
|
||||
name: r.positionName.toString(),
|
||||
}));
|
||||
const option: DataOption2[] = res.data.result.map(
|
||||
(r: ResponesePosition) => ({
|
||||
id: r.id.toString(),
|
||||
name: r.positionName.toString(),
|
||||
})
|
||||
);
|
||||
|
||||
if (level === 1) {
|
||||
optionPosType1.value = option;
|
||||
|
|
@ -794,6 +742,11 @@ function fetchPosition(level: number) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันเปลี่ยนประเภทตำแหน่ง
|
||||
* @param val ค่าประเภทตำแหน่ง 0 = ประเภททั่วไป ,1 = ประเภทวิชาการ
|
||||
* @param index ตำแหน่งของข้อมูล
|
||||
*/
|
||||
function onUpdateHighDegree(val: string, index: string) {
|
||||
rowsPosition.value[index].position = null;
|
||||
rowsPosition.value[index].level =
|
||||
|
|
@ -817,8 +770,6 @@ onMounted(async () => {
|
|||
edit.value = false;
|
||||
}
|
||||
await fetchPositionType();
|
||||
await fetchPositionPath();
|
||||
await fetchPositionLevel();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue