no message
This commit is contained in:
parent
8bba6bf7c9
commit
c4e1c4510a
5 changed files with 724 additions and 562 deletions
|
|
@ -5,4 +5,7 @@ export default {
|
||||||
MainDetail: (year:number) => `${placement}/exam/${year}`,
|
MainDetail: (year:number) => `${placement}/exam/${year}`,
|
||||||
yearOptions: () => `${placement}/fiscal`,
|
yearOptions: () => `${placement}/fiscal`,
|
||||||
redirectToPage: (examId:string) => `${placement}/pass/${examId}`,
|
redirectToPage: (examId:string) => `${placement}/pass/${examId}`,
|
||||||
|
disclaimF: () => `${placement}/pass/disclaim`,
|
||||||
|
defermentF: () => `${placement}/pass/deferment`,
|
||||||
|
getStatCard:(examId:string) =>`${placement}/pass/stat/${examId}`
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive, ref, useAttrs } from "vue";
|
import { onMounted, reactive, ref, useAttrs, watchEffect } from "vue";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||||
import type { DataOption,DataOption1 } from "@/modules/05_placement/interface/index/Main";
|
import type {
|
||||||
|
DataOption,
|
||||||
|
DataOption1,
|
||||||
|
} from "@/modules/05_placement/interface/index/Main";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
@ -15,7 +18,7 @@ const DataStore = usePlacementDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dateText, messageError } = mixin;
|
const { dateText, messageError } = mixin;
|
||||||
|
const selectedFiscalYear = ref(0);
|
||||||
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
||||||
const textDate = (value: Date) => {
|
const textDate = (value: Date) => {
|
||||||
return dateText(value);
|
return dateText(value);
|
||||||
|
|
@ -108,46 +111,30 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// ข้อมูลตาราง (จำลอง)
|
// ข้อมูลตาราง (จำลอง)
|
||||||
const rows = ref<FormPlacementMainData[]>([
|
const rows = ref<FormPlacementMainData[]>([]);
|
||||||
{
|
const yearValue = ref<number>(0); // เพิ่มตัวแปรในโมดูล
|
||||||
id: 0,
|
|
||||||
examRound: "",
|
|
||||||
examOrder: 0,
|
|
||||||
fiscalYear: 0,
|
|
||||||
numberOfCandidates: 0,
|
|
||||||
examTypeValue: "",
|
|
||||||
examTypeName: "",
|
|
||||||
accountStartDate: "",
|
|
||||||
accountExpirationDate: "",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
let OriginalData = ref<FormPlacementMainData[]>([]);
|
let OriginalData = ref<FormPlacementMainData[]>([]);
|
||||||
let UpdataData = ref<FormPlacementMainData[]>([]);
|
let UpdataData = ref<FormPlacementMainData[]>([]);
|
||||||
|
watchEffect(() => {
|
||||||
|
rows.value = OriginalData.value;
|
||||||
|
});
|
||||||
const OriginalDataFetch = async (year: number) => {
|
const OriginalDataFetch = async (year: number) => {
|
||||||
|
yearValue.value = year;
|
||||||
try {
|
try {
|
||||||
const response = await http.get(config.API.MainDetail(year));
|
const response = await http.get(config.API.MainDetail(year));
|
||||||
const apiData = response.data.result;
|
const apiData = response.data.result;
|
||||||
console.log("🚀 ~ file: Main.vue:160 ~ .then ~ res:", apiData);
|
console.log(`🚀 ข้อมูลจากการ get (${year})`, apiData);
|
||||||
await DataStore.DataMain(apiData);
|
await DataStore.DataMain(apiData);
|
||||||
OriginalData.value = await DataStore.DataMainOrig;
|
OriginalData.value = await DataStore.DataMainOrig;
|
||||||
UpdataData.value = OriginalData.value.filter((data) => data.fiscalYear === year); // ใช้ค่า fiscalYear ในการกรองข้อมูล
|
UpdataData.value = OriginalData.value.filter(
|
||||||
|
(data) => data.fiscalYear === year
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
messageError($q, error);
|
messageError($q, error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await fiscalYearFilter();
|
|
||||||
await OriginalDataFetch(fiscalyear.value);
|
|
||||||
examTimeFilter();
|
|
||||||
await examTypeFilter();
|
|
||||||
expiredAccountFilter();
|
|
||||||
await searchFilterTable();
|
|
||||||
});
|
|
||||||
|
|
||||||
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
||||||
const redirectToPage = (examId?: number) => {
|
const redirectToPage = (examId?: number) => {
|
||||||
router.push(`/placement/pass/${examId}`);
|
router.push(`/placement/pass/${examId}`);
|
||||||
|
|
@ -158,27 +145,30 @@ const fiscalyear = ref<number>(0);
|
||||||
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
||||||
const addedfiscalYearValues: number[] = [];
|
const addedfiscalYearValues: number[] = [];
|
||||||
const fiscalYearFilter = async () => {
|
const fiscalYearFilter = async () => {
|
||||||
let maxYear = 0;
|
|
||||||
try {
|
try {
|
||||||
const response = await http.get(config.API.yearOptions());
|
const response = await http.get(config.API.yearOptions());
|
||||||
const dataOptions = response.data.result;
|
const dataOptions = response.data.result;
|
||||||
console.log("🚀 ", dataOptions);
|
fiscalyearOP.push(...dataOptions);
|
||||||
for (let data of dataOptions) {
|
|
||||||
fiscalyearOP.push(data);
|
|
||||||
|
|
||||||
|
let maxYear = 0;
|
||||||
|
for (let data of dataOptions) {
|
||||||
if (data.id > maxYear) {
|
if (data.id > maxYear) {
|
||||||
maxYear = data.id;
|
maxYear = data.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fiscalyear.value = maxYear;
|
fiscalyear.value = maxYear;
|
||||||
console.log("Selected Year:", fiscalyear.value);
|
|
||||||
await OriginalDataFetch(fiscalyear.value); // เรียกใช้งานฟังก์ชันที่ดึงข้อมูลใหม่เมื่อมีการเลือกใน fiscalyear
|
// อัพเดตค่าของ selectedFiscalYear
|
||||||
|
selectedFiscalYear.value = fiscalyear.value;
|
||||||
|
|
||||||
|
// โหลดข้อมูลใหม่เมื่อตัวเลือกปีเปลี่ยนแปลง
|
||||||
|
await OriginalDataFetch(selectedFiscalYear.value);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-------------------|เลือกปีงบประมาณตาม API|--------------------//
|
//-------------------|เลือกปีงบประมาณตาม API|--------------------//
|
||||||
interface YearOption {
|
interface YearOption {
|
||||||
id: number;
|
id: number;
|
||||||
|
|
@ -187,20 +177,17 @@ interface YearOption {
|
||||||
|
|
||||||
const searchfiscalyear = async () => {
|
const searchfiscalyear = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(config.API.yearOptions());
|
const res = await http.get(config.API.yearOptions());
|
||||||
const dataOptions: YearOption[] = response.data.result;
|
const dataOptions: YearOption[] = res.data.result;
|
||||||
console.log("🚀 ~ file: Main.vue:189 ~ .then ~ dataOptions:", dataOptions);
|
|
||||||
|
|
||||||
if (fiscalyear.value === 0) {
|
if (fiscalyear.value === 0) {
|
||||||
// Perform any desired operations for selecting "ทั้งหมด" option
|
await OriginalDataFetch(0);
|
||||||
// เช่นตัวอย่างข้างล่างนี้ ที่แสดงผลลัพธ์ทั้งหมดใน console.log
|
|
||||||
console.log("All Year Objects:", dataOptions);
|
|
||||||
} else {
|
} else {
|
||||||
// Find the selected object based on the chosen year
|
const selectedYearObject = dataOptions.find(
|
||||||
const selectedYearObject = dataOptions.find((option: YearOption) => option.id === fiscalyear.value);
|
(option: YearOption) => option.id === fiscalyear.value
|
||||||
|
);
|
||||||
|
OriginalDataFetch(fiscalyear.value);
|
||||||
|
|
||||||
if (selectedYearObject) {
|
if (selectedYearObject) {
|
||||||
console.log("Selected Year Object:", selectedYearObject);
|
|
||||||
// Perform any desired operations with the selected object here
|
|
||||||
} else {
|
} else {
|
||||||
console.log("No Selected Year Object");
|
console.log("No Selected Year Object");
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +197,6 @@ const searchfiscalyear = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------|ค้นหาในตาราง|-----------------//
|
//-------------------|ค้นหาในตาราง|-----------------//
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const filterRef = ref<any>(null);
|
const filterRef = ref<any>(null);
|
||||||
|
|
@ -290,7 +275,7 @@ const expiredAccountFilter = async () => {
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
const updatedRows = OriginalData.value.map((data) => {
|
const updatedRows = OriginalData.value.map((data) => {
|
||||||
let expirationDate = new Date(data.accountExpirationDate);
|
let expirationDate = new Date(data.accountExpirationDate);
|
||||||
let isExpired = expirationDate < currentDate;
|
let isExpired = currentDate > expirationDate;
|
||||||
|
|
||||||
return { ...data, isExpired };
|
return { ...data, isExpired };
|
||||||
});
|
});
|
||||||
|
|
@ -308,6 +293,13 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
||||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||||
else return start + "-" + end + " ใน " + total;
|
else return start + "-" + end + " ใน " + total;
|
||||||
};
|
};
|
||||||
|
onMounted(async () => {
|
||||||
|
await fiscalYearFilter();
|
||||||
|
examTimeFilter();
|
||||||
|
await examTypeFilter();
|
||||||
|
expiredAccountFilter();
|
||||||
|
await searchFilterTable();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -315,7 +307,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
||||||
รายการสอบแข่งขัน / คัดเลือก
|
รายการสอบแข่งขัน / คัดเลือก
|
||||||
</div>
|
</div>
|
||||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-md">
|
||||||
<div class="row col-12 q-col-gutter-sm">
|
<div class="row col-12 q-col-gutter-sm">
|
||||||
<q-select
|
<q-select
|
||||||
class="col-xs-12 col-sm-3 col-md-2"
|
class="col-xs-12 col-sm-3 col-md-2"
|
||||||
|
|
@ -421,8 +413,10 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
{{ rows }}
|
||||||
<q-table
|
<q-table
|
||||||
ref="table"
|
ref="table"
|
||||||
|
:row="rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="UpdataData"
|
:rows="UpdataData"
|
||||||
:filter="filterKeyword"
|
:filter="filterKeyword"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { defineAsyncComponent } from "@vue/runtime-core";
|
import { defineAsyncComponent } from "@vue/runtime-core";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter ,useRoute} from "vue-router";
|
||||||
import cardTop from "@/modules/05_placement/components/pass/StatCard.vue";
|
import cardTop from "@/modules/05_placement/components/pass/StatCard.vue";
|
||||||
import keycloak from "@/plugins/keycloak";
|
import keycloak from "@/plugins/keycloak";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
let roleAdmin = ref<boolean>(false);
|
let roleAdmin = ref<boolean>(false);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const examId = route.params.examId;
|
||||||
const year = ref<string>("2566");
|
const year = ref<string>("2566");
|
||||||
const round = ref<string>("1");
|
const round = ref<string>("1");
|
||||||
const title = ref<string>("การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ");
|
const title = ref<string>("การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ");
|
||||||
|
|
@ -15,14 +18,38 @@ const AddTablePosition = defineAsyncComponent(
|
||||||
() => import("@/modules/05_placement/components/pass/Table.vue")
|
() => import("@/modules/05_placement/components/pass/Table.vue")
|
||||||
);
|
);
|
||||||
const stat = ref<any>({
|
const stat = ref<any>({
|
||||||
total: 5,
|
total: 0,
|
||||||
unContain: 1,
|
unContain: 0,
|
||||||
prepareContain: 3,
|
prepareContain: 0,
|
||||||
contain: 1,
|
contain: 0,
|
||||||
disclaim: 0,
|
disclaim: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getStat = async () => {
|
||||||
|
const examIdString = Array.isArray(examId) ? examId[0] : examId;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await http.get(config.API.getStatCard(examIdString));
|
||||||
|
const statCard = res.data.result;
|
||||||
|
|
||||||
|
// อัปเดตค่าในตัวแปร stat
|
||||||
|
stat.value = {
|
||||||
|
total: statCard.total,
|
||||||
|
unContain: statCard.unContain,
|
||||||
|
prepareContain: statCard.prepareContain,
|
||||||
|
contain: statCard.contain,
|
||||||
|
disclaim: statCard.disclaim,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("🚀 ~ file: Table.vue:96 ~ getStatCard ~ data:", statCard);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error retrieving data:", error);
|
||||||
|
// จัดการข้อผิดพลาดที่เกิดขึ้นในการรับข้อมูล
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await getStat()
|
||||||
if (keycloak.tokenParsed != null) {
|
if (keycloak.tokenParsed != null) {
|
||||||
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
|
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -48,6 +48,7 @@ interface PartialTableName {
|
||||||
positionPath: string;
|
positionPath: string;
|
||||||
reportingDate: string;
|
reportingDate: string;
|
||||||
bmaOfficer: string;
|
bmaOfficer: string;
|
||||||
|
number: number;
|
||||||
statusId: string;
|
statusId: string;
|
||||||
disclaim: string;
|
disclaim: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue