ปรับวินัย

This commit is contained in:
setthawutttty 2024-01-19 15:58:58 +07:00
parent f24c737c0b
commit f27c14e7bf
5 changed files with 87 additions and 49 deletions

View file

@ -138,7 +138,8 @@ const formData = reactive<FormData>({
const rows = ref([]);
const dateEndInputStyle = computed(() => {
const currentDate = new Date();
if(formData.investigationDateStart){
const currentDate = new Date(formData.investigationDateStart as Date);
const investigationDateEnd = new Date(formData.investigationDateEnd as Date);
const isInNext7Days =
@ -147,6 +148,7 @@ const dateEndInputStyle = computed(() => {
new Date(currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
return isInNext7Days ? "input-alert" : "";
}
});
const initialPagination = ref<any>({
@ -494,6 +496,17 @@ function changeFormData() {
isSave.value = true;
}
/** เช็ควันที่สิ้นสุดต้องมากกว่า หรือเท่ากับวันเริ่ม */
function changeFormDataDate() {
isSave.value = true;
const startDate = new Date(formData.investigationDateStart as Date);
const endDate = new Date(formData.investigationDateEnd as Date);
if (startDate > endDate) {
formData.investigationDateEnd = null;
}
}
function calendarOpen() {
calendarModal.value = true;
}
@ -621,12 +634,6 @@ watch(
}
);
function calculateMinDate() {
const startDate = new Date(formData.investigationDateStart as Date);
startDate.setDate(startDate.getDate() + 1);
return startDate;
}
onMounted(async () => {
mainStore.rowsAdd = [];
getOc();
@ -981,7 +988,7 @@ onMounted(async () => {
autoApply
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
@update:model-value="changeFormDataDate()"
>
<template #year="{ year }">{{
year + 543
@ -1053,6 +1060,7 @@ onMounted(async () => {
menu-class-name="modalfix"
v-model="formData.investigationDateEnd"
:readonly="
formData.investigationDateStart === null ||
isReadonly ||
formData.investigationExtendHistory.length > 0
"
@ -1061,7 +1069,7 @@ onMounted(async () => {
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
:min-date="calculateMinDate()"
:min-date="formData.investigationDateStart"
>
<template #year="{ year }">{{
year + 543
@ -1075,6 +1083,7 @@ onMounted(async () => {
ref="dateEndRef"
:class="inputEditExtend(isReadonly)"
:readonly="
formData.investigationDateStart === null ||
isReadonly ||
formData.investigationExtendHistory.length >
0