รอบการขึ้นเงินเดือน
This commit is contained in:
parent
ed15f2edde
commit
05d4ea4b0b
2 changed files with 142 additions and 78 deletions
|
|
@ -15,8 +15,11 @@ const $q = useQuasar();
|
|||
const isActive = ref<boolean>(false);
|
||||
const period = ref<string>("");
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const effective = defineModel<Date|null|string>("effective", { required: true });
|
||||
const year = defineModel<number|null|string>("year");
|
||||
const effective = defineModel<Date | null | string>("effective", {
|
||||
required: true,
|
||||
});
|
||||
const isRead = defineModel<boolean>("isRead", { required: true });
|
||||
const year = defineModel<number | null | string>("year");
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, date2Thai, messageError } = mixin;
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
|
|
@ -43,6 +46,7 @@ const props = defineProps({
|
|||
period: String,
|
||||
effectiveDate: Date,
|
||||
isActive: Boolean,
|
||||
isRead: Boolean,
|
||||
});
|
||||
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
|
||||
function validateForm() {
|
||||
|
|
@ -58,9 +62,9 @@ function validateForm() {
|
|||
}
|
||||
|
||||
if (hasError.every((result) => result === true)) {
|
||||
if(props.edit == true){
|
||||
if (props.edit == true) {
|
||||
editSummit();
|
||||
}else{
|
||||
} else {
|
||||
onSubmit();
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +75,8 @@ function clearForm() {
|
|||
isActive.value = false;
|
||||
period.value = "";
|
||||
effective.value = null;
|
||||
year.value = 0
|
||||
year.value = 0;
|
||||
isRead.value = false;
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
@ -79,7 +84,7 @@ function close() {
|
|||
clearForm();
|
||||
}
|
||||
|
||||
function editSummit(){
|
||||
function editSummit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
period: period.value,
|
||||
|
|
@ -88,7 +93,7 @@ function editSummit(){
|
|||
year: year.value,
|
||||
};
|
||||
http
|
||||
.put(config.API.salaryPeriod()+`/${props.idRound}`, body)
|
||||
.put(config.API.salaryPeriod() + `/${props.idRound}`, body)
|
||||
.then((res) => {
|
||||
modal.value = false;
|
||||
clearForm();
|
||||
|
|
@ -133,16 +138,16 @@ function inputEdit(val: boolean) {
|
|||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
console.log(props.edit)
|
||||
console.log(props.edit);
|
||||
if (props.edit == true) {
|
||||
period.value = props.period ? props.period :'';
|
||||
effectiveDate.value = props.effectiveDate ? props.effectiveDate:null;
|
||||
period.value = props.period ? props.period : "";
|
||||
effectiveDate.value = props.effectiveDate ? props.effectiveDate : null;
|
||||
isActive.value = props.isActive;
|
||||
}else{
|
||||
year.value = 0
|
||||
effective.value = null
|
||||
period.value = ''
|
||||
isActive.value = false
|
||||
} else {
|
||||
year.value = 0;
|
||||
effective.value = null;
|
||||
period.value = "";
|
||||
isActive.value = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -161,47 +166,46 @@ watch(
|
|||
|
||||
<q-card-section class="scroll" style="max-height: 70vh">
|
||||
<div class="q-gutter-y-sm">
|
||||
|
||||
<datepicker
|
||||
|
||||
menu-class-name="modalfix"
|
||||
v-model="year"
|
||||
class="col-2"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
ref="yearRef"
|
||||
dense
|
||||
:class="inputEdit(isReadonly)"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
:model-value="year === 0 ? null : Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณาเลือกเลือกปีงบประมาณ'}`,
|
||||
]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
<datepicker
|
||||
:readonly="isRead"
|
||||
menu-class-name="modalfix"
|
||||
v-model="year"
|
||||
class="col-2"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:readonly="isRead"
|
||||
ref="yearRef"
|
||||
dense
|
||||
:class="inputEdit(isReadonly)"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
:model-value="year === 0 ? null : Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกเลือกปีงบประมาณ'}`]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
|
||||
<q-select
|
||||
:readonly="isRead"
|
||||
ref="periodRef"
|
||||
:class="inputEdit(isReadonly)"
|
||||
v-model="period"
|
||||
|
|
@ -218,12 +222,12 @@ watch(
|
|||
hide-bottom-space
|
||||
/>
|
||||
<datepicker
|
||||
:readonly="isRead"
|
||||
menu-class-name="modalfix"
|
||||
v-model="effective"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:readonly="isReadonly"
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
|
|
@ -240,7 +244,7 @@ watch(
|
|||
outlined
|
||||
dense
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
:readonly="isRead"
|
||||
hide-bottom-space
|
||||
:model-value="
|
||||
effective != null ? date2Thai(effective as Date) : null
|
||||
|
|
@ -264,16 +268,16 @@ watch(
|
|||
<div class="col q-pa-sm bg-white border_custom text-weight-medium">
|
||||
<div class="row items-center q-my-sm justify-between">
|
||||
<p class="q-ma-none">สถานะการใช้งาน</p>
|
||||
<label class="toggle-control">
|
||||
<input type="checkbox" v-model="isActive" />
|
||||
<label :class="isRead == true ? 'toggle-control noClick':'toggle-control'">
|
||||
<input type="checkbox" v-model="isActive" :readonly="isRead"/>
|
||||
<span class="control"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<form @submit.prevent="validateForm">
|
||||
<q-separator v-if="!isRead"/>
|
||||
<form @submit.prevent="validateForm" v-if="!isRead">
|
||||
<q-card-actions align="right" class="bg-white text-teal">
|
||||
<!-- <q-btn flat label="OK" v-close-popup /> -->
|
||||
<q-btn
|
||||
|
|
@ -360,4 +364,7 @@ $toggle-control-size: $toggle-height - ($toggle-gutter * 2);
|
|||
}
|
||||
}
|
||||
}
|
||||
.noClick {
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue