no message
This commit is contained in:
parent
8bba6bf7c9
commit
c4e1c4510a
5 changed files with 724 additions and 562 deletions
|
|
@ -1,13 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
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 keycloak from "@/plugins/keycloak";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
let roleAdmin = ref<boolean>(false);
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const examId = route.params.examId;
|
||||
const year = ref<string>("2566");
|
||||
const round = ref<string>("1");
|
||||
const title = ref<string>("การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ");
|
||||
|
|
@ -15,14 +18,38 @@ const AddTablePosition = defineAsyncComponent(
|
|||
() => import("@/modules/05_placement/components/pass/Table.vue")
|
||||
);
|
||||
const stat = ref<any>({
|
||||
total: 5,
|
||||
unContain: 1,
|
||||
prepareContain: 3,
|
||||
contain: 1,
|
||||
total: 0,
|
||||
unContain: 0,
|
||||
prepareContain: 0,
|
||||
contain: 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 () => {
|
||||
await getStat()
|
||||
if (keycloak.tokenParsed != null) {
|
||||
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue