ปรับการกรอกวันที่ การลา , ,ปฏิบัติราชการพิเศษ ,วันที่ไม่ได้รับเงินเดือน ,อื่นๆ
This commit is contained in:
parent
b0d63ebd35
commit
402466a439
4 changed files with 281 additions and 23 deletions
|
|
@ -212,7 +212,21 @@
|
|||
</div> -->
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDateLaeaveYear"
|
||||
:label="`${'ปี'}`"
|
||||
mask="####"
|
||||
dense
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกปี'}`]"
|
||||
:class="getClass(edit)"
|
||||
:readonly="!edit"
|
||||
:borderless="!edit"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.leaveYear"
|
||||
class="col-2"
|
||||
|
|
@ -470,6 +484,7 @@ import HistoryTable from "@/components/TableHistory.vue";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { QTableProps } from "quasar";
|
||||
import moment from "moment";
|
||||
|
||||
const props = defineProps({
|
||||
statusEdit: {
|
||||
|
|
@ -503,6 +518,8 @@ const {
|
|||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
convertDate,
|
||||
convertDateDisplay,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
|
||||
|
|
@ -566,6 +583,16 @@ const filterTotal = ref<string>("");
|
|||
const rowsTotal = ref<RequestItemsTotalObject[]>([]); //select data history
|
||||
const filter = ref<string>(""); //search data table
|
||||
|
||||
const inputDateLaeaveYear = ref<string>("");
|
||||
/** ตรวจเวลา */
|
||||
watch(
|
||||
() => inputDateLaeaveYear.value,
|
||||
(value: string) => {
|
||||
if (value.length === 4) {
|
||||
formData.leaveYear = parseInt(value) - 543;
|
||||
}
|
||||
}
|
||||
);
|
||||
/**old */
|
||||
// const visibleColumns = ref<String[]>([]);
|
||||
// profileData.leave.columns.length == 0
|
||||
|
|
@ -1051,11 +1078,11 @@ const getData = () => {
|
|||
// coupleDay.value = row.coupleDay;
|
||||
// therapyDay.value = row.therapyDay;
|
||||
formData.id = row.id;
|
||||
formData.sumSick = row.sumSick =='-' ? '':row.sumSick;
|
||||
formData.sumRest = row.sumRest =='-' ? '':row.sumRest;
|
||||
formData.sumLate = row.sumLate =='-' ? '':row.sumLate;
|
||||
formData.sumAbsent = row.sumAbsent =='-' ? '':row.sumAbsent;
|
||||
formData.sumEducation = row.sumEducation =='-' ? '':row.sumEducation;
|
||||
formData.sumSick = row.sumSick == "-" ? "" : row.sumSick;
|
||||
formData.sumRest = row.sumRest == "-" ? "" : row.sumRest;
|
||||
formData.sumLate = row.sumLate == "-" ? "" : row.sumLate;
|
||||
formData.sumAbsent = row.sumAbsent == "-" ? "" : row.sumAbsent;
|
||||
formData.sumEducation = row.sumEducation == "-" ? "" : row.sumEducation;
|
||||
formData.leaveYear = row.leaveYear == "-" ? 0 : Number(row.leaveYear) - 543;
|
||||
|
||||
// id.value = row.id;
|
||||
|
|
@ -1101,6 +1128,7 @@ const clickAdd = async () => {
|
|||
|
||||
const clickAddLeave = async () => {
|
||||
clearForm();
|
||||
inputDateLaeaveYear.value = (moment().year() + 543).toString();
|
||||
editRow.value = false;
|
||||
edit.value = true;
|
||||
modalAdd.value = true;
|
||||
|
|
@ -1158,11 +1186,11 @@ const clickSave = async () => {
|
|||
if (result) {
|
||||
if (modalEdit.value) {
|
||||
// await dialogConfirm($q, () => {
|
||||
editData();
|
||||
editData();
|
||||
// });
|
||||
} else {
|
||||
// await dialogConfirm($q, () => {
|
||||
saveData();
|
||||
saveData();
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
|
@ -1324,12 +1352,19 @@ const selectData = async (props: DataProps) => {
|
|||
|
||||
rowIndex.value = props.rowIndex;
|
||||
formData.id = props.row.id;
|
||||
formData.sumSick = props.row.sumSick == '-' ? '':props.row.sumSick;
|
||||
formData.sumRest = props.row.sumRest == '-' ? '':props.row.sumRest;
|
||||
formData.sumLate = props.row.sumLate == '-' ? '':props.row.sumLate;
|
||||
formData.sumAbsent = props.row.sumAbsent == '-' ? '':props.row.sumAbsent;
|
||||
formData.sumEducation = props.row.sumEducation == '-' ? '':props.row.sumEducation;
|
||||
formData.leaveYear = props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543;
|
||||
formData.sumSick = props.row.sumSick == "-" ? "" : props.row.sumSick;
|
||||
formData.sumRest = props.row.sumRest == "-" ? "" : props.row.sumRest;
|
||||
formData.sumLate = props.row.sumLate == "-" ? "" : props.row.sumLate;
|
||||
formData.sumAbsent = props.row.sumAbsent == "-" ? "" : props.row.sumAbsent;
|
||||
formData.sumEducation =
|
||||
props.row.sumEducation == "-" ? "" : props.row.sumEducation;
|
||||
formData.leaveYear =
|
||||
props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543;
|
||||
console.log("เเก้ไข");
|
||||
|
||||
inputDateLaeaveYear.value = ((formData.leaveYear as number) + 543).toString();
|
||||
|
||||
console.log(inputDateLaeaveYear.value);
|
||||
|
||||
// id.value = props.row.id;
|
||||
// typeLeave.value = props.row.typeLeaveId;
|
||||
|
|
@ -1361,10 +1396,9 @@ const selectData = async (props: DataProps) => {
|
|||
* กดปุ่มเพิ่มบน table
|
||||
*/
|
||||
const addData = async () => {
|
||||
// modalEdit.value = false;
|
||||
|
||||
//modalEdit.value = false;
|
||||
modal.value = true;
|
||||
// edit.value = true;
|
||||
//edit.value = true;
|
||||
await clickTotal();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,18 @@
|
|||
<q-card-section class="q-p-sm">
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDate"
|
||||
:label="`${'วันที่'}`"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่'}`]"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="date"
|
||||
|
|
@ -193,7 +204,15 @@ const store = useProfileDataStore();
|
|||
const { profileData, changeProfileColumns } = store;
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
|
||||
const {
|
||||
convertDateDisplay,
|
||||
convertDate,
|
||||
date2Thai,
|
||||
success,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const id = ref<string>("");
|
||||
const date = ref<Date>(new Date());
|
||||
|
|
@ -218,6 +237,26 @@ const profileId = ref<string>(
|
|||
const rows = ref<RequestItemsObject[]>([]);
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([]);
|
||||
|
||||
const inputDate = ref<string>("");
|
||||
const dayChecked = ref<boolean>(false);
|
||||
/** ตรวจเวลา */
|
||||
watch(
|
||||
() => inputDate.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked.value = false;
|
||||
date.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayChecked.value = true;
|
||||
inputDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
profileData.other.columns.length == 0
|
||||
? (visibleColumns.value = ["date", "detail"])
|
||||
: (visibleColumns.value = profileData.other.columns);
|
||||
|
|
@ -387,6 +426,7 @@ const clickEdit = () => {
|
|||
* กดปุ่มเพิ่มด้านบน table
|
||||
*/
|
||||
const clickAdd = async () => {
|
||||
inputDate.value = "";
|
||||
editRow.value = false;
|
||||
await addData();
|
||||
};
|
||||
|
|
@ -521,6 +561,8 @@ const selectData = async (props: DataProps) => {
|
|||
date.value = props.row.date;
|
||||
detail.value = props.row.detail;
|
||||
id.value = props.row.id;
|
||||
|
||||
inputDate.value = convertDateDisplay(date.value);
|
||||
await checkRowPage();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,18 @@
|
|||
<q-card-section class="q-p-sm">
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDate"
|
||||
label="วัน/เดือน/ปี"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวัน เดือน ปี'}`]"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="date"
|
||||
|
|
@ -162,7 +173,17 @@
|
|||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDateRefCommandDate"
|
||||
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="refCommandDate"
|
||||
|
|
@ -294,8 +315,16 @@ const store = useProfileDataStore();
|
|||
const { profileData, changeProfileColumns } = store;
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const {
|
||||
convertDateDisplay,
|
||||
convertDate,
|
||||
date2Thai,
|
||||
success,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const id = ref<string>("");
|
||||
const date = ref<Date>(new Date());
|
||||
|
|
@ -325,6 +354,45 @@ const checkValidate = ref<boolean>(false); //validate data ผ่านหรื
|
|||
const rows = ref<RequestItemsObject[]>([]);
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([]);
|
||||
const inputDate = ref<string>("");
|
||||
const inputDateRefCommandDate = ref<string>(
|
||||
refCommandDate.value ? convertDateDisplay(refCommandDate.value) : ""
|
||||
);
|
||||
|
||||
const dayChecked = ref<boolean>(false);
|
||||
const dayCheckedRefCommandDate = ref<boolean>(false);
|
||||
/** ตรวจเวลา */
|
||||
watch(
|
||||
() => inputDate.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked.value = false;
|
||||
date.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayChecked.value = true;
|
||||
inputDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => inputDateRefCommandDate.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked.value = false;
|
||||
refCommandDate.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayChecked.value = true;
|
||||
inputDateRefCommandDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
profileData.record.columns.length == 0
|
||||
? (visibleColumns.value = [
|
||||
"date",
|
||||
|
|
@ -725,6 +793,11 @@ const selectData = async (props: DataProps) => {
|
|||
refCommandNo.value = props.row.refCommandNo;
|
||||
refCommandDate.value = props.row.refCommandDate;
|
||||
id.value = props.row.id;
|
||||
|
||||
inputDate.value = convertDateDisplay(date.value);
|
||||
inputDateRefCommandDate.value = refCommandDate.value
|
||||
? convertDateDisplay(refCommandDate.value)
|
||||
: "";
|
||||
await checkRowPage();
|
||||
};
|
||||
|
||||
|
|
@ -740,6 +813,8 @@ const addData = () => {
|
|||
reference.value = "";
|
||||
refCommandNo.value = "";
|
||||
refCommandDate.value = null;
|
||||
inputDate.value = convertDateDisplay(date.value);
|
||||
inputDateRefCommandDate.value = "";
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,7 +64,20 @@
|
|||
<q-card-section class="q-p-sm">
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDateStart"
|
||||
label="วันที่เริ่มต้น"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
:error="dayCheckedStart"
|
||||
error-message="กรุณากรอกวัน/เดือน/ปี เริ่มต้น"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="dateStart"
|
||||
|
|
@ -107,7 +120,19 @@
|
|||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDateEnd"
|
||||
label="วันที่สิ้นสุด"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
:error="dayCheckedEnd"
|
||||
error-message="กรุณากรอกวัน/เดือน/ปี สิ้นสุด"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateEnd"
|
||||
:locale="'th'"
|
||||
|
|
@ -205,7 +230,17 @@
|
|||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputRefCommandDate"
|
||||
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="refCommandDate"
|
||||
|
|
@ -252,9 +287,7 @@
|
|||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
</template>
|
||||
|
||||
</datepicker>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -311,6 +344,7 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import moment from "moment";
|
||||
import { useProfileDataStore } from "@/modules/04_registry/store";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
|
|
@ -340,8 +374,16 @@ const store = useProfileDataStore();
|
|||
const { profileData, changeProfileColumns } = store;
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const {
|
||||
convertDateDisplay,
|
||||
convertDate,
|
||||
date2Thai,
|
||||
success,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const id = ref<string>("");
|
||||
const dateStart = ref<Date>(new Date());
|
||||
|
|
@ -371,6 +413,61 @@ const profileId = ref<string>(
|
|||
const rows = ref<RequestItemsObject[]>([]);
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([]);
|
||||
|
||||
console.log(dateStart.value);
|
||||
const inputDateStart = ref<string>(convertDateDisplay(dateStart.value));
|
||||
const inputDateEnd = ref<string>(convertDateDisplay(dateEnd.value));
|
||||
const inputRefCommandDate = ref<string>("");
|
||||
|
||||
const dayCheckedStart = ref<boolean>(false);
|
||||
const dayCheckedEnd = ref<boolean>(false);
|
||||
/** ตรวจเวลา */
|
||||
watch(
|
||||
() => inputDateStart.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayCheckedStart.value = false;
|
||||
dateStart.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayCheckedStart.value = true;
|
||||
inputDateStart.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => inputRefCommandDate.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayCheckedEnd.value = false;
|
||||
refCommandDate.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayCheckedEnd.value = true;
|
||||
inputRefCommandDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => inputDateEnd.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayCheckedEnd.value = false;
|
||||
dateEnd.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayCheckedEnd.value = true;
|
||||
inputDateEnd.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
profileData.work.columns.length == 0
|
||||
? (visibleColumns.value = [
|
||||
"dateStart",
|
||||
|
|
@ -804,6 +901,12 @@ const selectData = async (props: DataProps) => {
|
|||
refCommandNo.value = props.row.refCommandNo;
|
||||
refCommandDate.value = props.row.refCommandDate;
|
||||
id.value = props.row.id;
|
||||
|
||||
inputDateStart.value = convertDateDisplay(dateStart.value);
|
||||
inputDateEnd.value = convertDateDisplay(dateEnd.value);
|
||||
inputRefCommandDate.value = refCommandDate.value
|
||||
? convertDateDisplay(refCommandDate.value)
|
||||
: "";
|
||||
await checkRowPage();
|
||||
};
|
||||
|
||||
|
|
@ -820,6 +923,10 @@ const addData = () => {
|
|||
reference.value = "";
|
||||
refCommandNo.value = "";
|
||||
refCommandDate.value = null;
|
||||
|
||||
inputDateStart.value = convertDateDisplay(dateStart.value);
|
||||
inputDateEnd.value = convertDateDisplay(dateEnd.value);
|
||||
inputRefCommandDate.value = "";
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue