ปรับวินัย
This commit is contained in:
parent
f24c737c0b
commit
f27c14e7bf
5 changed files with 87 additions and 49 deletions
|
|
@ -179,16 +179,18 @@ const props = defineProps({
|
|||
const emit = defineEmits(["submit:disciplinary"]);
|
||||
|
||||
const dateEndInputStyle = computed(() => {
|
||||
const currentDate = new Date();
|
||||
const investigationDateEnd = new Date(formData.disciplinaryDateEnd as Date);
|
||||
if (formData.disciplinaryDateStart) {
|
||||
const currentDate = new Date(formData.disciplinaryDateStart as Date);
|
||||
const investigationDateEnd = new Date(formData.disciplinaryDateEnd as Date);
|
||||
|
||||
const isInNext7Days =
|
||||
investigationDateEnd >= currentDate &&
|
||||
investigationDateEnd <=
|
||||
new Date(currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
|
||||
return isInNext7Days ? "input-alert" : "";
|
||||
const isInNext7Days =
|
||||
investigationDateEnd >= currentDate &&
|
||||
investigationDateEnd <=
|
||||
new Date(currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
|
||||
|
||||
return isInNext7Days ? "input-alert" : "";
|
||||
}
|
||||
});
|
||||
|
||||
/** เปิด dialog */
|
||||
function popup() {
|
||||
modal.value = true;
|
||||
|
|
@ -256,7 +258,7 @@ function onSubmit() {
|
|||
}
|
||||
|
||||
if (mainStore.rowsAdd) {
|
||||
formData.persons = mainStore.rowsAdd;
|
||||
formData.persons = mainStore.rowsAdd as any;
|
||||
}
|
||||
|
||||
emit("submit:disciplinary", formData);
|
||||
|
|
@ -325,11 +327,12 @@ async function fetchDatadetail() {
|
|||
prefix: person.prefix,
|
||||
firstName: person.firstName,
|
||||
lastName: person.lastName,
|
||||
position: person.position === null ? '-':person.position,
|
||||
positionLevel: person.positionLevel === null ? '-':person.positionLevel,
|
||||
salary: person.salary === null ? '-':person.salary,
|
||||
position: person.position === null ? "-" : person.position,
|
||||
positionLevel:
|
||||
person.positionLevel === null ? "-" : person.positionLevel,
|
||||
salary: person.salary === null ? "-" : person.salary,
|
||||
personId: person.personId,
|
||||
posNo: person.posNo === null ? '-':person.posNo,
|
||||
posNo: person.posNo === null ? "-" : person.posNo,
|
||||
organization: person.organization,
|
||||
isSend: person.isSend,
|
||||
isSuspend: person.isSuspend,
|
||||
|
|
@ -349,11 +352,12 @@ async function fetchDatadetail() {
|
|||
prefix: person.prefix,
|
||||
firstName: person.firstName,
|
||||
lastName: person.lastName,
|
||||
position: person.position === null ? '-':person.position,
|
||||
positionLevel: person.positionLevel === null ? '-':person.positionLevel,
|
||||
salary: person.salary === null ? '-':person.salary,
|
||||
position: person.position === null ? "-" : person.position,
|
||||
positionLevel:
|
||||
person.positionLevel === null ? "-" : person.positionLevel,
|
||||
salary: person.salary === null ? "-" : person.salary,
|
||||
personId: person.personId,
|
||||
posNo: person.posNo === null ? '-':person.posNo,
|
||||
posNo: person.posNo === null ? "-" : person.posNo,
|
||||
organization: person.organization,
|
||||
isSend: person.isSend,
|
||||
isSuspend: person.isSuspend,
|
||||
|
|
@ -528,6 +532,17 @@ function changeFormData() {
|
|||
}
|
||||
}
|
||||
|
||||
/** เช็ควันที่สิ้นสุดต้องมากกว่า หรือเท่ากับวันเริ่ม */
|
||||
function changeFormDataDate() {
|
||||
isSave.value = true;
|
||||
const startDate = new Date(formData.disciplinaryDateStart as Date);
|
||||
const endDate = new Date(formData.disciplinaryDateEnd as Date);
|
||||
|
||||
if (startDate > endDate) {
|
||||
formData.disciplinaryDateEnd = null;
|
||||
}
|
||||
}
|
||||
|
||||
function calendarOpen() {
|
||||
calendarModal.value = true;
|
||||
}
|
||||
|
|
@ -651,11 +666,6 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
function calculateMinDate() {
|
||||
const startDate = new Date(formData.disciplinaryDateStart as Date);
|
||||
startDate.setDate(startDate.getDate() + 1);
|
||||
return startDate;
|
||||
}
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
|
|
@ -1099,7 +1109,7 @@ onMounted(async () => {
|
|||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
@update:model-value="changeFormDataDate()"
|
||||
>
|
||||
<template #year="{ year }">{{
|
||||
year + 543
|
||||
|
|
@ -1170,6 +1180,7 @@ onMounted(async () => {
|
|||
menu-class-name="modalfix"
|
||||
v-model="formData.disciplinaryDateEnd"
|
||||
:readonly="
|
||||
formData.disciplinaryDateStart === null ||
|
||||
isReadonly ||
|
||||
formData.disciplinaryExtendHistory.length > 0
|
||||
"
|
||||
|
|
@ -1178,7 +1189,7 @@ onMounted(async () => {
|
|||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
:min-date="calculateMinDate()"
|
||||
:min-date="formData.disciplinaryDateStart"
|
||||
>
|
||||
<template #year="{ year }">{{
|
||||
year + 543
|
||||
|
|
@ -1192,6 +1203,7 @@ onMounted(async () => {
|
|||
:class="inputEditExtend(isReadonly)"
|
||||
ref="dateEndRef"
|
||||
:readonly="
|
||||
formData.disciplinaryDateStart === null ||
|
||||
isReadonly ||
|
||||
formData.disciplinaryExtendHistory
|
||||
.length > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue