ปรับวินัย
This commit is contained in:
parent
f24c737c0b
commit
f27c14e7bf
5 changed files with 87 additions and 49 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ watch(props, () => {
|
|||
separator
|
||||
>
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section>{{ `${item.fullName} (${item.duty})` }}</q-item-section>
|
||||
<q-item-section>{{ `${item.fullName} ${item.duty ? `(${item.duty})`:''}` }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-scroll-area>
|
||||
|
|
|
|||
|
|
@ -181,6 +181,17 @@ function updatemodalPersonal(modal: boolean) {
|
|||
modalPersonal.value = modal;
|
||||
}
|
||||
|
||||
/** เช็ควันที่สิ้นสุดต้องมากกว่า หรือเท่ากับวันเริ่ม */
|
||||
function changeFormDataDate() {
|
||||
const startDate = new Date(data.startDateSuspend as Date);
|
||||
const endDate = new Date(data.endDateSuspend as Date);
|
||||
|
||||
if (startDate > endDate) {
|
||||
data.endDateSuspend = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
if (keycloak.tokenParsed != null) {
|
||||
|
|
@ -386,6 +397,7 @@ onMounted(async () => {
|
|||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormDataDate()"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
|
|
@ -429,12 +441,14 @@ onMounted(async () => {
|
|||
<div class="col-12">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
:readonly="!edit || data.startDateSuspend === null"
|
||||
v-model="data.endDateSuspend"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
:min-date="data.startDateSuspend"
|
||||
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
|
|
@ -446,7 +460,7 @@ onMounted(async () => {
|
|||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
:readonly="!edit"
|
||||
:readonly="!edit || data.startDateSuspend === null"
|
||||
:borderless="!edit"
|
||||
:model-value="
|
||||
data.endDateSuspend !== null
|
||||
|
|
@ -456,6 +470,7 @@ onMounted(async () => {
|
|||
:rules="[(val) => !!val || `${'กรุณาเลือกถึงวันที่'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'ถึงวันที่'}`"
|
||||
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue