สอบคัดเลือกตรวจสอบหลายคน
This commit is contained in:
parent
178a6ac8c7
commit
a74ab974b4
4 changed files with 121 additions and 3 deletions
|
|
@ -221,7 +221,6 @@
|
|||
:borderless="!false"
|
||||
v-model="rangeDate"
|
||||
:label="`${'ระยะเวลา'}`"
|
||||
@update:modelValue="clickEditRow"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -396,10 +395,54 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
|
|||
await changeExamColumns("career", count);
|
||||
});
|
||||
|
||||
watch(startDate, async (count: Date, prevCount: Date) => {
|
||||
await calDate();
|
||||
});
|
||||
|
||||
watch(endDate, async (count: Date, prevCount: Date) => {
|
||||
await calDate();
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
const calDate = async () => {
|
||||
let _startDate = new Date(startDate.value.toISOString().substr(0, 10));
|
||||
let _endDate = new Date(endDate.value.toISOString().substr(0, 10));
|
||||
if (_startDate > _endDate) {
|
||||
const swap = _startDate;
|
||||
_startDate = _endDate;
|
||||
_endDate = swap;
|
||||
}
|
||||
const startYear = _startDate.getFullYear();
|
||||
const february =
|
||||
(startYear % 4 === 0 && startYear % 100 !== 0) || startYear % 400 === 0
|
||||
? 29
|
||||
: 28;
|
||||
const daysInMonth = [31, february, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
||||
|
||||
let yearDiff = _endDate.getFullYear() - startYear;
|
||||
let monthDiff = _endDate.getMonth() - _startDate.getMonth();
|
||||
if (monthDiff < 0) {
|
||||
yearDiff--;
|
||||
monthDiff += 12;
|
||||
}
|
||||
let dayDiff = _endDate.getDate() - _startDate.getDate();
|
||||
if (dayDiff < 0) {
|
||||
if (monthDiff > 0) {
|
||||
monthDiff--;
|
||||
} else {
|
||||
yearDiff--;
|
||||
monthDiff = 11;
|
||||
}
|
||||
dayDiff += daysInMonth[_startDate.getMonth()];
|
||||
}
|
||||
rangeDate.value = `${yearDiff > 0 ? yearDiff + " ปี " : ""}${
|
||||
monthDiff > 0 ? monthDiff + " เดือน " : ""
|
||||
}${dayDiff > 0 ? dayDiff + " วัน " : ""}`;
|
||||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -410,8 +453,8 @@ const fetchData = async () => {
|
|||
data.map((r: any) => {
|
||||
rows.value.push({
|
||||
...r,
|
||||
startDate: r.durationStart,
|
||||
endDate: r.durationEnd,
|
||||
startDate: new Date(r.durationStart),
|
||||
endDate: new Date(r.durationEnd),
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -69,6 +69,19 @@
|
|||
>
|
||||
<q-tooltip>บรรจุผู้ผ่านการคัดเลือก</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-email-check-outline"
|
||||
round
|
||||
flat
|
||||
color="green-6"
|
||||
@click="candidateCheckProfileDialog"
|
||||
:disabled="
|
||||
attrs.rows.filter((r) => r.status == 'checkRegister').length == 0
|
||||
"
|
||||
>
|
||||
<q-tooltip>ตรวจสอบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="items-center" style="display: flex">
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
|
|
@ -166,6 +179,7 @@ const table = ref<any>(null);
|
|||
const files = ref<File[]>([]);
|
||||
const filterRef = ref<any>(null);
|
||||
const examId = ref<string>(route.params.examId.toString());
|
||||
const candidateId = ref<string[]>([]);
|
||||
const { messageError, showLoader, hideLoader } = mixin;
|
||||
const props = defineProps({
|
||||
inputfilter: String,
|
||||
|
|
@ -391,6 +405,24 @@ const downloadFileDetail = async () => {
|
|||
});
|
||||
};
|
||||
|
||||
const checkCandidates = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.candidateCheckRegisters, {
|
||||
candidateId: candidateId.value,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
props.fetchData();
|
||||
});
|
||||
};
|
||||
|
||||
const downloadFilePDF = async (res: string, fileName: string) => {
|
||||
const link = document.createElement("a");
|
||||
link.href = window.URL.createObjectURL(
|
||||
|
|
@ -426,6 +458,27 @@ const publishModal = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const candidateCheckProfileDialog = async () => {
|
||||
dialogMessage(
|
||||
$q,
|
||||
"ยืนยันการตรวจสอบข้อมูลนี้หรือไม่?",
|
||||
"ยืนยันการตรวจสอบข้อมูล",
|
||||
"mdi-email-check-outline",
|
||||
"ยืนยัน",
|
||||
"public",
|
||||
candidateCheckProfile,
|
||||
undefined
|
||||
);
|
||||
};
|
||||
|
||||
const candidateCheckProfile = async () => {
|
||||
const filter = attrs.value.rows.filter((r: any) => r.check == true);
|
||||
filter.map((r: any) => {
|
||||
candidateId.value.push(r.id.toString());
|
||||
});
|
||||
await checkCandidates();
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
emit("update:inputfilter", "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue