สรรหาแก้ไขวันที่สมัครให้แสดงเวลา

This commit is contained in:
Warunee Tamkoo 2025-11-25 17:20:38 +07:00
parent d72551f90b
commit 5aa48d73d3
2 changed files with 32 additions and 15 deletions

View file

@ -260,13 +260,17 @@ async function deleteData(id: string) {
* แปลงชวงวนทา2คาเปนวนเดยวกนจะโชววนเดยวแตาไมเทากนจะแสดงเปนชวง
* @param val วงวนท
*/
function dateThaiRange(val: [Date, Date]) {
function dateThaiRange(val: [Date, Date], time: boolean = false) {
if (val === null) {
return "-";
} else if (date2Thai(val[0], true) === date2Thai(val[1], true)) {
return `${date2Thai(val[0], true)}`;
return `${date2Thai(val[0], true, time)}`;
} else {
return `${date2Thai(val[0], true)} - ${date2Thai(val[1], true)}`;
return `${date2Thai(val[0], true, time)} - ${date2Thai(
val[1],
true,
time
)}`;
}
}
@ -355,11 +359,15 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
</div>
<div
v-else-if="col.name == 'dateRegister'"
class="table_ellipsis2"
>
{{ dateThaiRange(col.value, true) }}
</div>
<div
v-else-if="
col.name == 'dateRegister' ||
col.name == 'datePayment' ||
col.name == 'dateAnnouncement'
col.name == 'datePayment' || col.name == 'dateAnnouncement'
"
class="table_ellipsis2"
>

View file

@ -768,13 +768,19 @@ function clickDeletePosition(row: any) {
* แปลงชวงวนทา2คาเปนวนเดยวกนจะโชววนเดยวแตาไมเทากนจะแสดงเปนชวง
* @param val วงวนท
*/
function dateThaiRange(val: [Date, Date] | null) {
function dateThaiRange(val: [Date, Date] | null, showTime: boolean = false) {
if (val === null) {
return "";
} else if (date2Thai(val[0], true) === date2Thai(val[1], true)) {
return `${date2Thai(val[0], true)}`;
} else if (
date2Thai(val[0], true, showTime) === date2Thai(val[1], true, showTime)
) {
return `${date2Thai(val[0], true, showTime)}`;
} else {
return `${date2Thai(val[0], true)} - ${date2Thai(val[1], true)}`;
return `${date2Thai(val[0], true, showTime)} - ${date2Thai(
val[1],
true,
showTime
)}`;
}
}
@ -1145,6 +1151,11 @@ onMounted(async () => {
borderless
range
week-start="0"
:enableTimePicker="true"
:start-time="[
{ hours: 8, minutes: 0 },
{ hours: 16, minutes: 0 },
]"
>
<template #year="{ year }">
{{ year + 543 }}
@ -1158,8 +1169,9 @@ onMounted(async () => {
dense
:readonly="checkRoutePermisson"
class="full-width datepicker q-mb-md"
:model-value="dateThaiRange(dateRegister)"
:model-value="dateThaiRange(dateRegister, true)"
:label="`${'วันที่สมัคร'}`"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่สมัคร'}`]"
clearable
@clear="clearDateRegister"
hide-bottom-space
@ -1488,10 +1500,7 @@ onMounted(async () => {
<q-separator size="5px" color="grey-2" class="q-mt-lg" />
</div>
<div
class="col-12 q-mt-lg"
v-if="shouldShowPaymentFields"
>
<div class="col-12 q-mt-lg" v-if="shouldShowPaymentFields">
<div class="text-bold text-subtitle2 q-pb-md">
เลอกวการชำระเง
</div>