ปิด/เปิด ให้ดาวน์โหลดใบสมัครสรรหา

This commit is contained in:
Warunee Tamkoo 2025-11-26 17:39:18 +07:00
parent 5aa48d73d3
commit 55ab6e157f
2 changed files with 26 additions and 10 deletions

View file

@ -11,13 +11,11 @@ import config from "@/app.config";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
const route = useRoute(); const route = useRoute();
const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dateToISO, success, modalError, dialogMessage } = mixin; const { dateToISO, success, modalError, dialogMessage } = mixin;
const detailReport = ref<any>();
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const table = ref<any>(null); const table = ref<any>(null);
const files = ref<File[]>([]); const files = ref<File[]>([]);
@ -104,6 +102,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
defualt: false, defualt: false,
}, },
isShowExaminfo: {
type: Boolean,
required: false,
},
save: { save: {
type: Function, type: Function,
default: () => console.log("not function"), default: () => console.log("not function"),
@ -395,23 +397,30 @@ async function clickCandidateList() {
} }
async function onCheckShowExaminfo() { async function onCheckShowExaminfo() {
console.log(props.isShowExaminfo);
dialogMessage( dialogMessage(
$q, $q,
"ยืนยันการเปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบนี้หรือไม่?", `ยืนยันการ${props.isShowExaminfo ? "ปิด" : "เปิด"}`,
"ยืนยันการเปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบ", `${
"mdi-email-check-outline", props.isShowExaminfo ? "ปิดไม่" : "เปิด"
}ใหดาวนโหลดใบสมคร แสดงสถานทสอบ และเลขประจำตวสอบหรอไม?`,
props.isShowExaminfo ? "mdi-eye-off" : "mdi-eye-check",
"ยืนยัน", "ยืนยัน",
"public", props.isShowExaminfo ? "red" : "public",
async () => { async () => {
try { try {
showLoader(); showLoader();
await http.post(config.API.checkShowExaminfo, { await http.post(config.API.checkShowExaminfo, {
examId: examId.value, examId: examId.value,
status: !props.isShowExaminfo,
}); });
await props.fetchData(); await props.fetchData();
success( success(
$q, $q,
"เปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบสำเร็จ" `${
props.isShowExaminfo ? "เปิด" : "ปิดไม่"
}ใหดาวนโหลดใบสมคร แสดงสถานทสอบ และเลขประจำตวสอบสำเร`
); );
} catch (error) { } catch (error) {
messageError($q, error); messageError($q, error);
@ -529,14 +538,15 @@ watch(
<q-btn <q-btn
v-if="checkPermission($route)?.attrIsUpdate" v-if="checkPermission($route)?.attrIsUpdate"
size="md" size="md"
icon="mdi-eye-check" :icon="isShowExaminfo ? 'mdi-eye-off' : 'mdi-eye-check'"
round round
flat flat
color="info" :color="isShowExaminfo ? 'red' : 'info'"
@click="onCheckShowExaminfo" @click="onCheckShowExaminfo"
> >
<q-tooltip <q-tooltip
>เปดใหดาวนโหลดใบสมคร แสดงสถานทสอบ และเลขประจำตวสอบ</q-tooltip >{{ isShowExaminfo ? "ปิดไม่" : "เปิด" }}ใหดาวนโหลดใบสมคร
แสดงสถานทสอบ และเลขประจำตวสอบ</q-tooltip
> >
</q-btn> </q-btn>
</div> </div>

View file

@ -33,6 +33,7 @@ const examId = ref<string>(route.params.examId.toString());
const visible = ref<boolean>(false); // card const visible = ref<boolean>(false); // card
const dataNum = ref<DataNumObject[]>([]); // const dataNum = ref<DataNumObject[]>([]); //
const isFee = ref<boolean>(false); const isFee = ref<boolean>(false);
const isShowExaminfo = ref<boolean>(false);
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const visibleColumns = ref<String[]>([ const visibleColumns = ref<String[]>([
"no", "no",
@ -283,6 +284,10 @@ async function fetchData(loading: boolean = true) {
isShowExamInfo: r.isShowExamInfo, isShowExamInfo: r.isShowExamInfo,
}); });
}); });
isShowExaminfo.value = data.data.some(
(item: any) => item.isShowExamInfo === true
);
} }
loading ?? hideLoader(); loading ?? hideLoader();
}) })
@ -493,6 +498,7 @@ onMounted(async () => {
@update:change-page="changePage" @update:change-page="changePage"
:max-page="maxPage" :max-page="maxPage"
:is-fee="isFee" :is-fee="isFee"
:is-show-examinfo="isShowExaminfo"
> >
<template #columns="props"> <template #columns="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">