ปรับวินัย

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

@ -180,7 +180,7 @@ watch(modal, (newValue) => {
<template>
<q-dialog v-model="modal" position="right" :maximized="true">
<q-card style="width: 420px; overflow: visible;">
<q-card style="width: 420px; overflow: visible">
<q-toolbar>
<q-toolbar-title class="text-subtitle1 text-bold"
>ทะเบยนประว</q-toolbar-title
@ -265,7 +265,7 @@ watch(modal, (newValue) => {
borderless
readonly
:model-value="imformation.prefix"
label="ตำนำหน้าชื่่อ"
label="คำนำหน้าชื่อ"
/>
</div>
<div class="col-xs-6 col-md-6">
@ -284,23 +284,15 @@ watch(modal, (newValue) => {
label="นามสกุล"
/>
</div>
<div class="col-xs-6 col-md-4">
<div class="col-xs-6 col-md-6">
<q-input
borderless
readonly
:model-value="imformation.birthDate"
label="วันเดือนปีเกิด"
label="วัน/เดือน/ปีเกิด"
/>
</div>
<div class="col-xs-6 col-md-4">
<q-input
borderless
readonly
:model-value="imformation.age"
label="อายุ"
/>
</div>
<div class="col-xs-6 col-md-4">
<div class="col-xs-6 col-md-6">
<q-input
borderless
readonly
@ -308,6 +300,14 @@ watch(modal, (newValue) => {
label="เพศ"
/>
</div>
<div class="col-xs-6 col-md-6">
<q-input
borderless
readonly
:model-value="imformation.age"
label="อายุ"
/>
</div>
</div>
</div>
</q-card>
@ -325,6 +325,8 @@ watch(modal, (newValue) => {
readonly
:model-value="goverment.oc === '' ? '-' : goverment.oc"
label="สังกัด"
autogrow
></q-input>
</div>
<div class="col-xs-6 col-md-6">

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

View file

@ -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

View file

@ -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>

View file

@ -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